Stupid Web Tricks: Add alerts to your site
Takeaway: Add alerts to your site in a snap. Use them to provide extra information to users or just to surprise them with jokes.
Click here for our complete list of Stupid Web Tricks.You may want to provide visitors to your site with extra information at each turn. Or you may want to surprise them with a clever joke or insight as they move from page to page or use a form button. Whether or not your visitors want to be surprised this way is another question. Regardless, it's a snap to add alerts to your site.
Step One
Paste this code into the <HEAD> of your document:
<SCRIPT language="javascript">Step Two
<!-- hide javascriptfunction showAlert () {
alert ("Your alert here");
}// done hiding -->
</SCRIPT>
Call the showAlert() function from a hyperlink:
<A href="anotherpage.html" onClick="showAlert()">Hyperlinked word or imageWhen users click that link, they will see a dialog box with your message in it. Closing the box will send them to the URL.
To add an alert to form buttons, just insert the same onClick="showAlert()" to the <INPUT> tag of the button, like so:
<INPUT type=button value="Submit" onClick="showAlert()">
SponsoredWhite Papers, Webcasts, and Downloads
- Forrester Consulting - Optimizing Users and Applications in a Mobile World Riverbed
- TechRepublic Resource Guide - VoIP Best Practices TechRepublic
- TechRepublic Resource Guide - IP-PBX Technical Strategies TechRepublic
- Accelerating Network-based Backup Riverbed
- Gartner Magic Quadrant for WAN Optimization Controllers, 2007 Riverbed
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET

