I want to have two buttons. One button (which i already have) that sends the target to the iframe and the result is displayed there. However, I want to have another button to submit the form to a full page. target="_blank"
How can I use javascript to determine which button was clicked, and then send the form to the appropriate target? I know i should use my own function, but I don't know how to address the target of the form.
something like this?
Code: Select all
<script type="text/javascript">
function determineTarget(buttonclicked){
if(buttonclicked == 'iframe'){
document.forms[0].target = 'iframename'; //<--------- Need help there?
} elseif(buttonclicked == 'fullpage'){
document.forms[0].target = '_blank'; //<---------- Need help there?
}
}
</script>
<form action="page.php" method="post" target="HELPMEEEE">
<input id="iframe" type="submit" onClick="determineTarget(this);" value="View In IFrame">
<input id="fullpage" type="submit" onClick="determineTarget(this);" value="View Full Page">
</form>