Taylor_1978
11-01-2006, 03:17 PM
Hi,
I had a page which had iframes in it.
The main page (room.php) had an input text box and when the user would press submit it would send the form information to chatbox.php which was one of the iframes.
When chatbox.php loaded it would clear the input text box in room.php using:
<script type="text/javascript">
function clearField(){
parent.document.forms[1].message.value = "";
parent.document.forms[1].message.focus();
}
</script>
However now I have changed room.php to look like this:
<FRAMESET rows="10%,40%,40%,10%" BORDER=1 FRAMEBORDER=yes FRAMESPACING=0 NORESIZE>
<frame name="menu" src="chat_top.php">
<frameset cols="50%,50%" BORDER=1 FRAMEBORDER=yes FRAMESPACING=0 NORESIZE>
<frame name="tourney" src="tourneyonline.php">
<frame name="tourney2" src="tourney.php">
</frameset>
<frameset cols="75%,25%" BORDER=1 FRAMEBORDER=yes FRAMESPACING=0 NORESIZE>
<frame name="chatbox" src="chat_box.php">
<frame name="online" src="online.php">
</frameset>
<frame name="message" src="chat_bottom.php">
</frameset>
In the chat_box.php, because this would no longer work as the input field is now in the frame "chat_bottom.php", I fiddled around with the javascript but each way I tried would not clear the input field.
This is what I tried:
<script type="text/javascript">
function clearField(){
parent.frames[6].document.forms[0].message.value = "";
parent.frames[6].document.forms[0].message.focus();
}
</script>
I changed forms[1] to [0] as this input is now the first form in the specific page (chat_bottom.php) and I added frames[6] as it is no longer the parent document. I also tried frames[5] figuring it would start counting at 0 like it did the form.
Any ideas what I might be doing wrong?
Thanks!
I had a page which had iframes in it.
The main page (room.php) had an input text box and when the user would press submit it would send the form information to chatbox.php which was one of the iframes.
When chatbox.php loaded it would clear the input text box in room.php using:
<script type="text/javascript">
function clearField(){
parent.document.forms[1].message.value = "";
parent.document.forms[1].message.focus();
}
</script>
However now I have changed room.php to look like this:
<FRAMESET rows="10%,40%,40%,10%" BORDER=1 FRAMEBORDER=yes FRAMESPACING=0 NORESIZE>
<frame name="menu" src="chat_top.php">
<frameset cols="50%,50%" BORDER=1 FRAMEBORDER=yes FRAMESPACING=0 NORESIZE>
<frame name="tourney" src="tourneyonline.php">
<frame name="tourney2" src="tourney.php">
</frameset>
<frameset cols="75%,25%" BORDER=1 FRAMEBORDER=yes FRAMESPACING=0 NORESIZE>
<frame name="chatbox" src="chat_box.php">
<frame name="online" src="online.php">
</frameset>
<frame name="message" src="chat_bottom.php">
</frameset>
In the chat_box.php, because this would no longer work as the input field is now in the frame "chat_bottom.php", I fiddled around with the javascript but each way I tried would not clear the input field.
This is what I tried:
<script type="text/javascript">
function clearField(){
parent.frames[6].document.forms[0].message.value = "";
parent.frames[6].document.forms[0].message.focus();
}
</script>
I changed forms[1] to [0] as this input is now the first form in the specific page (chat_bottom.php) and I added frames[6] as it is no longer the parent document. I also tried frames[5] figuring it would start counting at 0 like it did the form.
Any ideas what I might be doing wrong?
Thanks!