调用iframe中的按钮点击

index.html

<html>
<head><meta http-equiv="content-type" content="text/html;charset=utf-8">
<script type="text/javascript">
    function callChild(){
            //myFrame.window.say();
            myFrame.window.document.getElementById("button").click();
             //var x= myFrame.window.document.getElementById("myen").innerHTML="kkkkk";//可以用
        }
script>head>
<body>
<input id="button" type="button" value="调用child.html中按钮的点击" onclick="callChild()"/><br><iframe name="myFrame" 
src="child.html" width="800">iframe>
body>
html>

child.html

<html>
<head><meta http-equiv="content-type" content="text/html;charset=utf-8">head>
<script type="text/javascript">
function inenword(){
  var x=document.getElementById("enword").value;
      document.getElementById("myen").innerHTML=x;

}
script>
<h1>查询单词h1>
请输入英文单词:<input type="text" name="enword" id="enword">
<input type="button" id="button" value="查询" onclick="inenword()">
<br>您要查找的英文是:<span id="myen">span>
html>

你可能感兴趣的:(javascript)