script action error???

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • andy johnson

    script action error???

    Hi,

    I'm validating an html file with this script and have this error
    message from the validator:

    Line 101, character 22:
    <FORM NAME="DropDown" >
    ^
    Error: required attribute ACTION not specified

    The script in question is:


    <SCRIPT LANGUAGE="javas cript" TYPE="text/javascript">

    function LinkUp()
    {
    var number = document.DropDo wn.DDlinks.sele ctedIndex;
    location.href = document.DropDo wn.DDlinks.opti ons[number].value;
    }
    </SCRIPT>
    <FORM NAME="DropDown" >
    <SELECT NAME="DDlinks" style="FONT-SIZE: 10px;">

    (...all opton values omitted for bandwidth and yawn factor....)

    </SELECT><BR><img src="images/form-spacer.jpg" width="84" height="3"
    alt="form space" border="0"><BR> <center><INPU T TYPE="BUTTON" VALUE="Go
    to page" onClick="LinkUp ()" style="FONT-SIZE: 10px;"></center></FORM>


    Any ideas????? This script does work, but doesn't validate.

    Thanks,

    Andy

    "There would be a lot more civility in this world if people
    didn't take that as an invitation to walk all over you"
    - (Calvin and Hobbes)
  • Lasse Reichstein Nielsen

    #2
    Re: script action error???

    andy johnson <andrew.johnson @chicagonet.net > writes:
    [color=blue]
    > I'm validating an html file with this script and have this error
    > message from the validator:
    >
    > Line 101, character 22:
    > <FORM NAME="DropDown" >
    > ^
    > Error: required attribute ACTION not specified[/color]

    You are using an HTML validator, so if it doesn't validate, the error
    is in the HTML, not in the Javascript.

    The problem here is, just as it says, that your form tag doesn't have
    an action attribute.

    If you don't care about Netscape 4, you can just remove the form tag
    completely (it is not a form if it isn't submitted, so don't put in a
    form tag). You'll have to change the code a bit, to, e.g.,
    function LinkUp() {
    location.href = document.getEle mentById("DDlin ks").value;
    }

    If you do care about NS4, then you need the form element. In that
    case, add an action attribute to send people to a warning page:
    <form name="DropDown" action="WhyICre atedAPageThatRe quireJavascript .html"
    onsubmit="LinkU p();return false;">
    The onsubmit handler will go to the selected page and try to prevent
    the action from being taken, but if Javascript is disabled, people
    will be redirected to a page explaining why the page doesn't work.

    /L
    --
    Lasse Reichstein Nielsen - lrn@hotpop.com
    Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit. html>
    'Faith without judgement merely degrades the spirit divine.'

    Comment

    • Dr John Stockton

      #3
      Re: script action error???

      JRS: In article <fhegjvkof9pg7e f8a97m1o30nf3h7 fuhqu@4ax.com>, seen in
      news:comp.lang. javascript, andy johnson <andrew.johnson @chicagonet.net >
      posted at Mon, 11 Aug 2003 17:54:56 :-[color=blue]
      >
      >"I'd say that if a site is 95% compliant and it uses the other 5% to
      >create a better user experience, then that's just fine."[/color]

      That is at best inadequate unless you can establish that no part of the
      non-compliant 5% can spoil the user experience in some browsers.

      The overall time saved in never looking before crossing a road which has
      a 95% chance of no car coming is generally considered to be outweighed
      by the time lost in consequence of having to attend one's own funeral
      rather sooner than would otherwise be the case.

      --
      © John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
      <URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
      <URL:http://www.merlyn.demo n.co.uk/js-index.htm> JS maths, dates, sources.
      <URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/JS/&c., FAQ topics, links.

      Comment

      • Jim Ley

        #4
        Re: script action error???

        On Mon, 11 Aug 2003 17:54:56 -0700, andy johnson
        <andrew.johnson @chicagonet.net > wrote:
        [color=blue]
        >On 12 Aug 2003 02:43:34 +0200, Lasse Reichstein Nielsen
        ><lrn@hotpop.co m> wrote:
        >
        >Very cool, and thank you!!! I am modifying my web page to include this
        >comment:[/color]

        What a completely pointless exercise.
        [color=blue]
        >This site does not validate because of tw items, the quick find form,
        >and the height tag in the table.[/color]

        Then simply don't claim that it's the HTML specified, if you care
        about validation, have it validate, it's easy enough to create your
        own HTML which meets those requiements.
        [color=blue]
        >"I'd say that if a site is 95% compliant and it uses the other 5% to
        >create a better user experience, then that's just fine.",[/color]

        You can't be 95% compliant, compliance is an all or nothing thing.
        [color=blue]
        >and "We
        >sometimes do not include alt tags for images which aren't important
        >unless they are physically seen. Some people will say "Just include
        >alt=''", but I simply don't agree with including alt tags for the heck
        >of it.[/color]

        Then you simply do not understand validation, or accessibility, in
        fact you're just making yourself look even sillier.

        If you have good reasons not to be valid to a W3 version of HTML (and
        there are) then either use your own DTD, or if that's too complicated
        for you, then simply don't claim any DTD.

        Jim.
        --
        comp.lang.javas cript FAQ - http://jibbering.com/faq/

        Comment

        Working...