function get(str) //从链接地址里提取出本文档名
{
alert(str.match(/\\([^\\]*)$/)[1])
}
var strFileSpec = "c:\\html\\images\\logo.gif";
get(strFileSpec);
{
alert(str.match(/\\([^\\]*)$/)[1])
}
var strFileSpec = "c:\\html\\images\\logo.gif";
get(strFileSpec);
<!--
var strFileSpec = "c:\\html\\images\\logo.gif";
var a = strFileSpec.split("\\");alert(a[a.length-1])alert(strFileSpec.substr(strFileSpec.lastIndexOf("\\")+1))
//-->
</script>
alert(strFileSpec.substring(strFileSpec.lastIndexOf("\\")+1,strFileSpec.length))
function getFileName(url)
{
return url.match(/\\([^\\]+)$/)[1];
}
</SCRIPT>
<input type=file onchange="alert(getFileName(this.value))">