自动识别网页文件类型
发布时间:2008-12-20 阅读数: 次 来源:网乐原科技
要完成此效果需要两个步骤
第一步:把如下代码加入到区域中
<script LANGUAGE="JavaScript">
</script>
第二步:把如下代码加入到区域中
<script LANGUAGE="JavaScript">
if (isphtml) {
document.write("这是一个 .phtml 文件!");
}
else if (isshtml) {
document.write("这是一个 .shtml 文件!");
}
else if (ishtml) {
document.write("这是一个 .html 文件!");
}
else if (ishtm) {
document.write("这是一个 .htm 文件!");
// Include the generic .htm last because if tested
// first, it would be true for all the file types above
}
else {
document.write("无法识别该类文件.");
}
</script>