You're welcome, macmec. Of course, my solution breaks if the user has
javascript and/or images disabled.
In your original question, you mentioned that some of your forms have
multiple buttons. I wondered if they also have more than one submit button
that POST to more than one form. Just for grins, and because I need a break
from my current headache, I thought I'd beef up my example to show you one
way to have each image submit to it's own target form. You were already
heading there when you said you might check the image id on the server to
see if it was the submit image. Do the same with my code, using a switch to
examine the ID of the image that triggered the function as follows:
< form method="post" name="myForm" action="">
< img src="myImage1.gif" id="sImg1" onClick="submitForm(event);">
< img src="myImage2.gif" id="sImg2" onClick="submitForm(event);">
< img src="myImage3.gif" id="sImg3" onClick="submitForm(event);">
< /form>
< script>
var submitted=false;
function submitForm(e) {
if (!e) var e = window.event;
var o = getEventSource(e);
if (!submitted) {
submitted=true;
switch (o.id) {
case sImg1:
document.myForm.action="myTargetForm1.asp";
break;
case sImg2:
document.myForm.action="myTargetForm2.asp";
break;
case sImg3:
document.myForm.action="myTargetForm3.asp";
case default:
submitted=false;
}
document.myForm.submit();
}
}
function getEventSource(x) {
if (x.target) var o = x.currentTarget; else if (x.srcElement) var o =
x.srcElement;
if (!o) if (window.event) var o = window.event.srcElement;
return o;
}
< /script>
HTH,
Robert
> -----Original Message-----
> From: macmec [mailto:email@hidden]
> Sent: Thursday, June 24, 2004 6:05 PM
>
>
> Thanks Robert, that's the kind of solution I was thinking of, but
> you've made it easier than I probably could have on my own.
> Dean, I'm dealing with artists, and they like their graphic buttons
> (and we work on Macs, so Safari is king, and doesn't support it anyway).
> And Mauricio, thanks for your suggestions as well. I will probably
> implement that with Robert's solution.
CONFIDENTIALITY NOTICE: This e-mail transmission, and any documents, files,
or other e-mail messages attached to it, may contain confidential
information that is legally privileged. If you are not the intended
recipient, or a person responsible for delivering it to the intended
recipient, you are hereby notified that any disclosure, copying,
distribution or use of any of the information contained in or attached to
this message is STRICTLY PROHIBITED. If you have received this transmission
in error, please immediately notify the sender via e-mail or by telephone at
615.320.0055 and destroy the original transmission and its attachments
without reading them or saving them to disk. Thank you
_______________________________________________
web-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/web-development
Do not post admin requests to the list. They will be ignored.