Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Multi <Div> and two Dimensional Array in JavaScript

    Hi All,

    I have multi <DIV> layers that displays the output from the two Dimensional array in the following code, I need to re write this piece to some thing else that will have same lay out and style. I will appreciate any ideas on this.

    The reason for the rewrite of the code is the below error lines are casuing error : "Internet Explorer cannot open site .... , Operation abort. " with IE 6,
    <body>
    <div class= "rightcol">
    <div class="newslisting" style="margin:0px 0px 3px 0px;">
    <div class="newslistingdatemodule" style="font-size: 11px" id="cal_date_0"></div>
    <div class="newslistingcontentmodule" style="font-size: 11px"> <a id="cal_link_0" href="" target="_blank"></a> </div>
    </div>

    <div class="modulecontent"> &gt;&gt;<a href="http://pr-tools.com/pcgi-bin/prSch.pl?formtype=view_public_calendar" target
    ="_blank">View More Events</a> </div>
    </div>
    </div>

    <!--- This generates two Dimensional JS array--->
    <script type="text/javascript" language='javascript' src='http://pr-tool.com/html/data.js'></script>


    <script type="text/javascript">

    function $(id) {
    return document.getElementById(id);
    }

    for(i=0;i<public_calendar_data.length;i++) {

    <!----- the below three lines of code is causing an error:---->
    $("cal_date_"+i.toString()).innerHTML = public_calendar_data[i][0];
    $("cal_link_"+i.toString()).href = public_calendar_data[i][1];
    $("cal_link_"+i.toString()).innerHTML = public_calendar_data[i][2];


    }

    </script>

    </div>
    </body>

    Thanks,
    vabh.
    Last edited by vabh; 06-07-2007 at 01:46 PM. Reason: To add the error details

  • #2
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi All,

    Pls tell me if any one has an idea about the why the above piece of code causing " Internet explorer cannot open the internet site ..... operation abort" error.

    Thanks,
    Vabh

  • #3
    New to the CF scene
    Join Date
    Jun 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hello,

    I moved the JS code from <body></body> between </body> </html>, The above is not reappearing any more.

    Thanks,
    vabh

  • #4
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    6,642
    Thanks
    0
    Thanked 649 Times in 639 Posts
    You have to call that code from the window.onload so that the page loads before trying to access it. Moving it after the </body> tag will break its functioning in most browsers as that is not a valid place for JavaScript.
    Stephen
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.


  •  

    Posting Permissions

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