Go Around The Tech Corner…

JS Tip 1: How to display alert messages in JavaScript

Posted on: October 20, 2009


Often you’ll see messages popping up to alert you about something or to give you extra information on something. These can be programmed using JavaScript and it’s very simple. See the code below – It’s easy to understand.


<html>
<head>
<title>Displaying Alerts with JavaScript</title>
<script language = "JavaScript">
<!--
function m_alert()
{
alert('Do not Click..!!!');
alert('I Told You Not To Click Me..!!');
alert('Why Did You Click???!!!');
alert('You Will Never See Me Again!!!');
}
-->
</script>
</head>
<body>
<a href="#" onMouseover = "m_alert()"> Dont Click This Link </a>
</body>
</html>

Simply copy the code above, paste it into a notepad file and save the file with a .html extension, e.g. alerts.html.

The link has a mouseover function which calls the JavaScript funtion when you hover it. When writing JavaScript code, always remember to end the lines of code with a semicolon (;). Try and see how it works! You can use alerts in your websites to pass on certain messages easily.

– Millie

Advertisements

3 Responses to "JS Tip 1: How to display alert messages in JavaScript"

[…] On my previous post about how to display alert messages, you’ll see that the messages are specified in quotes within the script. What if you wanted to […]

This is without doubt the most awesome most thought provoking website I’ve seen yet,I’m glad I unearthed techexperience.wordpress.com

folks with screwy thoughts think like this:
In it something is. Clearly, thanks for the help in this question.

Thanks for making my day!! 🙂

– Millie

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Me – The author of this blog!


This is my tech blog. I got another blog, full of jokes that will crack u up! http://humoraddict.blogspot.com

Follow milliepatel84 on Twitter

Tweet Tweet…!!!!

Blog Stats

  • 44,031 hits

Top Clicks

  • None

Flickr Photos

%d bloggers like this: