473,769 Members | 2,140 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

image swapping - js and webserver portibiltiy

Hi -

I have a page that has a button that makes a prompt appear for the user
to type input. When they have typed in input, I want the button to
change
color when the prompt closes. I am trying to do image swapping

This snippet will prevent 'null' from appearing initially and
successfully
records user changes (typing in a comment)

var existing = form.elements[type].value;
if (existing == null) {
existing = "";
}
var comments = prompt("Enter Comment ", existing);
form.elements[type].value = comments;

Now my problem. just below the code above I am trying

alert("document .images[9].src=" + document.images[9].src);
if (comments == null) {
document.images[9].src=document.i mages["images/buttonComments. gif"];
}
else {
document.images[9].src=document.i mages["images/buttonCommentsP resent.gif"];

}

The problem is that the alert shows the address of the image as
http://localhost:9080/mystuff/images/image1.gif

and when I swap it out the new image does not show up - a red X

The images will always be under /images on every server - how can I
make this code portible without having to hardcode the 'http:etc" ?

Thanks

Tom

Jul 20 '05 #1
2 1585
uNConVeNtiOnAL <to****@visi.co m> writes:
document.images[9].src=document.i mages["images/buttonComments. gif"];


This is not right. You probably mean:
document.images[9].src="images/buttonComments. gif";
(and ditto for the next assignment)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2
YOU SIR, ARE A GODSEND!!!!

thanks

Tom

Lasse Reichstein Nielsen wrote:
uNConVeNtiOnAL <to****@visi.co m> writes:
document.images[9].src=document.i mages["images/buttonComments. gif"];


This is not right. You probably mean:
document.images[9].src="images/buttonComments. gif";
(and ditto for the next assignment)

/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
'Faith without judgement merely degrades the spirit divine.'


Jul 20 '05 #3

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

Similar topics

8
5507
by: OysterCracker | last post by:
Hi - I've previously used js to swap images on mouseover in a menu. I'm stumped on a different situation and would appreciate some advice. I would like to swap imageA to ImageB when I mouseover imageC. Also, swap imageA to ImageB when I mouseover a text link. How do I do those? Thanks, ~OC~
23
7727
by: Erik Schulp | last post by:
Hi all, I am using a background image via a stylsheet. I've used this code: background-image:url("/images/tile.gif"); (which I think is correct) The image doesn't show up however, the path, the filename etc etc, everything checks out ok.
2
1125
by: Richard | last post by:
www.somestuff.batcave.net/test1.html I have the major part of this monster worked out. Changing categories is fine. Only thing is, I get nothing when I click on a thumbnail. I know the value is being passed properly because I've used "alert" blocks to tell me that. Until I get something better to use for the swapping, I'm just using the bare basic routine.
6
2267
by: cjl | last post by:
I have a website which allows people to view interesting radiology cases. It is for teaching radiology residents. It is designed to run in fullscreen or 'kiosk' mode, at 1024 x 768 resolution only. http://www.casespace.net I designed it with firefox (plus the autohide extension) in mind, but also want to support IE. Online and offline it works great in Firefox. Offline it also works
7
9109
by: cjl | last post by:
OK: I am really scratching my head over a preload / image swapping problem, so I started conducting experiments: http://www.saintrays.net/experiment1.html http://www.saintrays.net/experiment2.html http://www.saintrays.net/experiment3.html View the source of each page to see the relevant javascript. All three
0
1648
by: kris_scheyer | last post by:
Ok, here's what im trying to do: I have a machine running XP embedded that has a webserver. I have a button on the aspx web form that is supposed to capture the screen of the computer hosting the webserver and display it on the browser. Now I already have the code that captures the screen of the webserver (using user32.dll and gdi32.dll) and when I run the web application on the ASP.NET Development Server using visual web developer 2005...
35
2673
by: Stan Sainte-Rose | last post by:
Hi, What is the better way to save image into a database ? Just save the path into a field or save the image itself ? I have 20 000 images (~ 10/12 Ko per image ) to save. Stan
3
5669
by: seamlyne | last post by:
The first method I ever used for multiple state buttons was to create a graphic for each button for each state: AboutUs_on, AbooutUs_over, AboutUs_out, etc. That works great when there are just a few buttons. I'm creating interfaces now with many more buttons than "just a few". I solved the maintenance problem by having generic button images, one for each state, and having them be background images for text containers, DIVs in this...
2
5957
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it doesn't works on IE. Please, help me out as I am new to this and would be highly thankful if anyone has running code for uploading image files to the server using CGI either Perl or C. This code i took it from net only. #!/usr/bin/perl -w
0
9579
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
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
10208
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
9857
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...
1
7404
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
6662
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();...
0
5444
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3952
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2812
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.