The problem lies in this section:
if (document.layers) {
document.layers["myDiv"].document.open();
document.layers["myDiv"].document.write(rs);
document.layers["myDiv"].document.close();
} else {
document.all["myDiv"].innerHTML = rs;
}
NS7 doesn't use document.layers or document.all
You might want to check out a cross browser js library such as
http://www.cross-browser.com/
it definitely simplifies operations such as this. With this library, this whole block
could be written as such:
xHTML('myDiv',rs);
Marlon
Jillian Carroll wrote:
>I've got an unusual problem.
>
>I have a Javascript that rotates through a series of books (images/text
>w/links). It's very simple. It works in IE and NS 4.x... But it doesn't
>workin Mozilla / NS 7... nothing appears on the screen. How can I modify
>this script/div so that it will display in all browsers?
>
>Script (in an external slideshow.js file that is linked to on the page with
>the div):
>
> var wait = 5000;
> var arr = new Array();
> var counter = 0;
>
> function cell(image, text) {
> this.image = image;
> this.text = text;
>
> this.drawMe = drawMe;
> }
>
> function drawMe() {
> var rs = "<TABLE border=0>";
> rs += " <TR><TD>"+this.image+"</TD></TR>";
> rs += " <TR><TD>"+this.text+"</TD></TR>";
> rs += "</TABLE>";
>
> if (document.layers) {
> document.layers["myDiv"].document.open();
> document.layers["myDiv"].document.write(rs);
> document.layers["myDiv"].document.close();
> } else {
> document.all["myDiv"].innerHTML = rs;
> }
> }
>
> arr[arr.length] = new cell("<a
>href=http://www.neal-schuman.com/db/3/343.html><img
>src=feature_books/HOILAsmall.jpg border=0></a>","<a
>href=http://www.neal-schuman.com/db/3/343.html>20 ready-to-go
>sessions</a>");
> arr[arr.length] = new cell("<a
>href=http://www.neal-schuman.com/db/4/304.html><img
>src=feature_books/CKATW115.jpg border=0></a>","<a
>href=http://www.neal-schuman.com/db/4/304.html>Teach safe Internet
>use</a>");
> arr[arr.length] = new cell("<a
>href=http://www.neal-schuman.com/db/2/292.html><img
>src=feature_books/VRLH.jpg border=0></a>","<a
>href=http://www.neal-schuman.com/db/2/292.html>Easy guide to going
>virtual</a>");
>
> function init() {
> slideShow();
> setInterval("slideShow()",wait);
> }
>
> function slideShow() {
> if (counter >= arr.length) counter = 0;
> arr[counter].drawMe();
> counter += 1;
> }
>
>To display:
>
> <div id="myDiv" style="position:absolute; left:420px; top:118px;"></div>
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Your ad could be here. Monies from ads go to support these lists and provide more
resources for the community.
http://www.fusionauthority.com/ads.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4