Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

alert on textbox focus

Posted on 2007-04-11
5
Medium Priority
?
449 Views
Last Modified: 2012-05-05
i need to have an alert window popup when a user clicks in a textbox on a page.. how do i do this.

0
Comment
Question by:t3ssav
[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
  • 4
5 Comments
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18891674
<input type="text" onclick="javascript:alert('Message');">
0
 
LVL 29

Accepted Solution

by:
rdivilbiss earned 1000 total points
ID: 18891688
In your question title you said focus and not click.  In that case:

<input type="text" onfocus="javascript:alert('Message');">

However that will be very annoying.
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18891707
<script type="text/javascript">
var messageShown = false;

function focusMessage() {
    if (!messageShown) {
           alert('Message');
           messageShown = true;
    }
}
</script>

<input type="text" onfocus="focusMessage()">

Would be better as it only will show the message once per page load.

0
 

Author Comment

by:t3ssav
ID: 18891805
the requirement for the project is that when they focus the text box.. every time they focus it it has to popup a disclaimer...
0
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18892590
Build what they want but I wouldn't be surprised if they later changed their mind.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
Dramatic changes are revolutionizing how we build and use technology. Every company is automating, digitizing, and modernizing operations. We need a better, more connected way to work together as teams so we can harness the insights from our system…
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses

609 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