Need help with a code please

Discussion in 'HTML & Website Design' started by old1, Mar 6, 2005.

  1. #1
    Hello

    First of must say im newbie + not fluent english + not much webmaster knowledge :)
    im tryin to do something i dont know even how it call but i paste my doce below for you to got it

    <td><form>
    <select multiple size="5">
    <option>menu name here </option>
    <option value="<a href=site a addy here >site a</option>
    <option value="<a href=site b addy here >site b</option>
    <option value="<a href=site c addy here >site c</option>
    <option value="<a href=site d addy here >site d</option>
    <option value="<a href=site e addy here >site e</option>
    <option value="<a href=site f addy here >site f</option>
    </select></form></td>

    in firefox browser iy does what i want i mean when someone 1 click on site a it take the visitor that site
    but in ie ( i hate it but most visitor still uses :mad: ) when i move my curser on site a the arrow goes and the one comes like this ( I ) and when click on site a nothing happens.

    i read about pplz make this with jawa or css but i dont want em so is there a way to do this please.
    thx for read

    regards
     
    old1, Mar 6, 2005 IP
  2. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Depending on what you want, try:
    <script language="JavaScript" type="text/javascript">
    <!--
    function go1(){
    if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
    location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value
    		}
    	}
    //-->
    </script>
    <script language="JavaScript" type="text/javascript">
    <!--
    document.write('<form name="selecter1"><select name="select1" size=1>');
    document.write('<option value=none>Select your destination');
    document.write('<option value=none>--------------------');
    document.write('<option value="http://www.example.com">Example');
    document.write('</select>');
    document.write('<input type="button" value="Go" onclick="go1()">');
    document.write('</form>');
    // end hiding contents -->
    </script>
    Code (markup):
    or
    <script language="JavaScript" type="text/javascript">
    <!--
    function go1(){
    if (document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value != "none") {
    location = document.selecter1.select1.options[document.selecter1.select1.selectedIndex].value
    		}
    	}
    //-->
    </script>
    <script language="JavaScript" type="text/javascript">
    <!--
    document.write('<form name="selecter1"><select name="select1" size=1 onchange="go1()">');
    document.write('<option value=none>Select your destination');
    document.write('<option value=none>--------------------');
    document.write('<option value="http://www.example.com">Example');
    document.write('</select>');
    document.write('</form>');
    // end hiding contents -->
    </script>
    Code (markup):
     
    Corey Bryant, Mar 6, 2005 IP
  3. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    hey thx for answer but as i said i would prefer another way then jawa script if possible even i will try to integrate that code in php :confused:
     
    old1, Mar 7, 2005 IP
  4. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Corey Bryant, Mar 7, 2005 IP
  5. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    hello ty for trying help me

    my english not well so i having problems about tellin what im thinkin :(
    i dont want a drop down menu but i want a drop down thing and something like text area ok ill try to explain better

    for example when you sign up a site in where are you from ( counrty option ) you see all contries in the world ( with a scroll bar coz its too long )
    the first thing i wanna try a drop down thing like that which i can setup after 5 lines it shows a scrollbar )

    the second thing i want to try is a text area which there are links in it with scroll bar it can be a go button near it when i click on a site it take me there .

    if you can try the code which i gave at my first post may be you can understand me better

    thanks again
    regards
     
    old1, Mar 7, 2005 IP
  6. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Do you have a website as an example?
     
    Corey Bryant, Mar 7, 2005 IP
  7. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    yes i have a website but i cant show how it looks coz didnt upload it but i setup 2 screenshots at http://www.geocities.com/xfiles0066 for you to see what i mean

    small screenshot is about what ia want looks like a test box and when i hit on site 1 it will take me there

    big screenshot is about drop down but i want it with scrollbar for example show after 5 lines( coz i can have 150 site may be and would look terrible to show all lines without scrollbar .it can be a go button near it or can automaticly go to site i click on it .



    hope this help :(
    regards
     
    old1, Mar 7, 2005 IP
  8. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #8
    That is just a regular drop down field. It is an input field so, you can put 150 options in it and then the browser will show the scrollbar. Something like this contact form where all the countries are listed?
     
    Corey Bryant, Mar 7, 2005 IP
  9. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #9
    ya its answer of my second question and i need a code for it which not a jawa script can you help me about it ? or even for my first question ( first screenshot)

    thanks again
     
    old1, Mar 7, 2005 IP
  10. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Well from what I can tell - you are trying to do basic HTML? Something like the Simple drop down box, right?
     
    Corey Bryant, Mar 7, 2005 IP
  11. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    i found that addy from a google search also and tryed but didnt wanna type all my 150 links in it coz couldnt see a scrollar bar i wanna setup the scroller bar like after 5- 10 sites

    oh btw did you tryed to see my code which i type at my first post of this thread at a page for se how it looks like ?

    i sorry again im not good at coding :(
     
    old1, Mar 7, 2005 IP
  12. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #12
    I think he's trying to make a combo box into a menu-like collection of links (there's href in the initial example).

    old1, according to the HTML spec, you can't put <a> inside an attribute, you can't put it inside <option> and you can't put it inside <select>. In other words, all these examples show invalid HTML:

    <select>
    <option><a href="...">link 1</a></option>
    <option><a href="...">link 2</a></option>
    </select>


    <select>
    <a href="..."><option>link 1</option></a>
    <a href="..."><option>link 2</option></a>
    </select>


    <select>
    <option value="<a href=...>link 1</a>">link1</option>
    <option value="<a href=...>link 1</a>">link2</option>
    </select>


    If you want a combo box to behave this way, you need to use JS, as Corey showed you.

    J.D.
     
    J.D., Mar 7, 2005 IP
  13. Corey Bryant

    Corey Bryant Texan at Heart

    Messages:
    1,126
    Likes Received:
    51
    Best Answers:
    0
    Trophy Points:
    0
    #13
    Yes I tried it - but I am not clear on what you want - if it is a simple HTML dropdown, just create it & do not worry about the 150 options. The browser will create the scrollbar for you.
     
    Corey Bryant, Mar 7, 2005 IP
  14. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #14
    ok thx jd and corey

    i was tryin to integrate that code to a php nuke ( not in a html site) but thanks again for try to help me :)

    peace
     
    old1, Mar 7, 2005 IP
  15. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #15
    old man is back :)

    i reopen my old folders now this time ill try to be more clear about what i need

    what i want is called is a combo box like the one seen at this addy
    http://www.geocities.com/xfiles0066/

    i have this code and tons more
    <input type=\"button\" Value=\"8 Ball Nightmare\"  ONCLICK=\"window.open('http://games.yahoo.com/games/ante?room=pool_a&prof_id=chat_pf_1','RoomName', 'toolbar=no,top=2,left=2,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=786,height=520')\">
    
    Code (markup):
    all combo box has codes like simular the code below ( thats where i [​IMG])
    <select name=\"menu\" onChange=\"location=document.dropdown.menu.options[document.dropdown.menu.selectedIndex].value;\" value=\"GO\" size=\"$menu3\">
    Code (markup):
    now my problem is i cant integrate my first code to any combo box.
    in my first code when click on link it opens that link in a new window ( sizes there ) without any icon,tab at that browser window
    i dont want to have a GO button i want when my visitor hit on that link in combo box it opens that pop window automaticly
    i want it shows only 5 links out of tons and visitors scrool down or up for chose :(

    i even not sure if this possible but if someone can try to help me appreciate
    coz i really stuck

    Regards
     
    old1, Aug 21, 2005 IP
  16. Macbert

    Macbert Peon

    Messages:
    27
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #16
    This should work, if I understood correctly what you're trying to accomplish.

    
    <script type="text/javascript">
      function popup(url) {
        menu = document.forms[0].menu;
        url = menu.options[menu.selectedIndex].value;
        if (url) 
          window.open(url, '', 'toolbar=no,top=2,left=2,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,width=786,height=520');
      }
    </script>
    <form>
      <select name="menu" onChange="popup()" size="5">
        <option value="http://someurl.com">Some URL</option>
        <option value="http://example.com">Example</option>
        <option value="http://acme.com">Acme</option>
        <option value="http://acme.com">Acme 1</option>
        <option value="http://acme.com">Acme 2</option>
        <option value="http://acme.com">Acme 3</option>
        <option value="http://acme.com">Acme 4</option>
        <option value="http://acme.com">Acme 5</option>
      </select>
    </form>
    Code (markup):
    You can of course generate the option tags in PHP by looping through your values and printing out the option tag where the value and label strings are replaced with suitable PHP variables.
     
    Macbert, Aug 22, 2005 IP
  17. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #17
    hello ty for answer

    i tryed this and no works again :( .

    <form>
        <select name=\"menu\" onChange=\"popup()\" size=\"5\">
        <option value=\"http://games.yahoo.com/games/ante?room=pool_a&prof_id=chat_pf_1'\">Some URL</option>
        <option value=\"http://games.yahoo.com/games/ante?room=pool_a&prof_id=chat_pf_1\">Example</option>
        <option value=\"http://acme.com\">Acme</option>
        <option value=\"http://acme.com\">Acme 1</option>
        <option value=\"http://acme.com\">Acme 2</option>
        <option value=\"http://acme.com\">Acme 3</option>
        <option value=\"http://acme.com\">Acme 4</option>
        <option value=\"http://acme.com\">Acme 5</option>
      </select>
    </form>
    Code (markup):

    i was thinkin to make it work without jawa but i see you make it a jawa so i feel i can show you the jawa i didnt used.
    this is the orijinal jawa they used ( old one but still works )

    <SCRIPT language=javascript>
    <!--
    function initialize() {
    this.name = "yahoo_games_home";
    }
    
    function lobbyopen(name) {
    var res = document.resolution.res;
    var small;
    
    if (res.value == "small") {
       dms = "height=425,width=620,";
       small = "&small=yes";
    } else {
       dms = "height=520,width=786,";
       small = "";
    }
    
    window.open("http://games.yahoo.com/games/ante?room="+name+"&prof_id="+"chat_pf_1", name,
    "top=2,left=2,"+dms+",toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizable=1");
    return false;
    
    }
    initialize();
    -->
    </SCRIPT>
    
    Code (markup):
    and this is the code line which uses that jawa script

    <a href="#here" onclick='return lobbyopen("pool_105");'>Achilles Last Stand</a><br>
    Code (markup):
    as you see this is used basic link

    this is an example page which you can see and the source

    http://games.amishdonkey.com/pool/

    this is the link where you can see the latest orijinal code ( if you have a Yahoo id )

    http://games.yahoo.com/games/login2?page=pl


    at this pages you ll see tons of rooms links and what im trying is to collect them in combo box instead lots of pages

    Thanks for the answer
     
    old1, Aug 22, 2005 IP
  18. Macbert

    Macbert Peon

    Messages:
    27
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #18
    There's no way (at least that i know of) of opening the kind of popup window that you're using without using javascript.

    Correct me if I'm wrong, but it seems that basically you just want to get an independently scrollable list of links so that a user doesn't need to scroll the whole page.

    You can do this with an select list and javascript, but that requires you to change all your links to option tags. An easier way in your specific situation would be to enclose the link list in a div and specify the overflow attribute to auto. That way you get the scrollbars and you can keep the links untouched. How cool is that? :cool:

    Here's an example (the links are taken from your source):
    
    <div style="overflow:auto;height:90px;width:400px">
      &nbsp;&nbsp;<a href="#here" onclick='return lobbyopen("pool_105");'>Achilles Last Stand</a><br>
      &nbsp;&nbsp;<a href="#here" onclick='return lobbyopen("pool_19_r");'>Afraid to Lose</a><br>
      &nbsp;&nbsp;<a href="#here" onclick='return lobbyopen("pool_51_d");'>Alien</a><br>
      &nbsp;&nbsp;<a href="#here" onclick='return lobbyopen("pool_51_7");'>Alive</a><br>
      &nbsp;&nbsp;<a href="#here" onclick='return lobbyopen("pool_51_h");'>Alive And Kicking</a><br>
      &nbsp;&nbsp;<a href="#here" onclick='return lobbyopen("pool_51_1");'>All Right Now</a><br>
    </div>
    
    Code (markup):
    Just change the width and height attributes to suite your needs.
     
    Macbert, Aug 22, 2005 IP
  19. old1

    old1 Guest

    Messages:
    23
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #19
    ty for answer but :(

    below link example need that jawa applet to open (the one i paste at last post)
    <a href="#here" onclick='return lobbyopen("pool_105");'>Achilles Last Stand</a><br>
    Code (markup):
    and i tryed your example without jawa and with jawa still no works
    plus at your example i didnt get a combo box :(
     
    old1, Aug 22, 2005 IP
  20. Macbert

    Macbert Peon

    Messages:
    27
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    0
    #20
    I took your source and made the necessary changes to it. Check the HTML file attached (had to zip it because of size limitations).

    In the example file, all the links still work and you get a "combo boxish" functionality. Is this what you are looking for? If not, try to explain what is wrong or missing :)

    By the way, what browser are you using?
     

    Attached Files:

    Macbert, Aug 22, 2005 IP