iframe的多层调用

parent.html

        <iframe id="ReadMachine">iframe>
        
$(function() {
                $("#ReadMachine").attr("src", "ReadMachine.php")
            })

ReadMachine.php

<script type="text/javascript" src="df.js">script>
<script type="text/javascript" src="jquery-3.1.1.min.js">script>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">

$f=["dt","xyj","jh","fs","music","kt","switch"];   //Elements must be arranged in order
for($x=0;$x$f);$x++){
//  open file
$myfile = fopen($f[$x], "r") or die("Unable to open file!");  //read Element state from file
//read file
echo "";//assignment
//control parent page by file data  
echo "";//set Element state of parent page
//close file
fclose($myfile);//close file
}
?>
<script>
console.log("Df")
script>

设置框架上级页面的元素的父级元素的属性

parent.$('body button:eq(".$x.")').parent().prev().css('background','rgba(136, 255, 45, 0.44)');parent.$('body button:eq(".$x.")').html('OFF');

你可能感兴趣的:(JavaScript,html)