Tim,

I think your problem is that Netscape does not support the
getElementById function in javascript.

Take a look at this article regarding a NS equivalent
http://www.oreillynet.com/lpt/a/1509

Mike Connolly

-----Original Message-----
From: Tim Blair [mailto:[EMAIL PROTECTED] 
Sent: 10 November 2003 18:33
To: [EMAIL PROTECTED]
Subject: [ cf-dev ] OT: JS "auto click"



I'm playing around with a bit of javascript here and have nearly made it
but am stuck on the last hurdle.  I want to automatically "fire" the
onclick event for a certain element when the page first loads.  I've got
this function:

function autoClick(objectId) {
    if (document.all){
        document.all(objectId).click();
    } else if (!document.all && document.getElementById) {
        document.getElementById(objectId).click();
    }
}

And the following at the bottom of the CF page (yes, it's probably
better in the page onload=""):

<!--- auto-click of first image --->
<script language="JavaScript">
    autoClick('smlpic1');
</script>

It works fine for IE but not for Nutscrape etc - I get the error
"document.getElementById(objectId).click is not a function".

Any suggestions?

Cheers,

Tim.

-------------------------------------------------------
RAWNET LTD - Internet, New Media and ebusiness Gurus.
Visit our new website at http://www.rawnet.com for
more information about our company, or call us free
anytime on 0800 294 24 24.
-------------------------------------------------------
Tim Blair
Web Application Engineer, Rawnet Limited
Direct Phone : +44 (0) 1344 393 441
Switchboard : +44 (0) 1344 393 040
-------------------------------------------------------
This message may contain information which is legally privileged and/or
confidential.  If you are not the intended recipient, you are hereby
notified that any unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such notification
notwithstanding, any comments, opinions, information or conclusions
expressed in this message are those of the originator, not of rawnet
limited, unless otherwise explicitly and independently indicated by an
authorised representative of rawnet limited.
-------------------------------------------------------



-- 
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED] For
human help, e-mail: [EMAIL PROTECTED]


--
** Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
For human help, e-mail: [EMAIL PROTECTED]

Reply via email to