kimmieblob Posted November 24, 2010 Share Posted November 24, 2010 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> Quote Link to comment https://forums.phpfreaks.com/topic/219660-submit-it-to-iframe/ Share on other sites More sharing options...
.josh Posted November 25, 2010 Share Posted November 25, 2010 You cannot access/manipulate elements/DOM in the iframe page with javascript unless it is hosted and served on the same domain as the parent page. Quote Link to comment https://forums.phpfreaks.com/topic/219660-submit-it-to-iframe/#findComment-1139540 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.