Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 20th, 2004, 11:34 AM   #1
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
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!
Pizentios is offline   Reply With Quote
Old Sep 20th, 2004, 3:38 PM   #2
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
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?
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 21st, 2004, 2:52 AM   #3
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 5 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
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
Berto is offline   Reply With Quote
Old Sep 21st, 2004, 8:45 AM   #4
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
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:

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?
Simple. You can use strings in your location, it's not just for numbers. I like strings better because i don't get them mixed up like i would with numbers. For example, if you had 4 vars in a c++ program are you going to name them 1,2,3,4? I doubt it. For me, this is the way things make sense.


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!
Pizentios is offline   Reply With Quote
Old Sep 21st, 2004, 11:29 AM   #5
Ooble
I eat cake for breakfast.
 
Ooble's Avatar
 
Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9 Ooble is on a distinguished road
Oh, I see... it's like a goto thingy. Fair enough.
__________________
Me :: You :: Them
Ooble is offline   Reply With Quote
Old Sep 23rd, 2004, 9:17 AM   #6
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
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!
Pizentios is offline   Reply With Quote
Old Sep 23rd, 2004, 9:40 AM   #7
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 5 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
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=12

thats 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
Berto is offline   Reply With Quote
Old Sep 23rd, 2004, 10:31 AM   #8
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
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!
Pizentios is offline   Reply With Quote
Old Sep 23rd, 2004, 10:43 AM   #9
Berto
Programming Guru
 
Join Date: Aug 2004
Posts: 1,022
Rep Power: 5 Berto is on a distinguished road
Send a message via AIM to Berto Send a message via MSN to Berto
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 javascript
name your iframe you want load it in the all is good, just takes the value from teh txt box

or 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
Berto is offline   Reply With Quote
Old Sep 23rd, 2004, 11:26 AM   #10
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,466
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
Quote:
think it could be firefox causing the problem?
In my experience with web dev, some things that work in IE don't work in Firefox, and vice versa... Try testing with an alternate browser just to rule out a browser conflict.
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:22 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC