查看積分策略說明發表回覆
Discuz! 代碼
提示插入
直接插入
說明訊息

插入粗體文本 插入斜體文本 插入下劃線 置中對齊 插入超級連結 插入信件位址 插入圖像 插入 flash 插入代碼 插入引言 插入列表
刪除線 直線分隔線 虛線分隔線
    
添加文字底框
內容 [字數檢查]:

表情符號

更多 Smilies
字型大小 |||
溫馨提示:本區開放遊客瀏覽。


文章關鍵字 : [功能說明]
(關鍵字可加強搜索準確性, 如關鍵字多於一組, 請以 , 作分隔, e.g. : 阿笨,shiuh,第一笨)

 關閉 URL 識別 | html 禁用
 關閉 表情符號 | 表情符號 可用
 關閉 Discuz! 代碼 | Discuz! 代碼 可用
使用個人簽名
接收新回覆信件通知
推薦放檔網絡空間

檔案(Torent, zip等)
  1. freedl
  2. multiupload
  3. btghost
  4. 便當狗
  5. mediafire
  6. pillowangel
圖片(JPG, GIF等)
  1. hotimg
  2. tinypic
  3. mousems2
  4. imageshack
  5. imm.io
>>>歡迎推薦好用空間


最新10篇文章回顧
adf

 發表於 2008-10-31 03:22 PM

同時判斷就不要加 else 阿

//檢查上午欄位是否有輸入,則提出警告 並返回
f (document.form.textfile1.value =="")
{
alert("審查人數:請輸入上午審查人數");
document.form.textfile1.focus();
return ;
}

//檢查下午欄位是否有輸入,則提出警告 並返回
if (document.form.textfile2.value =="")
{
alert("審查人數:請輸入下午審查人數");
document.form.textfile2.focus();
return ;
}

//以上條件都不成立(上下午都有輸入)執行submit
document.form.submit();


t9025008

 發表於 2008-10-31 09:26 AM


引用:
Jonson寫到:
看不太懂您真正想要的是什麼。
我中文程度太差了嗎?

我猜,您大概是不想要檢查有無輸入「下午審查人數」而已吧!?
就是只要有輸入上午審查人數就好了?

function check() {
    if (document.form.textfile1.value ==""){
        alert("審查人數:請輸入上午審查人數");
        document.form.textfile1.focus();
    /*
    }else if (document.form.textfile2.value ==""){
        alert("審查人數:請輸入下午審查人數");
        document.form.textfile2.focus();
    */
    }else{
                 document.form.submit();
    }
}




大大這樣子說好了,下面有兩個function我要同時存在,也就是說同時判斷function如下:(感謝大大你辛苦了)

<script language="javascript">
function check()
{
if (document.form.textfile1.value =="")
{
alert("審查人數:請輸入上午審查人數");
document.form.textfile1.focus();
}
else if (document.form.textfile2.value =="")
{
alert("審查人數:請輸入下午審查人數");
document.form.textfile2.focus();
}

else
document.form.submit();
}

function check()
2 {
3 var am = document.form.textfile1.value;
4 var pm = document.form.textfile2.value;
5 if (am == "" && pm == "")
6 {
7 alert("請輸入其中一種審查人數");
8 document.form.textfile1.focus();
9 }
10 else
11 {
12 document.form.submit();
13 }
14 }


Jonson

 發表於 2008-10-30 06:32 PM

看不太懂您真正想要的是什麼。
我中文程度太差了嗎?

我猜,您大概是不想要檢查有無輸入「下午審查人數」而已吧!?
就是只要有輸入上午審查人數就好了?

function check() {
    if (document.form.textfile1.value ==""){
        alert("審查人數:請輸入上午審查人數");
        document.form.textfile1.focus();
    /*
    }else if (document.form.textfile2.value ==""){
        alert("審查人數:請輸入下午審查人數");
        document.form.textfile2.focus();
    */
    }else{
                 document.form.submit();
    }
}


t9025008

 發表於 2008-10-30 04:37 PM


引用:
陽だまり寫到:
要不要提供一下放這段原始碼的網頁來提供測試一下




好,這個是asp跟javascript寫的只是我在改變一些東西function謝謝大大麻煩大大
這個是我的function麻煩大大一下
<%
CaseYear=Year(Date())
CaseMon=Month(Date())
CaseDay=Day(Date())
CaseHour=Hour(Time())
CaseMinute=Minute(Time())
%>
<html>
<head>
<title>登記案件辦理資訊查詢</title>
<meta http-equiv="Content-Type" content="text/html; charset=big5">
<script language="javascript">
function check()
        {
        if (document.form.textfile1.value =="")
                {
                        alert("審查人數:請輸入上午審查人數");
                        document.form.textfile1.focus();                       
                }
                 else if (document.form.textfile2.value =="")
                {
                        alert("審查人數:請輸入下午審查人數");
                        document.form.textfile2.focus();
                }
               
        else
                 document.form.submit();       
        }
       
   
   
          
function leave()
        {
           window.location ="cas2_M.asp";
        }
</script>
<link href="css/01style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style2 {font-weight: bold}
-->
</style>
</head>

<body bgcolor="#ffffff" background="images/bg-03.jpg">
<p align="center"><b>登記案件辦理資訊查詢系統(新增)</b>- <strong>人力狀況維護 </strong></p>
<div align="center"><img src="Hbar.gif" width="645" height="10"> </div>
<form method="post" action="cas2_M_I.asp" name="form">
  <p align="center"><strong>機關名稱:</strong><font size="-1">
    <select name="select2">
          <option value="0" selected>== 請選擇 ==</option>
          <option value="1">古亭所</option>
          <option value="2">建成所</option>
          <option value="3">中山所</option>
          <option value="4">松山所</option>
          <option value="5">士林所</option>
                  <option value="6">大安所</option>                  
    </select>
</p>
  <p align="center"> </p>
<div align="center">
     <table width="470" border="1">
       <tr bgcolor="#CCFFFF">
         <th width="176" height="35" bordercolor="#996633" scope="col"><div align="right"><%=CaseYear%>年<%=CaseMon%>月<%=CaseDay%>日</div></th>                 
         <th width="135" height="35" bordercolor="#996633" scope="col"><samp><strong>上午</strong></samp></th>
         <th width="135" height="35" bordercolor="#996633" scope="col"><samp><strong>下午 </strong></samp></th>
       </tr>
       <tr bgcolor="#CCFFFF">
         <td width="176" height="30" bordercolor="#996633"><div align="right"><strong>審查人數:</strong></div></td>
         <td width="135"height="30" bordercolor="#996633"><h1 align="center">
           <input name="textfile1" type="text1" width="50">
         </h1></td>
         <td width="137" height="30" bordercolor="#996633"><h1 align="center">
           <input name="textfile2" type="text2" width="50">
         </h1></td>
       </tr>
       <tr bgcolor="#CCFFFF">
         <td width="176" height="31" bordercolor="#996633"><div align="right"><strong>登校人數:</strong></div></td>
         <td width="135" height="31" bordercolor="#996633"><h1 align="center">
           <input type="textfile3" name="text3" width="50">
         </h1></td>
         <td width="137" height="31" bordercolor="#996633"><h1 align="center">
           <input type="textfile4" name="text4" width="50">
         </h1></td>
       </tr>
    </table>
    <p align="left" class="style2">       說明:</p>
     <p align="justify"><strong>       每日輸入時間:<%=CaseHour%>時<%=CaseMinute%>分</strong>
     </p>
  </div>
  <p align="center">
    <input type="button" name="Enter" value="確定" onClick="check()">        
    <input type="button" name="Leave" value="取消" onClick="leave()">
  </p>
</form>
<div align="center"><img src="Hbar.gif" width="645" height="10"> </div>
<div align="right"><br>
  <!--<font size="-1">本頁面最新更新日期:2008/10/29</font> --> </div>
<p> </p>

</body>
</html>


陽だまり

 發表於 2008-10-30 04:30 PM

要不要提供一下放這段原始碼的網頁來提供測試一下


t9025008

 發表於 2008-10-30 03:21 PM

我想請教各位大大,這個function有兩個input一個是上午,一個是下午,這個function是只要我少輸入一個的話就會出現請輸入數字,但是問題來了,如果今天我只要設定上午,而不設定下午,同時又能夠跑下面那個function那請問要怎麼改,然後,當我要輸入上午時,另一個就不會出現請輸入數字出現,麻煩各位大大一下謝謝


<script language="javascript">
function check()
        {
        if (document.form.textfile1.value =="")
                {
                        alert("審查人數:請輸入上午審查人數");
                        document.form.textfile1.focus();                       
                }
                 else if (document.form.textfile2.value =="")
                {
                        alert("審查人數:請輸入下午審查人數");
                        document.form.textfile2.focus();
                }
               
        else
                 document.form.submit();       
        }





所在時區為 GMT+8, 現在時間是 2024-4-28 01:36 AM
清除 Cookies - 連絡我們 - TWed2k © 2001-2046 - 純文字版 - 說明
Discuz! 0.1 | Processed in 0.023644 second(s), 7 queries , Qzip disabled