34 users online (0 members and 34 guests)  


Page 1 of 2 1 2 Last
  Results 1 to 15 of 20

Related

  1. Passing PHP variable to Javascript    Forum: PHP Forum
    Replies: 5
  2. convert a perl variable to javascript variable    Forum: Javascript Forum
    Replies: 0
  3. Multiple Submit buttons    Forum: HTML Forum
    Replies: 3
  4. Replies: 5
  5. multiple submit buttons in single form    Forum: HTML Forum
    Replies: 7
  1. #1
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34

    Question javascript// how do i get a varrible to be the same var for multiple buttons

    abcabcabc

    im a trying to create a personal search engin, so that i can search for something realy ramdom i can have a textbox that you right the text you wish to search and there are sevral buttons (e.g google,,yahoo,, lycos but when atempting it a new textbox would apper with the new button made.... how do u have one texbox minupulater by severtal buttons...

    .............thanks..............

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    hi orisma,

    Would you mind explaining again what you need? I don't quite get it.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34
    <script language="javascript">
    var search;

    //a text box

    //textbox "+var search+"

    //button "search google"
    //button "search yahoo"
    //button "search lycos"


    you still probely dont understand bescause i wrote it in shorthand ....soz

  4. #4
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there orisma,

    and a warm welcome to these forums

    I think that I may decoded your posts and come up with the answer

    Check this out for size - it's not in shorthand though
    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">
    <head>
    <title>Search Sites</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    
    <style type="text/css">
    /*<![CDATA[*/
    .bttn {
         width:75px;
         font-family:arial;
         font-size:12px;
     }
    .inpt {
         margin:5px;
     }
    legend {
         padding:010px;
         font-family:arial;
         font-size:18px;
         font-style:oblique;
     }
    fieldset {
         width:170px;
         border:double 6px #000000;
     }
    /*//]]>*/
    </style>
    
    
    
    <script type="text/javascript">
    //<![CDATA[
    var goGoogle="http://www.google.com/search?hl=en&ie=UTF-8&q=";
    var goYahoo="http://search.yahoo.com/search?_adv_prop=web&x=op&ei=UTF-8&prev_vm=p&va=";
    var goLycos="http://search.lycos.com/default.asp?lpv=1&loc=searchhp&tab=web&query=";
    var text=document.forms;
    
    function google() {
       text[0][1].value;
       location.href=goGoogle+text[0][1].value;
     }
    
    function yahoo() {
       text[0][1].value;
       location.href=goYahoo+text[0][1].value;
     }
    
    function lycos() {
        text[0][1].value;
       location.href=goLycos+text[0][1].value;
     }
    //]]>
    </script>
    
    </head>
    <body>
    
    <form action="">
    <fieldset>
    <legend >search</legend>
    
    <div class="inpt"><input type="text"/></div>
    
    <div class="inpt"><input class="bttn" type="button" value="google" onclick="google()"/></div>
    <div class="inpt"><input class="bttn" type="button" value="yahoo" onclick="yahoo()"/></div>
    <div class="inpt"><input class="bttn" type="button" value="lycos" onclick="lycos()"/></div>
    
    </fieldset>
    </form>
    
    </body>
    </html>
    coothead

  5. #5
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34

    doesnt seem to work

    hi ..

    thanks for the post.. but is doesnt want to work when i paste it all i get is this

    <!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"> <head> <title>Search Sites</title> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <style type="text/css"> /*<![CDATA[*/ .bttn { width:75px; font-family:arial; font-size:12px; } .inpt { margin:5px; } legend { padding:010px; font-family:arial; font-size:18px; font-styleblique; } fieldset { width:170px; border:double 6px #000000; } /*//]]>*/ </style> <script type="text/javascript"> //<![CDATA[ var goGoogle="http://www.google.com/search?hl=en&ie=UTF-8&q="; var goYahoo="http://search.yahoo.com/search?_adv_prop=web&x=op&ei=UTF-8&prev_vm=p&va="; var goLycos="http://search.lycos.com/default.asp?lpv=1&loc=searchhp&tab=web&query="; var text=document.forms; function google() { text[0][1].value; location.href=goGoogle+text[0][1].value; } function yahoo() { text[0][1].value; location.href=goYahoo+text[0][1].value; } function lycos() { text[0][1].value; location.href=goLycos+text[0][1].value; } //]]> </script> </head> <body> <form action=""> <fieldset> <legend >search</legend> <div class="inpt"><input type="text"/></div> <div class="inpt"><input class="bttn" type="button" value="google" onclick="google()"/></div> <div class="inpt"><input class="bttn" type="button" value="yahoo" onclick="yahoo()"/></div> <div class="inpt"><input class="bttn" type="button" value="lycos" onclick="lycos()"/></div> </fieldset> </form> </body> </html>


    ...................................

    i cant even work out what part of the script that is let alone how to fix it... it seems to be ramdom parts of it... although its probely somthing silly because thats the way my scripting it


    thanks

  6. #6
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there orisma,

    I would not of posted it if it did not work

    Obviously, what you meant to say was that...
    you do not know how to implement this code

    As you seem adverse to giving details of what you did
    with the code, I will just have to guess again.

    So my guess is that you ' Copied & Pasted ' the code
    and clicked ' Save ' with the result that it was saved as a .text file.
    It must be saved as an .html file

    So in the file name box name the file something like this...
    search.html then click save

    Then click on this file and it will work OK, OK


    coothead

  7. #7
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there orisma,

    If you are still not convinced that it works, then
    check out this link...
    http://hstrial-dbayly.homestead.com/files/google.html

    coothead

  8. #8
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34

    yeh soz

    although it may seem im a novic because of how rubbish i am i have acssuly been doing web languages for while .. yet still am rubish

    ..

    anyway it was my fault is wasnt working but is wasnt anything to do with what u said but thanks for the suggestion. it was that i used i microsfot product (front page) and we all no how great those are dont we... anywhay it was just it didnt work in fronpage... thanks any way... cool

    ...

    how did u do the double line border?????

  9. #9
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34
    me agin

    is there a way to have the search bars and buttons all flat out
    like this


    ==================================

    [search box] [gogle] [yahoo] [lycos]

    ================================

  10. #10
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there orisma,

    here are ' the search bars and buttons all flat out '


    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">
    <head>
    <title>Search Sites</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    
    <style type="text/css">
    /*<![CDATA[*/
    .bttn {
         width:50px;
         font-family:arial;
         font-size:12px;
     }
    #text {
         width:125px;
     }
    #inpt {
         margin:3px 3px 3px 0;
     }
    legend {
         padding:0 10px;
         font-family:arial;
         font-size:18px;
         font-style:oblique;
     }
    fieldset {
         width:300px;
         border:double 6px #000000;
         padding:5px;
     }
    /*//]]>*/
    </style>
    
    
    
    <script type="text/javascript">
    //<![CDATA[
    var goGoogle="http://www.google.com/search?hl=en&ie=UTF-8&q=";
    var goYahoo="http://search.yahoo.com/search?_adv_prop=web&x=op&ei=UTF-8&prev_vm=p&va=";
    var goLycos="http://search.lycos.com/default.asp?lpv=1&loc=searchhp&tab=web&query=";
    var text=document.forms;
    
    function google() {
       text[0][1].value;
       location.href=goGoogle+text[0][1].value;
     }
    
    function yahoo() {
       text[0][1].value;
       location.href=goYahoo+text[0][1].value;
     }
    
    function lycos() {
        text[0][1].value;
       location.href=goLycos+text[0][1].value;
     }
    //]]>
    </script>
    
    </head>
    <body>
    
    <form action="">
    <fieldset>
    <legend >search</legend>
    
    <div id="inpt">
    <input id="text" type="text"/>
    <input class="bttn" type="button" value="google" onclick="google()"/>
    <input class="bttn" type="button" value="yahoo" onclick="yahoo()"/>
    <input class="bttn" type="button" value="lycos" onclick="lycos()"/>
    </div>
    
    </fieldset>
    </form>
    
    </body>
    </html>
    ' how did u do the double line border????? '

    This site should help you with borders...

    http://www.w3schools.com/css/css_border.asp

    coothead

  11. #11
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34

    thanks

    cool everything is working fine now

    thanks for your help

  12. #12
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34
    thanks but how would yo work something thike ebay where the word u enter is in the middlle of the url e.g

    http://search.ebay.co.uk/orisma_W0QQmaxrecordsreturnedZ300QQsalocatedincountryZ3QQsocurrencydisplayZ2QQsokeywordredirectZ1QQsorecordsperpageZ50QQsosortpropertyZ1

    thnks

  13. #13
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there orisma,

    If you carry on like this, the buttons will go from one side of your page to the other

    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">
    <head>
    <title>Search Sites</title>
    <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
    
    <style type="text/css">
    /*<![CDATA[*/
    .bttn {
         width:50px;
         font-family:arial;
         font-size:12px;
     }
    #text {
         width:125px;
     }
    #inpt {
         margin:3px 3px 3px 0;
     }
    legend {
         padding:0 10px;
         font-family:arial;
         font-size:18px;
         font-style:oblique;
     }
    fieldset {
         width:350px;
         border:double 6px #000000;
         padding:5px;
     }
    /*//]]>*/
    </style>
    
    
    
    <script type="text/javascript">
    //<![CDATA[
    var goGoogle="http://www.google.com/search?hl=en&ie=UTF-8&q=";
    var goYahoo="http://search.yahoo.com/search?_adv_prop=web&x=op&ei=UTF-8&prev_vm=p&va=";
    var goLycos="http://search.lycos.com/default.asp?lpv=1&loc=searchhp&tab=web&query=";
    var goEbay="http://search.ebay.co.uk/";
    var text=document.forms;
    
    function google() {
       text[0][1].value;
       location.href=goGoogle+text[0][1].value;
     }
    
    function yahoo() {
       text[0][1].value;
       location.href=goYahoo+text[0][1].value;
     }
    
    function lycos() {
        text[0][1].value;
       location.href=goLycos+text[0][1].value;
     }
    
    function ebay() {
        text[0][1].value;
       location.href=goEbay+text[0][1].value;
     }
    //]]>
    </script>
    
    </head>
    <body>
    
    <form action="">
    <fieldset>
    <legend >search</legend>
    
    <div id="inpt">
    <input id="text" type="text"/>
    <input class="bttn" type="button" value="google" onclick="google()"/>
    <input class="bttn" type="button" value="yahoo" onclick="yahoo()"/>
    <input class="bttn" type="button" value="lycos" onclick="lycos()"/>
    <input class="bttn" type="button" value="ebay" onclick="ebay()"/>
    </div>
    
    </fieldset>
    </form>
    
    </body>
    </html>
    coothead

  14. #14
    orisma's Avatar
    Junior Member

    Status
    Offline
    Join Date
    Jun 2004
    Location
    london, England
    Posts
    34

    Question thtnks for the

    i havent relpyed in so long becase whenever i cheached nothing was added ... turnout that a page 2 existed.... who would have thought...

    p.s.

    am i allowed to put it on site (beacause of copyright etc...)

  15. #15
    coothead's Avatar
    bald headed old fart

    Status
    Offline
    Join Date
    Aug 2003
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    732
    Hi there orisma
    ' am i allowed to put it on site (beacause of copyright etc...) '
    Well, I cannot think of any reason why you should not....
    It's only an extended link to the site. But if you are uncertain
    ask Dave the administrator here, I believe that he may be the
    legal expert.

    coothead



Page 1 of 2 1 2 Last