View Full Version : Has no properties

Mr J
02-08-2004, 04:48 PM
When I use the following in Mozilla I get the error

document.getElementById(rad_name) has no properties

Can someone please explain this and how to rectify it

<script language="JavaScript">

function rad_click(rad_name){
document.getElementById(rad_name).src = rad_on
// -->

<img onclick="rad_click(this.name)" src="radio_off.gif" name="mypic">

02-08-2004, 05:39 PM
Because the image had no id attribute matching the rad_name argument. Set an id on the image as well, or use document.images[rad_name] instead.

02-08-2004, 05:41 PM
or to u could just send this to the function


should assign the picture to the send element

Mr J
02-08-2004, 07:00 PM
Thank you.

It's amazing, so simple yet so important


EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum