0

Hi i am using an iframe in asp.net to navigate to the website. And when the iframe is loaded with website url at that time i want to pass the value to the textbox inside that iframe how can i pass the value inside the iframe to the input class textbox. I have tried so much but i can not accomplish the task.please try to help me here is my code

<script type="text/javascript">
function mf() {
document.getElementById("INPUT").setAtrribute("value", "myvalue");
}
</script>


</head>
//I TRIED TO CALL FUNCTION BY BOTH  BODY ONLOAD AND IFRAME ONLOAD BUT IT DOSN'T WORK
<body onload="mf()">

<form id="form1" runat="server">
//I WANT TO PASS VALUE INSIDE IFRAME TO THIS WEBSITE TEXTBOX
<iframe id="yourid" src="https://www.iauc.co.jp/auction/prelogin01_en.jsp?  timestamp=1361429737811" style="width:600px; height:600px;"> </iframe>



</form>
</body>
Abdullah Syed
  • 47
  • 1
  • 6
  • I think that this will help you http://stackoverflow.com/questions/364952/jquery-javascript-accessing-contents-of-an-iframe – Saligor Feb 21 '13 at 08:16

1 Answers1

0

You can't access the iframe DOM if it's not in the same domain like the parent page. If its the same domain you can use the postMessage method. Read about it here https://developer.mozilla.org/en-US/docs/DOM/window.postMessage

udidu
  • 8,269
  • 6
  • 48
  • 68