By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,322 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

toggle image with onLoad event

P: n/a
Im trying to toggle a series of images with an onLoad event. I have my
code checking the value of a hidden textbox. Depending on the value pf
the text box, it will display one image for one and another image for
the rest of them... When the page loads, i get the same image for all
of them.. here is a snippet of my code.. When the page loads for the
first time, there should be no value, so i should get the second image
for all of them..
if (document.getElementById("testcheck").value = 'Call from Calcagni
Sign') {

document.callsign.src = Image2.src;
}

Please let me know if I am doing something wrong..

thanks in advance

Jul 23 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Brian wrote:
Im trying to toggle a series of images with an onLoad event. I have my
code checking the value of a hidden textbox. Depending on the value pf
the text box, it will display one image for one and another image for
the rest of them... When the page loads, i get the same image for all
of them.. here is a snippet of my code.. When the page loads for the
first time, there should be no value, so i should get the second image
for all of them..
if (document.getElementById("testcheck").value = 'Call from Calcagni
Sign') {


If the browser supports getElementById and the element 'testcheck'
exists, you assign the string 'Call ... Calcagni' to the element's
value. Provided the above conditions, this expression will always
return true.

If, on the other hand, you intend to evaluate whether the value of
the 'testcheck' element is the same as the string 'Call ... Calcagni'
you should use evaluation '==', not an assignment '=':

if (document.getElementById('testcheck').value == 'Call...') {

[...]

Hopefully that helps.
--
Rob
Jul 23 '05 #2

P: n/a
lol.. Freaking Javascript101... DUHHHHHHH... Thanks.. That was the
problem... I've been coding vbscript far too long..

Jul 23 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.