![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
So, I'm getting an error on line 27, where I close the first catch with a curly brace. Here's the code: Code:
Can anyone tell me why it would be giving me the error msg there? I'm not getting the same error in Mozilla, and I've searched around and haven't been able to find any info on issues with cross browser support for try & catch. |
function ShowBlog(page){ document.getElementById('blog').innerHTML = "<p style=\"color: orange; font-weight: bold;\"><i>Loading, I appreciate your patience . . .</i></p>"; var xmlHttp; // Creating the xmlHttp var depending on the browser var browser = navigator.appName; //find the browser name if(browser == "Microsoft Internet Explorer"){ // Create the object using MSIE's method xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); }else{ // Create the object using other browser's method xmlHttp = new XMLHttpRequest(); }; var url = "../php/blog-ReturnStr.php"; var params = "page=" + page + "accesslvl=" + <?php if (isset($_SESSION['_ACCESSLVL'])){ echo $_SESSION['_ACCESSLVL']; } else echo "1"; ?>; xmlHttp.open("GET", url+"?"+params, true); xmlHttp.onreadystatechange=function(){ if(xmlHttp.readyState==4){ document.getElementById('blog').innerHTML = xmlHttp.responseText; } else if (xmlHttp.readyState == 2 | 3){ document.getElementById('blog').innerHTML = "<p style=\"color: orange; font-weight: bold;\"><i>Loading, I appreciate your patience . . .</i></p>"; } } xmlHttp.send(null); }
#3
| |||
| |||
|
|
So, I'm getting an error on line 27, where I close the first catch with a curly brace. |
#4
| |||
| |||
|
|
On Dec 15, 8:57 pm, SeanInSeattle <WakieWa... (AT) gmail (DOT) com> wrote: So, I'm getting an error on line 27, where I close the first catch with a curly brace. What is the error message? Line numbers won't mean much if code lines are long as the code is wrapped at about 72 character width. [snip code] Peter |
#5
| |||
| |||
|
|
On Dec 15, 9:55 pm, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: On Dec 15, 8:57 pm, SeanInSeattle <WakieWa... (AT) gmail (DOT) com> wrote: So, I'm getting an error on line 27, where I close the first catch with a curly brace. What is the error message? Line numbers won't mean much if code lines are long as the code is wrapped at about 72 character width. [...] The error |
|
is showing up right after the "if(browser == "Microsoft Internet Explorer"){ [create xmlhttp request object in MSIE] } else{ [create xmlhttp request object for all other browsers] }" lines, using either method for decision statements. |
#6
| |||
| |||
|
|
On Dec 15, 9:55 pm, Peter Michaux <petermich... (AT) gmail (DOT) com> wrote: On Dec 15, 8:57 pm, SeanInSeattle <WakieWa... (AT) gmail (DOT) com> wrote: So, I'm getting an error on line 27, where I close the first catch with a curly brace. What is the error message? Line numbers won't mean much if code lines are long as the code is wrapped at about 72 character width. [snip code] Peter The error is showing up right after the "if(browser == "Microsoft Internet Explorer"){ [create xmlhttp request object in MSIE] } else{ [create xmlhttp request object for all other browsers] }" lines, using either method for decision statements. Thanks for your help! |
#7
| |||
| |||
|
|
SeanInSeattle said: snip The error is showing up right after the "... snip You might not realize it if you work with Internet Explorer exclusively, but the words in error messages are actually supposed to be useful information. Even in Internet Explorer, they often contain useful hints. |
#8
| |||
| |||
|
|
Lee wrote: SeanInSeattle said: snip The error is showing up right after the "... snip You might not realize it if you work with Internet Explorer exclusively, but the words in error messages are actually supposed to be useful information. Even in Internet Explorer, they often contain useful hints. Which is to say that there is a precise relationship between the cause of an error and the message generated and that relationship can be learnt. So, given the exact error text it is usually possible to know what types of mistakes cause the error in question and so then to know what to look for in the code. With the line/character numbers giving some indication of where to look for that error (even if the location they state is rarely the actual location of the error). |
![]() |
| Thread Tools | |
| Display Modes | |
| |