eddie_ch
06-20-2003, 09:43 AM
I'm currently working on a community forum and I'm having problems with detecting a frame page from an external "popup" window.
The main frame contains 3 frames named: "sidebar", "messagelayout", and "postbox", whereas for the main frame itself, i've named it "msgframe<?= $currentboard ?>" with the following script:
<SCRIPT LANGUAGE="JavaScript">
window.name = 'msgframe<?= $currentboard ?>';
</SCRIPT>
ps. "<?= $currentboard ?>" is the frame's ID number generated from php scripts...
so far there's no problem with detecting the window.name for the users since I've set a detect window.name function button for them to try out and it's all working fine!
now what i'd like to do is from an external window: e.g. a popup window, send javascript commands into an object within the main frame's postbox, and after performing these functions, the popup window would close itself. Using a focus() command as an example, to do that I've set the following in the popup window's page:
within the <head> area:
<head>
<script language="Javascript">
var msgframe = window.open("", "msgframe<?= $currentboard ?>")
</script>
</head>
within the <body> area:
<a href="javascript:void(0)" onclick="
javascript:msgframe.focus();
msgframe.postbox.msgform.msgbody.focus();
window.close();">A button</a>
p.s. msgframe.focus() sets the frame window in focus first, msgframe.postbox.msgform.msgbody is the targeted object within postbox to be focused at, and after these 2 commands, the popup window would close itself.
I just like to know if there's any problems with the script, and if there's any more safer and guaranteering ways to achieve the same effect? because so far it works fine only for half the users and myself, other users can't even run the msgframe.focus(), msgframe.postbox.msgform.msgbody.focus() commands to start off with nor does the popup window close itself... some of them even get error messages saying that the commands cannot be executed... I wonder if that has anything to do with setting the msgframe variable in the <head> area...
my IE version is 6.0.2800.1106IS and it works fine.
one of the users' IE version is 6.0.2600.0000.xpclnt_qfe.021108-2107 and this doesn't work! it prompts error messages when the scripts in the popup window are runned... (and this is a chinese version of internet explorer)
we've compared our Internet Options/Advanced settings and everything's the same!
Would really appreciate if anyone can help :)
The main frame contains 3 frames named: "sidebar", "messagelayout", and "postbox", whereas for the main frame itself, i've named it "msgframe<?= $currentboard ?>" with the following script:
<SCRIPT LANGUAGE="JavaScript">
window.name = 'msgframe<?= $currentboard ?>';
</SCRIPT>
ps. "<?= $currentboard ?>" is the frame's ID number generated from php scripts...
so far there's no problem with detecting the window.name for the users since I've set a detect window.name function button for them to try out and it's all working fine!
now what i'd like to do is from an external window: e.g. a popup window, send javascript commands into an object within the main frame's postbox, and after performing these functions, the popup window would close itself. Using a focus() command as an example, to do that I've set the following in the popup window's page:
within the <head> area:
<head>
<script language="Javascript">
var msgframe = window.open("", "msgframe<?= $currentboard ?>")
</script>
</head>
within the <body> area:
<a href="javascript:void(0)" onclick="
javascript:msgframe.focus();
msgframe.postbox.msgform.msgbody.focus();
window.close();">A button</a>
p.s. msgframe.focus() sets the frame window in focus first, msgframe.postbox.msgform.msgbody is the targeted object within postbox to be focused at, and after these 2 commands, the popup window would close itself.
I just like to know if there's any problems with the script, and if there's any more safer and guaranteering ways to achieve the same effect? because so far it works fine only for half the users and myself, other users can't even run the msgframe.focus(), msgframe.postbox.msgform.msgbody.focus() commands to start off with nor does the popup window close itself... some of them even get error messages saying that the commands cannot be executed... I wonder if that has anything to do with setting the msgframe variable in the <head> area...
my IE version is 6.0.2800.1106IS and it works fine.
one of the users' IE version is 6.0.2600.0000.xpclnt_qfe.021108-2107 and this doesn't work! it prompts error messages when the scripts in the popup window are runned... (and this is a chinese version of internet explorer)
we've compared our Internet Options/Advanced settings and everything's the same!
Would really appreciate if anyone can help :)