Search form encoding problem

Discussion in 'JavaScript' started by mnsr001, Dec 28, 2007.

  1. #1
    I know nothing about programming and it proved to be be realy hard to learn for me, so I was hoping I could get some help here with this code. I found the code on the intenet and I'd like to use it in my page but I have several problems with it. First, I meanly search in Arabic and when you search google in any languge other than english the search needs to be encoded as UTF (I guess). Still, other websites require the search to be encoded as Arabic "windows-1252". My question is : is there any way that I could use basickly the same code but submit my search with different encoding for each search engine.

    My second problem is that I want to be able to use frames. I want this code to be in the top frame and the search results to display in the button frame. I traied to define the target frame in frontpage but apparently this doesn't work with javascript.

    And finally, in some search engines the search terms appear in the middle of the syntax not as the last part of the syntax as shown in the example code. What do I need to do in order to be able to use such search engines.

    I know this probably to much to ask but any help would be appreciated and please know that I've done my homework before I posted here. I searched the internet for weeks and tried so many script tothing seems to work for me.

    Here is the code:
    <html>
    <body>
    <script language="JavaScript">eng = 'http://www.google.com/search?q=';</script> 
    For: 
    <input type="text" id="searchterms">
    <input type="button" value="Search" onload="" onclick="window.location = eng + escape(document.getElementById('searchterms').value); return false;">
    <br />Search: 
    <input type="radio" onclick="eng = this.value;" checked name="sengines" value="http://www.google.com/search?q=" />Google
    <input type="radio" onclick="eng = this.value;" name="sengines" value="http://www.altavista.com/web/results?q=" />Alta Vista
    <input type="radio" onclick="eng = this.value;" name="sengines" value="http://www.dogpile.com/info.dogpl/search/web/" />Dogpile
    <input type="radio" onclick="eng = this.value;" name="sengines" value="http://search.yahoo.com/search?p=" />Yahoo! 
    </body>
    </html>
    Code (markup):

     
    mnsr001, Dec 28, 2007 IP
  2. MMJ

    MMJ Guest

    Messages:
    460
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use encodeURIComponent instead of escape.
     
    MMJ, Dec 29, 2007 IP