1.html
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title></head><frameset cols="50%,50%"> <frame src="red.html" name="redFrame"> <frame src="blue.html" name="blueFrame"></frameset><script> alert(top.frames["redFrame"].color)</script></html>
red.html
<!DOCTYPE html><html><head><title>redFrame</title><style> body{ background-color: red; }</style></head><body> <script> window.color = "red"; </script></body></html>
blue.html
<!DOCTYPE html><html><head><title>blueFrame</title><style> body{ background-color: blue; }</style></head><body></body></html>
我打开1.html并没有弹出弹框 然后看了控制台,发现我的script没有了 这是为什么? 后来我把script写到head里面 就能弹出red字样的弹框了 这是为啥?
相关分类