Solved

What does action="#" do?

Posted on 2006-11-30
4
186 Views
Last Modified: 2008-03-03
In the code below... what does the fom action="#" do?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0  Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
     <title>Adding Nodes</title>
     <script type="text/javascript" language="Javascript" src="script01.js">
     </script>
</head>
<body>
<form action="#">
     <p><textarea id="textArea" rows="5" cols="30"></textarea></p>
     <input type="submit" value="Add some text to the page" />
</form>
</body>
</html>
0
Comment
Question by:Mike Johnson
  • 2
4 Comments
 
LVL 54

Accepted Solution

by:
b0lsc0tt earned 125 total points
ID: 18048397
uksub,

It basically is used to just provide an entry for the action attribute so the page will validate and so browser will not enter quirks mode.  The number sign (#) is used to go to a named anchor.  Since no page name is before it and there is not anchor name after it nothing will happen because of that property.  The actual submit is probably done with javascript.  A browser that doesn't support javascript or has it disabled would just "submit the form to itself" and nothing would happen.

Let me know if you have any questions or need more information.

b0lsc0tt
0
 
LVL 6

Expert Comment

by:DonKyles
ID: 18048427
In this case, it does nothing.
Form action will perform when you click on submit button. Action will tell where to go/what to do after submission.

for example
<form name="form1" method="post" action="update.asp" onSubmit="return checkInput();">

after the submission, this form will execute javascript code before redirect to update.asp file.
0
 
LVL 41

Expert Comment

by:HonorGod
ID: 18050957
 You have encountered an ugliness of Javascript closely bound with HTML.
It would be best if we had a clear separation of

- presentation - (controlled/defined by CSS)
- behavior      - (JavaScript)
- structure      - (HTML)

  A number of proponents (strongly) suggest that JavaScript be unobtrusive.

  What you have does not match the guidelines of separation.
0
 
LVL 54

Expert Comment

by:b0lsc0tt
ID: 18070024
I'm glad that I could help you.  I noticed the B grade.  Did you still have some question or need some help with this?  If so, let us know.  I'm certainly interested in helping as you need it.  It is nice to have a chance to earn an A.

Thanks for the fun question.

bol
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Sheets script efficiency 2 25
JavaScript let vs var 5 27
If condition on Html with Asp 11 18
Javascript the "if condition with Or" 8 19
This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question