On 30 Dec 98, Jack Killpatrick wrote:

> I'm getting a javascript error in IE4 (only platform tested on so far):
> 
>       document.main[...] is not an object
> 
> Any ideas where I'm going wrong? Does it have to do with using numbers as
> img names?

For starters, no, Javascript object names can't start with a numeric 
character .  So your names will cause problems.

Also, I can't tell from the out-of-context code snippet in your post if there 
is in fact an object (form, window, whatever) called "main" in your 
document... if not, then you'll certainly get an error such as the one 
above.

I'd suggest using the tried-and-true technique of using eval to, in effect, 
"create a new image object" each time a user clicks a link:

function turn_on(image_number){

        if (document.images){
        image1on= new Image(); image1on.src = "../images/bullet_black_dot.gif";
        image2on= new Image(); image2on.src = "../images/bullet_black_dot.gif";
        //etc
                document[image_number].src = eval(image_number + "on.src")
        }
}

[...]

<a href="whatever.html" 
onclick="turn_on('image1')"><img name="image1" src="../images/spacer2.gif">one
</a><br>

Etc.

----

Hope this helps.


-----------
Brent Eades, Almonte, Ontario
   E-mail: [EMAIL PROTECTED]
           [EMAIL PROTECTED]
   Web:    http://www.almonte.com/


____________________________________________________________________
--------------------------------------------------------------------
 Join The NEW Web Consultants Association FORUMS and CHAT:
   Register Today at: http://just4u.com/forums/
Web Consultants Web Site : http://just4u.com/webconsultants
   Give the Gift of Life This Year...
     Just4U Stop Smoking Support forum - helping smokers for
      over three years-tell a friend: http://just4u.com/forums/
          To get 500 Banner Ads for FREE
    go to http://www.linkbuddies.com/start.go?id=111261
---------------------------------------------------------------------

Reply via email to