473,395 Members | 1,348 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

toggle image with onLoad event

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
2 2072
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
lol.. Freaking Javascript101... DUHHHHHHH... Thanks.. That was the
problem... I've been coding vbscript far too long..

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Adam Ratcliffe | last post by:
I'm trying to come up with a solution for detecting when an image, loaded by a script, has completely loaded. The Image.onload event is fired after the image has loaded in Firefox but before...
7
by: Roger Withnell | last post by:
I would like to check that an image file, selected by a user using fileUpload, is within certain parameters (width, height, filesize) and to display the image file so that the user can see the...
4
by: zborisau | last post by:
Hey good people, I've been given a problem to solve recently - and stuck with the solution for a good 4 days already. i have a link which leads to popup window. the purpose of that popup...
4
by: Jon | last post by:
I'm looking for a way to toggle text without using client scripting. One way to go is by the visibility property and a click event, but this does a postback and returns to the top of the page. Is...
2
by: Martin Honnen | last post by:
I was playing around with canvas support in recent Safari, Mozilla and Opera (only version 9 preview) but run into issues with Safari related to the very old DOM Level 0 Image object for preloading...
3
by: jon | last post by:
Hello, I've had long standing code that runs in IE, that I'm testing with firefox unsuccessfully now. The problem seems to be that images that I dynamically create don't fire their onload event...
4
by: Mark S. | last post by:
Hello, On a high volume page we have the following JavaScript: img = new Image() img.src = 'http://myserver.com/count.aspx?x=1'; and it works fine, but now we've added: img.onload =...
1
by: Amit1980 | last post by:
I have to toggle the arrow image on onclick event. Here is the code with the required functionility. What I want now is, when the page loads there will be right arrow images. The arrow should be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.