powerpro
10-24-2003, 09:27 PM
Hello,
Ok, here is the scenario...
I have the parent page and in it are 2 frames (but both have pretty much the same functioning so I'll only explain 1).
Ok, now in one of the frames, a user clicks a link (this is what it looks like):
<a href="javascript:pmSend();">Private Message</a>
I don't know why, but the forum is putting a space in my javascript command, it should be javascript, not java script:
The pmSend function is simply:
function pmSend () {
parent.privateMsg("username");
}
I don't know if the above is right because I want the result of privateMsg to be in the parent window, not in the frame window. Please let me know.
Now in the parent window, the privateMsg function is:
function privateMsg(user) {
document.writeln("<scr"+"ipt language='JavaScript' src='javascripts.php?chatmain2&user="+user+"' type='text/javascript'>\n");
document.writeln("<\/scr"+"ipt>\n");
}
Now what SHOULD be happening, is whenever the privateMsg function is called, it should print those 2 lines with that username used, and if it's called with a different username, then it should print those 2 lines with the different username, NEVER overwriting the other. And all these lines should be printed in the parent window, not either of the frames.
But here's what's happening:
The parent window (meaning the whole page now) is redirecting to the frame which triggered the privateMsg function, and overwrote all other content, and just wrote the 2 specified lines.
The whole point of this is to dynamically write those 2 lines, and it has to be dynamic because different usernames are called.
Any help is appreciated, and I thank you ahead of time for any help given.
Thanks.
Ok, here is the scenario...
I have the parent page and in it are 2 frames (but both have pretty much the same functioning so I'll only explain 1).
Ok, now in one of the frames, a user clicks a link (this is what it looks like):
<a href="javascript:pmSend();">Private Message</a>
I don't know why, but the forum is putting a space in my javascript command, it should be javascript, not java script:
The pmSend function is simply:
function pmSend () {
parent.privateMsg("username");
}
I don't know if the above is right because I want the result of privateMsg to be in the parent window, not in the frame window. Please let me know.
Now in the parent window, the privateMsg function is:
function privateMsg(user) {
document.writeln("<scr"+"ipt language='JavaScript' src='javascripts.php?chatmain2&user="+user+"' type='text/javascript'>\n");
document.writeln("<\/scr"+"ipt>\n");
}
Now what SHOULD be happening, is whenever the privateMsg function is called, it should print those 2 lines with that username used, and if it's called with a different username, then it should print those 2 lines with the different username, NEVER overwriting the other. And all these lines should be printed in the parent window, not either of the frames.
But here's what's happening:
The parent window (meaning the whole page now) is redirecting to the frame which triggered the privateMsg function, and overwrote all other content, and just wrote the 2 specified lines.
The whole point of this is to dynamically write those 2 lines, and it has to be dynamic because different usernames are called.
Any help is appreciated, and I thank you ahead of time for any help given.
Thanks.