判斷使用者輸入地址是本地還是網路

來源:互聯網
上載者:User

<FORM  id=Upload2 name=Upload2 action="photo_diy2.asp" method=post onSubmit="return ValidateDIY(this);" target=_blank> 
        <tr height=50>
          <td valign="bottom">或者:</td>
          <td valign="bottom">在網路瀏覽的時候發現一張好圖想直接加工編輯一下,請輸入這張圖片的URL。</td>
        </tr>
        <tr>
          <td align="right"><input type=hidden name="uploadtype" value=1></td>
          <td><input type="text" name="picurl" value="http://" size=75>
                <input type="submit" value="下一步"></td>
        </tr>
      <input name="uploadfile" type=hidden>
  </form>

js函數

function ValidateDIY(aForm)
 {
    if (aForm.uploadtype.value==1)   {

   if (!aForm.picurl.value || (aForm.picurl.value=="http://"))
   {
     alert("請輸入你要發送的圖片的網路地址!");
     aForm.picurl.focus();
     return (false);
    }
    else
     {
    aForm.uploadfile.value=aForm.picurl.value;
    aForm.action='photo_diy2.asp?uploadtype=1';
     return (true);
     }
    }
    else if (aForm.uploadtype.value==0)   {
   if (!aForm.picfile.value){
     alert("請輸入你電腦中的本地圖片!");
     aForm.picfile.focus();
     return (false);
    }else{
      if(checkPic()) {     
     aForm.uploadfile.value=aForm.picfile.value;
     aForm.action='photo_diy2.asp?uploadtype=0';
     return (true);
      }else{
       return (false);
     }
     }

    }
  
  
 }
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.