Results 1 to 5 of 5

Thread: Script Does not allow page to load in IE7

  1. #1
    Join Date
    Oct 2008
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Script Does not allow page to load in IE7

    here is the java that I'm using..

    Quote Array:
    Code:
    <SCRIPT type="text/javascript">
    	var quotations = new Array()
    	quotations[0]= "I have not failed. I've just found 10,000 ways that don't work.<br /><b>Thomas Alva Edison</b>"
    	quotations[1]= "The great thing about a computer notebook is that no matter how much you stuff into it, it doesn't get bigger or heavier.<br /><b>Bill Gates</b>"
    	quotations[2]= "Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.<br /><b>Andy Rooney</b>"
    	quotations[3]= "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.<br /><b>Albert Einstein</b>"
    	quotations[4]= "Whether you think that you can, or that you can't, you are usually 	right.<br /><b>Henry Ford</b>"
    	quotations[5]= "To have a quiet mind is to possess one's mind wholly; to have a calm spirit is to possess one's self<br /><b>Hamilton Mabie</b>"
    	function display()
    	{
    	a=Math.floor(Math.random()*quotations.length)
    	document.getElementById('quotation').innerHTML=quotations[a]
    	setTimeout("display()",5000)
    	}
    	</SCRIPT>
    Display Code:
    Code:
    <SCRIPT type="text/javascript">display()</SCRIPT>
    error that IE7 give me:
    Code:
    Internet Explorer cannot open the Internet site http://designdt.co.cc/book
    
    Operation aborted

    IE7 then takes you to a page could not load screen..

    Any help on fixing this would be great....

    thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    There are some minor issues I have with the script. For one the variable a should be formally declared. But even without fixing that or other minor things, this worked fine here in IE 7 locally:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
       "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <SCRIPT type="text/javascript">
    	var quotations = new Array()
    	quotations[0]= "I have not failed. I've just found 10,000 ways that don't work.<br /><b>Thomas Alva Edison</b>"
    	quotations[1]= "The great thing about a computer notebook is that no matter how much you stuff into it, it doesn't get bigger or heavier.<br /><b>Bill Gates</b>"
    	quotations[2]= "Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.<br /><b>Andy Rooney</b>"
    	quotations[3]= "Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.<br /><b>Albert Einstein</b>"
    	quotations[4]= "Whether you think that you can, or that you can't, you are usually 	right.<br /><b>Henry Ford</b>"
    	quotations[5]= "To have a quiet mind is to possess one's mind wholly; to have a calm spirit is to possess one's self<br /><b>Hamilton Mabie</b>"
    	function display()
    	{
    	a=Math.floor(Math.random()*quotations.length)
    	document.getElementById('quotation').innerHTML=quotations[a]
    	setTimeout("display()",5000)
    	}
    	</SCRIPT>
    </head>
    <body>
    <div id="quotation"></div>
    <SCRIPT type="text/javascript">display()</SCRIPT>
    </body>
    </html>
    On your page, try changing:

    HTML Code:
    <div id="quotation">			
    			<p>&quot;
    			<SCRIPT type="text/javascript">display()</SCRIPT>
    			&quot;</p>
    			</div>
    to:

    HTML Code:
    <div>&quot;<span id="quotation"></span>&quot;</div>
    <SCRIPT type="text/javascript">display()</SCRIPT>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Here it is with all of those minor issues I saw worked out:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <script type="text/javascript">
    display.quotations = new Array();
     display.quotations[0] = ["I have not failed. I've just found 10,000 ways that don't work.", "Thomas Alva Edison"];
     display.quotations[1] = ["The great thing about a computer notebook is that no matter how much you stuff into it, it doesn't get bigger or heavier.", "Bill Gates"];
     display.quotations[2] = ["Computers make it easier to do a lot of things, but most of the things they make it easier to do don't need to be done.", "Andy Rooney"];
     display.quotations[3] = ["Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.", "Albert Einstein"];
     display.quotations[4] = ["Whether you think that you can, or that you can't, you are usually right.", "Henry Ford"];
     display.quotations[5] = ["To have a quiet mind is to possess one's mind wholly; to have a calm spirit is to possess one's self", "Hamilton Mabie"];
    
    function display(){
     var a = Math.floor(Math.random() * display.quotations.length),
     d = document.getElementById('quotation'),
     b = document.createElement('b'),
     br = document.createElement('br');
     while (d.lastChild)
      d.removeChild(d.lastChild);
     d.appendChild(document.createTextNode('"' + display.quotations[a][0] + '"'));
     b.appendChild(document.createTextNode(display.quotations[a][1]));
     d.appendChild(br); d.appendChild(b);
     if (!display.running)
      display.running = setInterval(display, 5000);
    };
    </script>
    </head>
    <body>
    <div id="quotation"></div>
    <script type="text/javascript">display();</script>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #4
    Join Date
    Jul 2008
    Posts
    128
    Thanks
    0
    Thanked 17 Times in 16 Posts

    Default

    Quote Originally Posted by highalpine View Post
    here is the java that I'm using..
    Actually it's JavaScript, Java is another language.

    error that IE7 give me:
    Code:
    Internet Explorer cannot open the Internet site http://designdt.co.cc/book
    
    Operation aborted
    As I recall the usual cause of this error is when a script that creates elements or changes element contents, is itself nested inside an element, instead of immediately within the <head> or <body>.

    Unfortunately you haven't shown enough code to be able to check this.

    Also try validating your markup: http://validator.w3.org

  5. #5
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by clueful View Post

    Quote Originally Posted by highalpine View Post
    error that IE7 give me:
    Code:
    Internet Explorer cannot open the Internet site http://designdt.co.cc/book
    
    Operation aborted
    Actually it's JavaScript, Java is another language.

    As I recall the usual cause of this error is when a script that creates elements or changes element contents, is itself nested inside an element, instead of immediately within the <head> or <body>.

    Unfortunately you haven't shown enough code to be able to check this.

    Also try validating your markup: http://validator.w3.org
    Actually, all the code we need to see is at the address given by the error message. And as you speculated, and as I pointed out, it is:

    Quote Originally Posted by jscheuer1 View Post
    On your page, try changing:

    HTML Code:
    <div id="quotation">			
    			<p>&quot;
    			<SCRIPT type="text/javascript">display()</SCRIPT>
    			&quot;</p>
    			</div>
    to:

    HTML Code:
    <div>&quot;<span id="quotation"></span>&quot;</div>
    <SCRIPT type="text/javascript">display()</SCRIPT>
    Still, I prefer the code given in my second response in this thread, a vast improvement upon the original.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •