Script Categories













Page Details >>> Page Extension.

Displays a message based on the extension (like .html) of the web page. And, it's a breeze to add more file types to the script.

Add the below code to the <body> section of your page:

<script language="javascript" type="text/javascript">      
/* Visit http://www.yaldex.com/ for full source code
and get more free JavaScript, CSS and DHTML scripts! */
<!-- Begin
URL = window.location.href;
ishtm = (URL.indexOf('.htm') > -1); // true if URL contains .htm
ishtml = (URL.indexOf('.html') > -1);
isshtml = (URL.indexOf('.shtml') > -1);
isphtml = (URL.indexOf('.phtml') > -1);

if (isphtml) {
document.write("<b>This is a .phtml file!</b>");
}
else if (isshtml) {
document.write("<b>This is a .shtml file!</b>");
}
else if (ishtml) {
document.write("<b>This is a .html file!</b>");
}
else if (ishtm) {

document.write("<b>This is a .htm file!</b>");
// Include the generic .htm last because if tested
// first, it would be true for all the file types above

}
else { // It is something else....
document.write("<b>This file is of an unknown type.</b>");
}
//  End -->
</script>

JavaScript Editor Get Advanced
JavaScript and Ajax Editor,
Validator and Debugger!

1st JavaScript Editor.



Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).




©