script action error???

A

andy johnson

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="javascript" TYPE="text/javascript">

function LinkUp()
{
var number = document.DropDown.DDlinks.selectedIndex;
location.href = document.DropDown.DDlinks.options[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><INPUT 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)
 
L

Lasse Reichstein Nielsen

andy johnson said:
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

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.getElementById("DDlinks").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="WhyICreatedAPageThatRequireJavascript.html"
onsubmit="LinkUp();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
 
D

Dr John Stockton

JRS: In article <[email protected]>, seen in
news:comp.lang.javascript said:
"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."

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.
 
J

Jim Ley

On 12 Aug 2003 02:43:34 +0200, Lasse Reichstein Nielsen

Very cool, and thank you!!! I am modifying my web page to include this
comment:

What a completely pointless exercise.
This site does not validate because of tw items, the quick find form,
and the height tag in the table.

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.
"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.",

You can't be 95% compliant, compliance is an all or nothing thing.
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.

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,772
Messages
2,569,593
Members
45,104
Latest member
LesliVqm09
Top