Results 1 to 3 of 3

Thread: <iframe> search problem

  1. #1
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question <iframe> search problem

    Hi all,
    I was trying to make a working demo of an iframe that would display a search query that is input from an independent page

    http://testpad.50webs.com

    but on the results page, the searchbox automatically displays a "?" quetionmark before the word and if you keep clicking the "Submit Query" button, it keeps adding "q=%3F" along with the word

    also, if you search two words, like "hello world" it inserts a "?" question mark and "%20" in the searchbox..

    how do I get rid of the "?" marks and other characters appearing in the textbox??

    many thanks..

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Your first page is acceptable, it might be able to be changed to make things less complex on the second page, I'm not sure. The results.htm should look like so:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    		<title>New Document</title>
    		<script type="text/javascript">
    			function init()
    			{
    				document.getElementById("googleFrame").src = "http://google.com/search?q=" + unescape(window.location.search.replace(/^\?/,''));
    				document.getElementById("q").value = unescape(window.location.search.substring(1));
    			}
    
    			window.onload = init;
    		</script>
    	</head>
    	<body>
    		<form action="http://google.com/search" target="googleFrame">
    			Search : <input id="q" name="q"><input type="submit"><br>
    		</form>
    		<iframe name="googleFrame" id="googleFrame" height=500 width=800></iframe><br />
    	</body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Dec 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Brilliant!
    works like a charm..

    thanks a lot!
    Last edited by sgie23; 12-21-2007 at 11:53 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •