![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() ![]() |
Hey,
I am currently trying to get a iframe to move location when a Search button is clicked on. Here's some code to help me explain: <html>
<head>
<script langugae="javascript">
function search() {
window.frames["cuslist"].location = "cuslist.php?action=search&sstring=" + document.forms["Search"].searchb.value;
}
</script>
</head>
Bla, bla, bla.....searchb is the textbox that the user types in their search string. Anyways, this function doesn't work, when the button is clicked. Here's the code for the button. <input type="submit" value="Search" onclick="search()"> Does anything look out of place to you guys? I am not very good at javascript, since i havn't used it alot in the last three years. I have tryed reading a bit on the net, however i don't really have the time to really sit down and read. Thanks for your help in advance.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Why have you got a string in the location? I'm not sure exactly how that one works (I've never used it), but doesn't it just take a number?
So, what exactly are you trying to do? |
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
the only way i could think of doing it is having a second frame in the location where you want it to move to then using window.open command in javascript to open it up. And also hide the other frame.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity." - Albert Einstein |
|
|
|
|
|
#4 | |
|
Programming Guru
![]() ![]() |
I am pretty sure that you can change the location of an iframe , and i think i have done it before....i just can't remember how. ;-)
Quote:
I'll post back today when i find the answer.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
|
#5 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Oh, I see... it's like a goto thingy. Fair enough.
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() ![]() |
Yeah, then in the page that gets called, i have a switch running which code i want.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#7 |
|
Programming Guru
![]() |
i would use a server side scripting and just chuck something in teh url you are sending
if (req.getParameter("a").equals("1)){
show frame here
}else{
show frame there
}
URL: http://location.com?a=1 and http://location.com?a=12thats java btw ![]() would give you 2 different pages, i could show you the code to do it in php or asp .net as well and the rest of them could show you in the other languages they no.
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity." - Albert Einstein |
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() |
What i am trying to do, is when the user enters somthing into the search box and clicks the "Search" button a frame on the page will change location and display the search results. For the search code (it's in php) to work, i need to have a url somthing like this: cuslist.php?action=search&sstring=K. cuslist.php is a php file that handles all of the customer search functions as well as displaying any infomation about the customer. So when the cuslit.php file is called i have a switch that looks at the action part of the query string, and executes some code according to what the action part of the string is. The second part of of the query string is the actual search string that get's checked against the db. Anyways, the only problem that i have with this stuff is the java redirect side of it. I don't think that i can do server side scripting because the user must type somthing in before we can redirect it , otherwise i would use php to do it. I am testing in firefox. I have found scripts on websites that do what i want to do, but when i implement them into my page they don't work, do you guys think it could be firefox causing the problem?
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#9 |
|
Programming Guru
![]() |
if i am correct in thinking you want to load a page that says searching then that page redirects to a final page?
well with javascript you can use, *
<script language=\"JavaScript\">
<!--hide
function newwindow(type)
{
if (type == \"pic\" && document.addnew.picture.value != 0){
*window.open('Preview?typ=pic&img=' + document.addnew.picture.value,'jav','width=600,height=600,resizable=yes');
}else if(type == \"dia\" && document.addnew.diagram.value != 0){
*window.open('Preview?typ=dia&img=' + document.addnew.diagram.value,'jav','width=600,height=600,resizable=yes');
}else if(type == \"vid\" && document.addnew.video.value != 0){
*window.open('Preview?typ=vid&img=' + document.addnew.video.value,'jav','width=600,height=600,resizable=yes');
}
}
//-->
</SCRIPT>
------------------------------------------------------------------------
<a href=\"javascript:newwindow('pic')\">Preview</a><--- to call the javascriptor use a dynamic redirect in PHP, just check the request string from teh url and if it is say for instace you find action=search then use the php redirect? http://www.mozilla.org/docs/dom/domr...dow_ref76.html <--- window.open documentation. this is about the 20th edit of this post but... can i see the code you are trying to impliment?
__________________
"Put your hand on a hot stove for a minute, and it seems like an hour. Sit with a pretty girl for an hour, and it seems like a minute. THAT'S relativity." - Albert Einstein |
|
|
|
|
|
#10 | |
|
Programming Guru
![]() ![]() ![]() |
Quote:
__________________
http://jasonpowers.net "There are a thousand hacking at the branches of evil to one who is striking at the root." |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|