Hi all,
I has 'content' frame which display 'listing.php', within this page, it was included 'search.php'.
Inside 'search.php', it has javascript to change to src of 'content' frame after user press search button.
My problem is the javascript in 'search.php' was not change my 'content' frame src.
It's just reload 'listing.php'. How to change frame src?
Thanks in advance for all replies.
[SOLVED] How to change frame src?
Moderator: General Moderators
[SOLVED] How to change frame src?
Last edited by dEaMOn on Thu Nov 20, 2008 2:53 am, edited 1 time in total.
- aceconcepts
- DevNet Resident
- Posts: 1424
- Joined: Mon Feb 06, 2006 11:26 am
- Location: London
Re: How to change frame src?
Maybe you should post come code?
Use the code tags if you do post your code.
Use the code tags if you do post your code.
Re: How to change frame src?
Here is my code.
frameset
listing.php
search.php
frameset
Code: Select all
<frameset id="top" rows="86,*,33" framespacing="0" frameborder="no">
<frame name="banner" src="Topmenu.php" scrolling="no">
<frameset id="master" cols="5,200,*,5" frameborder="no" framespacing="0">
<frame name="left_menu" src="leftmenu.php" style="border-right:3px solid #99CCE5" scrolling="no">
<frame name="content" src="listing.php" style="border-bottom:3px solid #99CCE5" scrolling="auto">
</frameset>
<frame name="footer" src="footer.php" scrolling="no">
</frameset>
Code: Select all
<table>
...data...
<?php include_once('search.php'); ?>
</table>
Code: Select all
<script language='javascript'>
function z_IsEnter(e) {
characterCode = e.keyCode
if (characterCode == 13) { //if generated character code is equal to ascii 13 (if enter key)
parent.document.frames['content'].location = 'result.php';
}
}
</script>
<input type="text" name="txtSearch" style="width:140px" onkeypress="z_IsEnter(event);">
Re: How to change frame src?
I can solved my problem now by adding a button and move the code that changed frame source to new function which fire when this button was click.
Then when user press enter in textbox, I just fire the click event of this button and it's work fined.
Here is my code.
Then when user press enter in textbox, I just fire the click event of this button and it's work fined.
Here is my code.
Code: Select all
<script language='javascript'>
function z_IsEnter(e) {
characterCode = e.keyCode
if (characterCode == 13) { //if generated character code is equal to ascii 13 (if enter key)
document.getElementById('btnGo').click();
}
}
function z_Go(); {
self.location = 'result.php'
}
</script>
<input type="text" name="txtSearch" onkeypress="z_IsEnter(event);">
<input type="button" name="btnGo" onclick="z_Go();">