javascript - How to invoke a function in iframe using JS? -
how invoke function in iframe using js or how target iframe? i've tried using document.getelementbyid("myiframe"), didn't seem work. below basic form of html:
<html> <head> <script> function runfunction() { var win = document.getelementbyid("myiframe"); } </script> </head> <body onload="runfunction()"> <iframe id="myiframe" name="myiframe" src="http://www.myothersite.com/"></iframe> </body> </html> my other site has function named getevents() somehow invoke. appreciated.
you should able access iframe , invoke function using following:
// reference window in iframe id or name 'myiframe' var win = window.frames['myiframe']; // invoke function in win win.getevents();
Comments
Post a Comment