window.open一个子窗口后,能否立刻设置子窗口中输入框的值
不能用url传值
<script type="" language="javascript">
function openEditWindow(){
var subWindow = window.open('editCategory.jsp','','width=300,height=150');
subWindow.document.getElementById("testText").value='test';
}
</script>
我这样写,弹出窗口后没反应
但是写成这样:
<script type="" language="javascript">
function openEditWindow(){
var subWindow = window.open('editCategory.jsp','','width=300,height=150');
alert('aaa');
subWindow.document.getElementById("testText").value='test';
}
</script>
就会先弹出子窗口,然后弹出“aaa”,然后子窗口中的输入框就有值了。请问这是为什么?