Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 25th, 2004, 03:25 PM
Registered User
 
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Dynamic content in Netscape not working. Help!

I have a script that generates a headline dynamically. It's working in IE but not NN. Here's the code in question:

var clients = ['','client1','client2','client3','client4','client 5','client6'];

var hdrs = new Array(6);
    hdrs[0] = []
    hdrs[1] = ['','Headline 1','Headline 2','','','',''];//client1
    hdrs[2] = ['','','','','','',''];//client2
    hdrs[3] = ['','','','','','',''];;//client3
    hdrs[4] = ['','','','','','',''];//client4
    hdrs[5] = ['','','','','','',''];//client5
    hdrs[6] = ['','','','','','',''];//client6

function writeHdr(hdr) {
var thisClient = client;
    if (nn) {
        var lyr = document.header.document
        lyr.open()
        lyr.write('<span class="headText">'+hdrs[thisClient][hdr]+'<\/span>')
        lyr.close()
    }
    else if (ie) document.all['header'].innerHTML = hdrs[thisClient][hdr];
}

function init() {
var thisClient = client;
var thisLink = 'link0'+link;
var thisImage = img;
var thisHdr = hdr;
    document.lgHead.src = 'images/head_s_'+clients[thisClient]+'.gif';
    document.lgImage.src = 'images/port_bofa_lg'+thisImage+'.jpg';
    eval('writeHdr('+thisHdr+')');

}

It appears in the HTML like this:
<div id="header" class="headText"></div>
 
Old August 25th, 2004, 03:53 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
Default

Instead of using document.all, use a cross-browser approach like document.getElementById().

HTH,

Snib

<><
 
Old August 25th, 2004, 04:54 PM
Registered User
 
Join Date: Aug 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That worked! You're my hero.







Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic menus and content? gabster XSLT 6 October 16th, 2007 10:05 AM
Dynamic List Content cyberddindia Classic ASP Basics 3 October 24th, 2006 10:29 AM
How to dynamic display the content of the table? myhrvod Pro Java 0 August 3rd, 2006 12:42 AM
Dynamic table values not returned in Netscape jminteer Classic ASP Professional 1 December 16th, 2005 03:43 PM
Span tags not working Netscape apd8x Javascript 4 January 27th, 2005 06:11 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.