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