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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.