开发者

javascript error in IE 8?

开发者 https://www.devze.com 2023-04-07 17:09 出处:网络
IE 8, 7, and 6 are all complaining about the same character in the below snippet: else if (page == \"/about\") {

IE 8, 7, and 6 are all complaining about the same character in the below snippet:

else if (page == "/about") {

    $.address.title("About");

    $('#main').load("about.php", function () { 
    });开发者_开发知识库  <=  This character (the semi colon)
}

You'll see three javascript errros with IE 8 all pointing to the same character. Am I missing something or is this an invalid character in older version of IE?


For anyone else who has a similar issue, here was the problem. As mentioned below the error returned from IE was not even close to the correct location. That aside here is what happened. I had a php variable mixed with javascript like so:

<textarea class="question_text" id="1" name="1" onFocus="if (this.value == <?php echo($question[0]['question_text']); ?>) { this.value = ''; }"><?php echo($question[0]['question_text']); ?></textarea>

I needed to add quotes around the php value retured like so:

<textarea class="question_text" id="1" name="1" onFocus="if (this.value == <?php echo("$question[0]['question_text']"); ?>) { this.value = ''; }"><?php echo("$question[0]['question_text']"); ?></textarea>


According to my debugger, your 1st of 3 syntax errors is here: $.address.title("Edit Profile");

0

精彩评论

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

关注公众号