syntax assistance

Discussion in 'JavaScript' started by motheherder, Feb 20, 2007.

  1. #1
    when accessing the values from a form called users, the following line provides a solution

    form.whatever.value
    Code (markup):
    where 'whatever' is the name of the input.

    How do I include an input name such as 'U.K. Fred' as it seems that the use of spaces and '.'s are not welcomed

    thank you

    mo
     
    motheherder, Feb 20, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    First off, why on earth would you call a field like that? The "name" attribute is not visible to the user, so why this name?

    If you still want to keep it, you can do for example this:

    Give the element a unique ID and use

    
    document.getElementById('your-id').value;
    
    Code (javascript):
    And you can give this a try as well if you just want to leave the name.
    
    document.getElementByName('U.K. Fred').value;
    
    Code (javascript):
     
    nico_swd, Feb 20, 2007 IP
  3. motheherder

    motheherder Peon

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    nico thank you for your response, and a very good question too (lol), I might mail it to the person responsible for the database content. My mission is a little convoluted as i am making an ado connection returning a record count value to which I would like to assign a js function. I have adjusted the results to appear in the id element rather than name and this seems to have solved the problem. thank you very much for your help. mo
     
    motheherder, Feb 20, 2007 IP