Jump to content

submit it to iframe?


kimmieblob

Recommended Posts

man im pulling my hair out on this

 

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

 

so in my example i have iframe googled, so if i type a search and hit enter it brings the search results, but if i type a search and hit my button "submit the form" it just doesnt act like i hit enter.

 

ive been working on this for the last few hours, and i cant help but think its something so simple, so i had to ask

 

any help is muchly appericated

 

<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>

Link to comment
https://forums.phpfreaks.com/topic/219660-submit-it-to-iframe/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.