Solved

What does action="#" do?

Posted on 2006-11-30
4
190 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
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…

739 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