Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在两个不同的框架(frame1 和 frame2)中有一个名为“myvar”的 javascript 变量。我需要将frame1中的myvar设置为frame2中myvar的值。如果没有外部脚本,我该如何做到这一点?
如果变量在父级中,请使用:
window.parent.varName
如果它在另一个框架中,请通过父级,然后到框架:
window.parent.frameName.varName