开发者

how to assigning values for child window?

开发者 https://www.devze.com 2023-02-18 17:37 出处:网络
var selwindo开发者_JAVA百科w = window.open(\'child1.html\',\'_blank\',\'resizable=yes,width=\'+(screen.width-500)+\',height=\'+(screen.height-500)+\'\');
var selwindo开发者_JAVA百科w = window.open('child1.html','_blank','resizable=yes,width='+(screen.width-500)+',height='+(screen.height-500)+'');
selwindow.document.selectform.childText.value=document.getElementById('pdetails1').value;

I am using this code to assign a value for textbox in the child window. It works well in Internet Explorer, but it shows an error when run in Firefox. It shows: selwindow.document.selectform is undefined.

Here, childText is the current window textbox id, and pdetails1 is the child window text box id


I'm assuming that selectform is the name/id of something in the page.

IE doesn't actually use JavaScript, it uses jScript. jScript converts all names/ids into global variables, so that code works, but it won't work in anything other than IE.

Try:

selwindow.document.getElementById('selectform').childText.value = ...

if the form doesn't have an id, give it one:

<form id="selectform" />
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号