开发者

Jquery doesn't load

开发者 https://www.devze.com 2023-03-11 14:24 出处:网络
For some reason jQuery won\'t load on my website. I\'ve tried it in google chrome and in opera, and both browsers didn\'t load it. This is (part of) my code:

For some reason jQuery won't load on my website. I've tried it in google chrome and in opera, and both browsers didn't load it. This is (part of) my code:

<script type="text/javascript" src="http://localhost:85/rgv/Scripts/CKEdit/ckeditor.js"></script>
<script type="text/javascript" scr="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript">


window.onload = function()
{
// Listen to the double click event.
if ( window.addEventListener )
    document.getElementById('editPage').addEventListener( 'click', onClick, false );
else if ( window.attachEvent )
    document.getElementById('editPage').attachEvent( 'onclick', onClick );

};
function firstChild(element)
{
for (var i = 0; i < element.childNodes.length; i++)
{
    var child = element.childNodes[i];
    if (child.nodeType == 1)
    {
        return child;
    }
}
}
function onClick( ev )
{
if (typeof $ == 'undefined') {
alert('nooo');
} else {
    alert('yeah');
} 
var content = document.getElementById('innercontent');
var first = firstChild(content);
alert('hi');
var divHtml = $("#leftPanel");
alert('boo');
alert(divHtml);
var editableText = $("<textarea />");
editableText.val(divHtml);
$('#leftPanel').replaceWith(editableText);
/*for (var i = 0; i < content.childNodes.length; i++)
{
    var child = content.childNodes[i];
    if (child.nodeType == 1 && child != first)
    {
         content.removeChild(child);
    }
}*/
}

As you can see, jquery should be loaded on the second line of this script, but when the onClick function is called, It tells me that jquer开发者_Go百科y isn't loaded. I've also tried downloading the jquery script to use that one, but that didn't work either. Can anyone please help me?


You've got 'scr' instead of 'src' when including jQuery.

0

精彩评论

暂无评论...
验证码 换一张
取 消