SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi -

    Can someone tell me how I can call a Javascript function with a parameter based on the value of the selected drop down list element...

    e.g. the code I have right now:

    <form name="songs">

    <SELECT NAME="audioid" SIZE=1 onChange="location = javascriptpenOne('document.songs.audioid[document.songs.audioid.selectedIndex].value');">

    However this doesn't work. Can you spot the error and let me know?

    Thanks!

  2. #2
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry...this is the code I'm using..

    The javascript error is: "Object Required" (HUH?)

    <form name="songs">

    <SELECT NAME="audioid" SIZE=1 onChange="javascriptpenOne(document.songs.audioid[document.songs.audioid.selectedIndex].value);">
    <OPTION VALUE=100>
    </SELECT>

    </form>

  3. #3
    I believe you have my stapler. scrubz's Avatar
    Join Date
    Feb 2001
    Location
    Van down by the river
    Posts
    254
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I've spotted the error - it's the yawning face in your code. But seriously, remove the 'javascript' from your onChange.

    onChange="openOne(document.songs.audioid[document.songs.audioid.selectedIndex].value);">

    Post the function here if you're still getting an error. The "object required" error could be in the function.

  4. #4
    SitePoint Zealot zeeshan's Avatar
    Join Date
    Mar 2001
    Posts
    123
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Scrubz -

    I figured out the error. It was actually the fact that I didn't declare Javascript as a script in my <head> for the page on top.

    Thanks for the reply!


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
  •