Solved

alert on textbox focus

Posted on 2007-04-11
5
444 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
  • 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 250 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

An enjoyable and seamless user experience can go a long way on an eCommerce site. While a cohesive layout and engaging copy play roles in creating a positive user experience, some sites neglect aspects that seem marginal but in actuality prove very …
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

856 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