<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>"><title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<script language = "JavaScript">
function isFilePath(value){
/* var re = /apples/gi;
str = "Apples are round, and apples are juicy.";
newstr=str.replace(re, "oranges");
alert(newstr);*/
while (value.split("\\").length > 1) {
value = value.replace("\\", "/");
}
if (value.split(":")[0].length > 1 || value.split("//").length > 1 || value.split(".").length <= 1 || value.split(".")[1] == null || value.split(".")[1] == "" ||
value.split(".")[1].match("/")) {
alert("不符合111");
return null;
}
var regex = /[a-zA-Z]{1}:{1}\/[^\/].+(\/$)?/;
var array = regex.exec(value);
if (array != null) {
alert("符合");
return null;
}
else {
alert("不符合222");
return null;
}
}
</script>
</head>
<body>
<form>
<input type="text" value="" id="temp" name="temp"/>
<br>
<input type="button" value="test" onclick="isFilePath(temp.value);"/>
</form>
</body>
</html>
?
详细解决方案
JS判断是不是为windows文件路径
热度:91 发布时间:2012-11-10 10:48:51.0
相关解决方案
- my lovely windows , see you!该如何处理
- Windows Mobile开发中的有关问题
- windows mobile中j2me的疑问,该怎么解决
- Socket通讯 windows mobile操作系统支持吗
- windows mobile 6.1下有支持蓝牙传输的java虚拟机吗?解决思路
- jdk-6u7-windows-i586-p.exe 后边的-p是什么意思
- Windows 8之父Steven Sinofsky将离开微软,微软官方已确认解决方法
- Windows 八之父Steven Sinofsky将离开微软,微软官方已确认
- Windows Form 中怎么将 treeview 的节点与页面内容关联
- DevExpress的WinForm控件都沿袭自System.Windows.Forms.Contrl吗
- Free Windows Forms Controls——Krypton Toolkit解决思路
- ActiveX 安装出现 Windows Installer 有关问题
- vc写的 windows service 控制台程序有关问题
- c++/cli windows form有关问题
- Windows media player控件编程播放avi只有声音没图像啊解决方案
- windows 窗口进程lParam参数的,高低两个宏定义
- j# 里如何定义和 C#同样功能的 override void DefWndProc(ref System.Windows.Forms.Message m) 多谢,很
- dundas chart for windows 怎么调整柱状图的宽度,怎么设置柱状图的起止点
- windows service装配服务程序
- windows server 2008 + IIS 7.5 上 网站自定义权限过滤有关问题
- windows 8 的搜索是不是有有关问题?是不是个新Bug
- windows azure 的一个非常初级的有关问题
- windows 服务没法启动
- windows 八批处理 显示时间
- res://C:\WINDOWS\system32\shdoclc.dll/http_500.htm解决思路
- windows 7 x64 安装Oracle 10g 无法解析指定的连接标识符 异常
- 网站放到 windows server 2003服务器中,服务器在安装时设置的连接数是5,这样设置对大量用户访问有影响吗?解决办法
- 登录失败。该登录名来自不受信任的域,不能与 Windows 身份验证一起使用。该如何处理
- windows 2003服务器 图片上传
- windows authentication验证的一个有关问题