var str=form1.file1.value//上传文件的控件的值
var re=/^http:\/{1,2}myphoto(.+)/i
if(!re.test(str))
{
   alert("必须以http://或 /myphoto开头才能上传");
   return false
}

解决方案 »

  1.   

    hbhbhbhbhb1021谢谢你,给个详细的好吗?
      

  2.   

    大体上这样
    <input name=file1 type=file>
    <input name=button1 type=button value="按" onclick=check()>
    <script language=javascript>
    function check()
    {
    var str=document.getElementById("file1").value//上传文件的控件的值
    var re=/^http:\/{1,2}myphoto(.+)/i
    if(!re.test(str))
    {
       alert("必须以http://或 /myphoto开头才能上传");
       return false
    } }
    </script>
      

  3.   

    if (document.Form1.Content.value !="http://" || document.Form1.Content.value !="/photo")
    {
            alert("必需以http://或 /photo开头才能上传");
    document.Form1.Content.focus();
    return false;
    }
      

  4.   

    输入http:/ 看看
    可能是被//转译了
      

  5.   


    //if (document.Form1.Content.value !="http://" || document.Form1.Content.value !="/photo")
    if (document.Form1.Content.value.indexOf("http://")!=0 || document.Form1.Content.value.indexOf("/photo")!=0)
     
      

  6.   

    .indexOf 楼上的哥哥,上面好像也不行。。.indexOf什么意思?
      

  7.   

    shyslysky(飞天) 能详细一点。。很急用
      

  8.   

    提交时候内容框时,必需是http://或/photo开头才行不知道如何做?
      

  9.   

    // if (document.Form1.Content.value.indexOf("http://")!=0 || document.Form1.Content.value.indexOf("/photo")!=0)if (document.Form1.Content.value.indexOf("http://")!=0 && document.Form1.Content.value.indexOf("/photo")!=0)