Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

What does action="#" do?

Posted on 2006-11-30
4
Medium Priority
?
194 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 375 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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

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…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

721 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