473,748 Members | 4,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.getEl ementById("test check").value = 'Call from Calcagni
Sign') {

document.callsi gn.src = Image2.src;
}

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

thanks in advance

Jul 23 '05 #1
2 2097
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.getEl ementById("test check").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.getEl ementById('test check').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
10208
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 loading has completed in Internet Explorer. The function where I assign the onload event handler looks like this: var newImage = new Image(); function getImage(url) { var image = document.getElementById("theImg");
7
8668
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 correct image has been chosen, before uploading it to the server. http://www.your-community.co.uk/TestImageArray.asp is an extract of the basic functions which work in IE but not in NN (the alerts are just tests to see what is going on). It...
4
44087
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 window is to redirect user to the one of available servers. so i need to check which server is available. i have decided to download some 1pixel image from every server and if it was downloaded
4
1658
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 there a way around this? Jon Cosby
2
6480
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 images. When doing e.g. var img = new Image(); img.onload = function (evt) { alert(this); }; img.src = 'whatever.gif';
3
26758
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 in firefox. The onload method I assign is never being called. Any ideas why firefox isn't calling this, or what I can do for a workaround? Below is approxiatemate code of what I'm doing...
4
1808
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 = myImgLoaded and it fails on IE and FF. The reason being it's not returning a proper
1
5920
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 chenge to down arrow when I the row expands to dispaly the child links. and if the collaps to hide child link the arrow should change back to right arroe image. In the below e.g code you will not be able to see the arrow images. Here is the code I have....
0
8830
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9544
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9372
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9324
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9247
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8243
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6074
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.