SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Sep 2006
    Posts
    1
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    how can i use onchange with xhtml

    is there anyway for me to do this

    <select name="dates" id="dates" onchange="JavaScript:setoption()">
    when i use the validator of http://validator.w3.org

    that will be err as following:
    an attribute value must be a literal unless it contains only name characters.
    onchange=JavaScript:setoption() name=dates>

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    According to the validator's error message, it looks like you've omitted the quotation marks around the attribute value. That's never allowed in XHTML, and it's only allowed under certain circumstances in HTML.

    You should also remove the 'javascript:' part from your attribute value. Event handler attributes don't contain URIs, but script code. If you use event attributes like onchange you must make sure that the web server sends an HTTP Content-Script-Type header (or provide an equivalent in a meta element).
    Birnam wood is come to Dunsinane


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
  •