Re: FORM element requires ACTION attribute: problems with compatibility

Jordan Reiter (jreiter@mail.slc.edu)
Mon, 18 Aug 1997 00:44:20 -0400


Date: Mon, 18 Aug 1997 00:44:20 -0400
Message-Id: <l03110707b01d4969ebde@[198.77.183.193]>
In-Reply-To: <3.0.3.32.19970816155417.006efadc@emf.net>
To: "E. Stephen Mack" <estephen@emf.net>, www-html@w3.org
From: Jordan Reiter <jreiter@mail.slc.edu>
Subject: Re: FORM element requires ACTION attribute: problems with    compatibility

At 10:54 PM -0000 8/16/97, E. Stephen Mack wrote:
>This all ties into a related problem, which is that there is no way
>to hide an HTML element with an event attribute from a non-script-enabled
>user agent.  I can use the NOSCRIPT element to present an alternative
>to a script, or I can use a SCRIPT element and manually write the HTML
>element with an action attribute to the document, but there's no way to
>say:
>
><SCRIPTONLY>
>  <INPUT TYPE="BUTTON" VALUE="Foo" ONCLICK="ButtonHandler()">
></SCRIPTONLY>
><NOSCRIPT>
>  <P>Since your browser is not script-enabled, please use the
>  <A href="nobutton.html">alternative document</A>.
></NOSCRIPT>
>
>...unless I manually construct:
>
><SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
>  <!--
>  document.write ('<INPUT TYPE="BUTTON" VALUE="Click Me"
>    ONCLICK="ButtonHandler()">');
>  // -->
></SCRIPT>
><NOSCRIPT>
>  <P>Since your browser is not script-enabled, please use the
>  <A href="nobutton.html">alternative document</A>.
></NOSCRIPT>
>
>But having to constuct elements with event handlers manually
>undermines the point of the event attributes in the first
>place.  In general, it's hard for a Web author to construct
>a scripting-enhanced document that uses event attributes but
>still degrades gracefully.
>
>I'm open to suggestions.

Actually, you could just use this:
<SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript">
  <!--
    document.write ('<INPUT TYPE="BUTTON" VALUE="Click Me"
onClick="ButtonHandler()">');
  //-->
<P>Since your browser is not script-enabled, please use the <A
HREF="nobutton.html">alternative document</A>.
</SCRIPT>

since Script-savvy browsers should ignore anything inside the script tags,
while script-ignorant browsers won't.  But it's still not the perfect
solution.  Of course, the <SCRIPTONLY> tag is impossible, since most
browsers that can't do scripts are too old to recognize <SCRIPTONLY> as a
tag they should ignore.

--------------------------------------------------------
[                    Jordan Reiter                     ]
[            mailto:jreiter@mail.slc.edu               ]
[ "You can't just say, 'I don't want to get involved.' ]
[  The universe got you involved."  --Hal Lipset, P.I. ]
--------------------------------------------------------