...

View Full Version : If submit button is clicked then do this



_Aerospace_Eng_
01-28-2005, 03:28 PM
okay i have a page that has an iframe in it with a name of frame1, this iframe has a simple email form, this button has an id of "process", i am wondering if there is some kind of javascript that will check to see if the submit button is clicked or the enter key is used in the form, and if it is used, then an action happens on the parent page i've tried something like this

<script type="text/javascript">
function checkclick(){
if(frame1.document.getElementById('process')){
frame1.document.getElementById('process').onclick=scrolling;
}
}
function scrolling(){
parent.window.scrollTo(0,0);
}
</script>
i would then use the body onload to call checkclick()
the script is in the parent window, and for certain reasons i prefer not to change any of the code in the iframe, is this possible?

Kor
01-28-2005, 03:51 PM
.............. I removed the answer, it was a iframe located solution

Willy Duitt
01-28-2005, 03:52 PM
I believe if the submit button has a name or id and a value... when it is clicked the name and value is sent with the form contents while if the enter button is pressed, this information is not... Therefore, check if the submit buttons name/value pair is present upon form submittal...

.....Willy



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum