Results 1 to 3 of 3

Thread: this question

  1. #1
    Join Date
    Nov 2007
    Posts
    151
    Thanks
    67
    Thanked 0 Times in 0 Posts

    Default this question

    Hi,
    I've wrote this:
    Html:
    PHP Code:
    <select>
    <
    option value="black" onclick="updatec()">Black</option>
    </
    select
    JS:

    PHP Code:
    function updatec() {
        
    alert(this.getPropertyValue());

    What's wrong in what I've written?
    I want it to open a pop up that says black, like the value of this option.

  2. #2
    Join Date
    May 2008
    Posts
    144
    Thanks
    6
    Thanked 11 Times in 11 Posts

    Default

    try "this.value"

  3. The Following User Says Thank You to thenajsays For This Useful Post:

    d-machine (08-25-2009)

  4. #3
    Join Date
    Jul 2006
    Location
    just north of Boston, MA
    Posts
    1,806
    Thanks
    13
    Thanked 72 Times in 72 Posts

    Default

    Please tell me you aren't going to do that to every option. If so, please review the code below

    HTML Code:
    <select name="color" id="color">
      <option value="">TEXT</option>
      <option value="">TEXT</option>
      <option value="">TEXT</option>
      <option value="">TEXT</option>
    </select>
    Code:
    document.getElementById('color').onchange = function() {alert(this.value)}

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •