...

View Full Version : Multi <Div> and two Dimensional Array in JavaScript



vabh
06-06-2007, 07:57 PM
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.

vabh
06-07-2007, 07:21 PM
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

vabh
06-18-2007, 09:04 PM
Hello,

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

Thanks,
vabh

felgall
06-18-2007, 09:45 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum