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

J

john woo

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?
 
D

David Dorward

john said:
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/scripts.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/www/formquestion.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 said:
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)
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top