Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript IFrame未定义车身加载时的值_Javascript_Iframe_Onload_Onload Event - Fatal编程技术网

Javascript IFrame未定义车身加载时的值

Javascript IFrame未定义车身加载时的值,javascript,iframe,onload,onload-event,Javascript,Iframe,Onload,Onload Event,如何使用body onload获得iframe的值,我得到一个未定义的值 我的非工作代码: index.html <body onload ="loadThis()"> <iframe id = "myframe" src = "sample.html"></iframe> </body> 函数“loadThis()”在加载Iframe之前运行。我如何才能让它工作?您应该这样做: <body > <ifra

如何使用body onload获得iframe的值,我得到一个未定义的值

我的非工作代码:

index.html

<body onload ="loadThis()">

      <iframe id = "myframe" src = "sample.html"></iframe>

</body>
函数“loadThis()”在加载Iframe之前运行。我如何才能让它工作?

您应该这样做:

<body >

  <iframe onload ="loadThis()" id = "myframe" src = "sample.html"></iframe>

</body>

我还没想到,很好。
<body >

  <iframe onload ="loadThis()" id = "myframe" src = "sample.html"></iframe>

</body>