submit it to iframe?

amberlamps

BANNED
Joined
Jun 24, 2010
Messages
331
Reaction score
145
im basically trying to create a submit button outside of the targeted iframe.

I have this but it is not working properly for me, when i hit submit, the page does waht it wants,

here is a live example of my failure http://bit.ly/i2WgM0

i want when i hit the button "submit the form" to basically act like if i hit enter on that iframe

any help is muchly appericated

Code:
<html>
<head>
<script type="text/javascript">
function submitFormToIFrame(){
    //IE
    if( document.myform ){
        document.myform.setAttribute('target','frame_x');
        document.myform.submit();
    //FF
    } else {
        var form=document.getElementById('myform');
        form.setAttribute('target', 'frame_x');
        form.submit();
    }
}
</script>
</head>

<body>
<h1>Hello Erwin!</h1>

<form id="myform" name="myform" action="" target="">
    <input type="button" value="Submit the Form" onClick="submitFormToIFrame();">
</form>

<span id="iframeSlot">
<iframe name="frame_x">
</iframe>
</span>
</body>
</html>
 
Back
Top