Thursday, August 18, 2011

Javascript for Different Type of Alert Message

An alert box is box that appears on the display screen to give you information. Alert box can be created in various way. Here, i have put a common alert box with OK Button in JavaScript. Just change the phrase according to your need. Sometimes your site may be contain explicit contents. It is useful if you notify your readers before they enter in those contents. This java script is described in no.2 script. Here,you can redirect your readers to other site or location if they do not want enter your site.Here, i put yahoomail as another URL to redirect my visitors.

1. JavaScript with  OK Button

<script type="text/javascript">
alert('You are about to enter an extremely funny site. People who are prone to laughing fits ... Beware!')
</script>
<noscript>Enable javascript in your browser to view an important message.</noscript> 



2. JavaScript with  Confirmation Button  

<script type="text/javascript">
confirm('This site contains explicit contents. Are you sure you want to continue?');
if (confirm('This site contains explicit contents. Are you sure you want to continue?')) {
window.location = "http://lucky-techblog.blogspot.com/";
}
else {
window.location = "http://www.yahoomail.com/";
}
</script> 


 

0 comments:

Post a Comment