HighDots Forums  

form tag: action for javascript function

alt.html.tags alt.html.tags


Discuss form tag: action for javascript function in the alt.html.tags forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Chad Lupkes
 
Posts: n/a

Default form tag: action for javascript function - 09-03-2003 , 08:37 AM






I'm getting an error in the validator from htmlhelp.com that I need a
little help with. It is telling me that the action property of the
following form is missing, and I'm not sure which action I should use.
Any suggestions?

Here is the code:

function jumpTo(URL_List){
var URL = URL_List.options[URL_List.selectedIndex].value;
window.location.href = URL;
}

<table align="center">
<tr>
<td>
<form>
<select name="nav" id="nav" onChange="jumpTo(this);">
<option value="URL" selected>URL Description</option>
<option value="URL2">URL2 Description</option>
</select>
</form>
</td>
</tr>
</table>

Reply With Quote
  #2  
Old   
Jukka K. Korpela
 
Posts: n/a

Default Re: form tag: action for javascript function - 09-03-2003 , 11:17 AM






chadlupkes (AT) yahoo (DOT) com (Chad Lupkes) wrote:

Quote:
I'm getting an error in the validator from htmlhelp.com that I need a
little help with. It is telling me that the action property of the
following form is missing, and I'm not sure which action I should use.
The purpose and meaning of the action attribute is defined in the HTML
specifications.

Quote:
Any suggestions?
Don't use a "navigational dropdown menu" but a list of links, see
http://www.cs.tut.fi/~jkorpela/forms/navmenu.html

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html




Reply With Quote
  #3  
Old   
Toby A Inkster
 
Posts: n/a

Default Re: form tag: action for javascript function - 09-03-2003 , 11:17 AM



Chad Lupkes wrote:

Quote:
I'm getting an error in the validator from htmlhelp.com that I need a
little help with. It is telling me that the action property of the
following form is missing, and I'm not sure which action I should use.
That is really the least of your worries. You should be more concerned
that you are using a pure-JavaScript navigation system -- something that
is inaccessible to about 5%-15% of your potential users, including one
very important one: Googlebot.

The correct way to provide links to other parts of your site is via the
humble <a> element. For example:

<a href="anotherpage.html">Another Page</a>

This will work fine in non-JS browsers and search engines.

If you really want a drop-down menu, then use server side redirection:

<form action="redir.php" method="get">
<select name="x">
<option value="http://www.yahoo.com/">Yahoo</a>
</select>
</form>

Where redir.php is a server-side script on your server that checks the
value of x and redirects the user there. This technique can be combined
with your current method to provide a speedier JavaScript-based
redirection for those whose browsers support it, but provide a fallback
through redir.php for everyone else.

As I said, this still won't let search engines spider your site properly,
so your best bet is to use proper <a> elements.

--
Toby A Inkster BSc (Hons) ARCS | mailto:tobyink (AT) goddamn (DOT) co.uk | pgp:0x6A2A7D39
aim:inka80 | icq:6622880 | yahoo:tobyink | jabber:tai (AT) jabber (DOT) linux.it
http://www.goddamn.co.uk/tobyink/ | "You've got spam!"
playing://(nothing)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.