0
votes

When I try to validate this code on W3c Validator it is giving me an error of

Line 55, Column 38: Bad value for attribute action on element form: Must be non-empty.

Syntax of IRI reference: Any URL. For example: /hello, #canvas, or http://example.org/. Characters should be represented in NFC and spaces should be escaped as %20.

I have tried looking over it and trying to fix other things, but I can't find anything wrong with it. Here is all my code for it. If you see anything wrong, please let me know to fix this error! Thanks!

<!DOCTYPE html>
<html>
<head>
<title>JackHammer</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript">
    /* <![CDATA[ */
    /* ]]> */

    var jackhammers = new Array(11);
    var curJackhammer = 0;
    var direction;
    var begin;
    jackhammers[0] = "jackhammer0.gif";
    jackhammers[1] = "jackhammer1.gif";
    jackhammers[2] = "jackhammer2.gif";
    jackhammers[3] = "jackhammer3.gif";
    jackhammers[4] = "jackhammer4.gif";
    jackhammers[5] = "jackhammer5.gif";
    jackhammers[6] = "jackhammer6.gif";
    jackhammers[7] = "jackhammer7.gif";
    jackhammers[8] = "jackhammer8.gif";
    jackhammers[9] = "jackhammer9.gif";
    jackhammers[10] = "jackhammer10.gif";

    function bounce() {
        if (curJackhammer == 10)
            curJackhammer = 0;
        else
            ++curJackhammer;
        document.getElemensByTagName(
            "img")[0].src
            = jackhammers[curJacHammer].src;
        if (curJackhammer == 0)
            direction = "up";
        else if (curJackhammer ==1-)
            direction = "down";
        document.getElemensByTagName(
            "img")[0].src
            = jackhammers[curJacHammer];
    }
    function startBouncing() {
        if (begin)
            clearIntercal(begin);
        begin = setIntercal("bounce()",90);
    }

    </script>
</head>

<body>
    <h1>Jackhammer Man</h1>
    <p><img src="jachammer1.gif" height="113" width="100"
    alt="Image of a man with a jackhammer." /></p>
    <form action="" enctype="text/plain"><p>
    <input type="button"
    value="Start Bouncing"
    onclick="startbouncing();" />
    <input type="button" value="Stop Bouncing"
    onclick="clearInterval(begin);" /></p>
    </form>

</body>
</html>
2

2 Answers

0
votes

It seems like you have empty action parameter here:

<form action="" enctype="text/plain"><p>

As simple as this...

Put there path to a file to which form should be sent or at least #.

0
votes

Remove the form markup entirely. You do not need it, because you are not submitting form data to server or otherwise using anything related to a form element. Your buttons work just fine without any form element (when client-side scripting is enabled, and when it is not, they won’t work anyway).

HTML5 drafts (which is what you are validating against) for some reason disallow an empty value for action. They do allow the omission of an action attribute, defaulting to the address of the document itself, so you could just delete the attribute. But it is better to get rid of the form markup entirely.