Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > what's the difference, URL in FORM tag and in INPUT tag

Reply
Thread Tools

what's the difference, URL in FORM tag and in INPUT tag

 
 
john woo
Guest
Posts: n/a
 
      06-29-2005
Hi

I'm not good at javascript and wondering the difference, URL in FORM
tag and in INPUT tag.

ex
1.
<FORM name="Form1" id="InputForm" method="post" action="url">
<INPUT TYPE="HIDDEN" NAME="nn" VALUE="">
2.
<form name="Form2">
<table ID="SelectPanelTable"...>
<tr> <TD ID="TD".. onmouseup=function()>
3.
<FORM name = "Form3">
<INPUT TYPE=Hidden NAME="aa"
4.
<FORM name = "Form4" onsubmit=url>
<INPUT TYPE=Hidden NAME="aa"..>
5.
<FORM name = "Form5" onsubmit=url>
<INPUT TYPE=button NAME="aa"..>

questions from above cases:
1. when need to use "action"
2. different in 4 and 1?
3. if no button, how to triger submit?
4. the where/how to specify URL, in <form> tag or in its sub-tag?
5. when use onclick, onsubmit,onmouse to direct next page?

--
Thanks lots
John
Toronto

 
Reply With Quote
 
 
 
 
David Dorward
Guest
Posts: n/a
 
      06-29-2005
john woo wrote:

> 1.
> <FORM name="Form1" id="InputForm" method="post" action="url">
> 4.
> <FORM name = "Form4" onsubmit=url>


> 1. when need to use "action"


Every time you use a form. Its a required attribute.

> 2. different in 4 and 1?


1 is sane.

4 attempts to treat a URL as some unspecified client side scripting (most
browsers will treat it as JavaScript, but you should specify this
explicitly http://www.w3.org/TR/html4/interact/....html#h-18.2.2 (of
course URLs aren't JavaScript so this will just break))

> 3. if no button, how to triger submit?


http://ppewww.ph.gla.ac.uk/~flavell/...mquestion.html
(But its always a good idea to have a submit button)

> 4. the where/how to specify URL, in <form> tag or in its sub-tag?


The action attribute of the <form>.

> 5. when use onclick, onmouse to direct next page?


Its almost always a very bad idea to submit forms using anything other then
then a regular submit button with no need for client side scripting.

> 5. when use onsubmit to direct next page?


Never. Use this to stop the form being submitted when certain conditions are
or are not met with client side code (but don't depend on it working)

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
 
Reply With Quote
 
 
 
Reply

Thread Tools

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
error "A form tag with runat=server must exist" but there is a form tag!! André ASP .Net 2 06-23-2008 07:49 AM
input attribute for the input tag? David Wright HTML 1 12-20-2006 06:00 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
redirect URL's, return URL's, and URL Parameters Jon paugh ASP .Net 1 07-10-2004 05:29 AM
why does form with only 1 text input and 1 button input submit on enter? Guy HTML 5 12-13-2003 06:44 AM



Advertisments