我有這樣的代碼工作的罰款與本地文件:的getElementById( 「」)與網上IFRAME SRC
<html>
<body>
<iframe id="frame1" name="frame1" frameborder=0 src="form.html" width=100% height=70%></iframe>
</body>
<script type='text/javascript'>
window.onload= function(){
var iframe = document.getElementById('frame1');
var innerDoc = iframe.contentDocument || iframe.contentWindow.document;
var input = innerDoc.getElementsByName('input1')[0].value;
alert(input);
}
</script>
</html>
form.html:
<input name="input1" type="text" value="testing"/>
一切OK,但是當我改變IFRAME的src:
<iframe id="frame1" name="frame1" frameborder=0 src="form.html" width=100% height=70%></iframe>
有了:
<iframe id="frame1" name="frame1" frameborder=0 src="http://test.hklearningmap.com/form.html" width=100% height=70%></iframe>
它不工作。我怎樣才能使它的工作沒有上傳本地文件到form.html相同的位置?謝謝。