Solved

What does action="#" do?

Posted on 2006-11-30
4
185 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
This article discusses how to create an extensible mechanism for linked drop downs.
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now