WEB Oof. Ignorant java noob here. Need hep

Discussion in 'OT Technology' started by Afanasi, Mar 27, 2009.

  1. Afanasi

    Afanasi Heterosapien

    Joined:
    Mar 4, 2007
    Messages:
    41,028
    Likes Received:
    0
    Location:
    New York Shitty
    doing a form in a wordpress post. everything seems to work "okay", except for the fact that when I hit go to take me to a link, it brings me to a weird page that looks like:

    "www.urlblahblah.com/window.location(document.form3.menu.value)?menu=<a+href%3D"








    here's the code:
    Code:
    <form action="window.location(document.form3.menu.value)" method="get" name="form3">
     
         <select name="menu" size="10" multiple>
     
             <option value="<a href="LINK">Charity One</option>
     
             <option value="2">Charity Two</option>
     
             <option value="3">Charity Three</option>
     
             <option value="4">Charity Four</option><!--more--><code></code>
     
         </select>
     
         <input type="Submit" value="Go" align="MIDDLE"><br>
     
     </form>
    Any ideas?
     
  2. Ender0910

    Ender0910 woot!

    Joined:
    Jun 1, 2004
    Messages:
    3,039
    Likes Received:
    0
    Location:
    Redmond/Bay Area
    Javascript you mean? :p

    Generally this code you have is a mess. I will give you some pointers to get you moving, though.


    The action= attribute that you've used in the form is an html construct, not a javascript one.

    You have two options, you can have action="javascript:window.location(document.form3.menu.value)"

    or add instead onsubmit="window.location(document.form3.menu.value)"


    Also, beware of having double quotes within double quotes (i.e. in your first <option> element). you will need to escape them or use single quotes.
     
  3. Afanasi

    Afanasi Heterosapien

    Joined:
    Mar 4, 2007
    Messages:
    41,028
    Likes Received:
    0
    Location:
    New York Shitty
    How would you have the quotes? Could you write me an example? I only have basic knowledge on the subject and cannot do it on my own very well. :mamoru:
     
  4. kingtoad

    kingtoad OT Supporter

    Joined:
    Sep 2, 2003
    Messages:
    55,924
    Likes Received:
    11
    Location:
    Los Angeles
    Agreed, but I would probably offer the same advice being that this probably wouldn't be able to accomplish what you said.
     
  5. Afanasi

    Afanasi Heterosapien

    Joined:
    Mar 4, 2007
    Messages:
    41,028
    Likes Received:
    0
    Location:
    New York Shitty

    any ideas? this is so far above my head, and this is the only -- and essential -- code that my website needs.
     
  6. Xtreme2k2

    Xtreme2k2 GTI Crew ಠ_ಠ OT Supporter

    Joined:
    Jan 16, 2005
    Messages:
    19,987
    Likes Received:
    0
    Location:
    NJ
    link to page?
     
  7. Afanasi

    Afanasi Heterosapien

    Joined:
    Mar 4, 2007
    Messages:
    41,028
    Likes Received:
    0
    Location:
    New York Shitty
    My friend helped me. I'm going to share the code if anyone else out there needs help doing something similar (his is a drop down menu but hell it's good enough)


    Code:
    <FORM name="urlJump">
    <SELECT name="urlList">
    <OPTION SELECTED value="hxxp://url1.url">URL 1</option>
    <OPTION value="hxxp://url2.url">URL 1</option>
    </SELECT>
    &nbsp;&nbsp;
    <INPUT type="button" name="go" value="Go" onClick="window.location=document.urlJump.urlList.options[document.urlJump.urlList.selectedIndex].value"> </FORM> 
     

Share This Page