重赏之下必有勇夫<SCRIPT LANGUAGE=JavaScript>
<!--
document.opform=1;
function disp()
{
    exec();
}
function exec()
{
if(document.opform==1){
  if(check() != true){
          alert("plase input CustomerID");
    return false;
  }
  document.form1.submit();
}else if(document.opform==2){
  
 if(check() != true){
          alert("plase input file");
    return false;
 }
 document.form3.submit();
}
    return;   
}function check()
{
    if(document.opform==1&&document.form1.textareaCustomerID.value.length == 0)
   {
    return false;
   }else if(document.opform==2&&document.form3.filInCSVName.value.length == 0){
    return false;
   }
   return true
}function inputCustomerID(sts)
{    if(sts==1)
    {     
       document.opform=1;
       document.form1.textareaCustomerID.disabled = false;
       document.form1.textareaCustomerID.focus();
       document.form1.textareaCustomerID.select();
       document.form3.filInCSVName.disabled = true ;
     }else{
       document.opform=2;
       document.form3.filInCSVName.disabled=false;
       document.form3.filInCSVName.focus();
       document.form3.filInCSVName.select();
       document.form1.textareaCustomerID.disabled = true;
    }}-->
</SCRIPT><HTML><HEAD><TITLE>test</TITLE>
<meta http-equiv="content-type" content="text/html; charset=shift_jis">
<meta http-equiv="content-style-type" content="text/css">
<link rel="stylesheet" href="../style01.css" type="text/css"></head>
<body bgcolor=#ffffff>
<BR>
<TABLE BORDER="1" CELLSPACING="1" CELLPADDING="1" WIDTH="100%">
<TR>
<TD bgcolor="#FFEEEE">
<B>message</B>
</TD>
</TR>
</TABLE><form name="form1" method="post" action="msgManageCheck.asp"><TABLE WIDTH="550" BORDER="0" CELLSPACING="1" CELLPADDING="1"><tr>
<TD bgcolor="#CCFFFF">
<FONT SIZE="2">手順1 <b>CustomerID</b>
</TD>
<TD bgcolor="#CCFFFF">
<FONT SIZE="2">手順2 <b>操作</b>
</TD>
</tr><tr>
   <td>
     <input type="radio" name="CIDinput"  onClick="inputCustomerID(1)"><font color="#F08080">画面輸入</td>
    <td>
     <input type="radio" name="CIDinput"  onClick="inputCustomerID(2)"><font color="#F08080">file輸入<br/>
    </td>
</tr>
<tr>
<TD rowspan="8">
<TEXTAREA name="textareaCustomerID" cols="15" rows="20"></TEXTAREA>
</TD>
</tr>
<tr>
<TD valign="top"><BR>
     
</form><form name="form3" method="post" action="msgManageCheck.asp" enctype="multipart/form-data">  
<input type="button" name="subSel" value="   表示   " onClick="disp()">
&nbsp;&nbsp;
<input type="file" name="filInCSVName" size="20">
<BR>
<BR><font color="#F08080"><BR>
<HR>
</TD>
</tr></form>
</BODY></HTML>

解决方案 »

  1.   

    <HTML>
    <HEAD>
    <TITLE>test</TITLE>
    <meta http-equiv="content-type" content="text/html; charset=GBK">
    <meta http-equiv="content-style-type" content="text/css">
    <link rel="stylesheet" href="../style01.css" type="text/css"><SCRIPT LANGUAGE=JavaScript>
    <!--
    function disp()
    {
    with(form1){
    var text=filInCSVName.disabled==true?"CustomerID":"file";
    var src=filInCSVName.disabled==true?textareaCustomerID:filInCSVName;
    if(src.value==""){ alert("psease input "+text); src.focus(); return false;}
    else submit();
    }
    }function inputCustomerID(boolFlag)
    {
    with(form1){
    textareaCustomerID.disabled = boolFlag;
    filInCSVName.disabled = !boolFlag;
    boolFlag==false?textareaCustomerID.select():filInCSVName.select();
    subSel.disabled=false;
    }
    }-->
    </SCRIPT>
    </head>
    <body bgcolor=#ffffff>
    <BR>
    <TABLE BORDER="1" CELLSPACING="1" CELLPADDING="1" WIDTH="100%">
    <TR>
    <TD bgcolor="#FFEEEE">
    <B>message</B>
    </TD>
    </TR>
    </TABLE>
    <form name="form1" method="post" action="msgManageCheck.asp">
    <TABLE WIDTH="550" BORDER="1" CELLSPACING="1" CELLPADDING="1">
    <tr>
    <TD bgcolor="#CCFFFF">
    <FONT SIZE="2">手順1 <b>CustomerID</b></font>
    </TD>
    <TD bgcolor="#CCFFFF">
    <FONT SIZE="2">手順2 <b>操作</b></font>
    </TD>
    </tr>
    <tr>
       <td>
     <input type="radio" name="CIDinput"  onClick="inputCustomerID(false)"><font color="#F08080">画面輸入</font></td>
    <td>
     <input type="radio" name="CIDinput"  onClick="inputCustomerID(true)"><font color="#F08080">file輸入</font><br/>
    </td>
    </tr>
    <tr>
    <TD>
    <TEXTAREA name="textareaCustomerID" cols="15" rows="20" disabled></TEXTAREA>
    </TD>
    <TD valign="top"><BR>
    <input type="button" name="subSel" value="   表示   " onClick="disp()" disabled>       
    &nbsp;&nbsp;<INPUT type="file" name="filInCSVName" size="20" disabled>
    <BR>
    <HR>
    </TD>
    </tr>
    </table>
    </form>
    </BODY>
    </HTML>
      

  2.   

    zhaoxiaoyang(梅雪香@hisoft)  勇夫!!
      

  3.   

    <SCRIPT LANGUAGE=JavaScript>
    <!--
    function disp()
    {
    if (!document.form1.textareaCustomerID.disabled)
    {
    if (document.form1.textareaCustomerID.value == "")
    {
    alert("plase input CustomerID!");
    }
    else
    {
    document.form1.submit();
    }
    }
    else
    {
    if (document.form3.filInCSVName.value == "")
    {
    alert("plase input file!");
    }
    else
    {
    document.form3.submit();
    }
    }
    }function inputCustomerID(sts)
    {    if(sts==1)
        {     
           document.form1.textareaCustomerID.disabled = false;
           document.form1.textareaCustomerID.focus();
        document.form1.textareaCustomerID.select();
           document.form3.filInCSVName.disabled = true ;
         }else{
           document.form3.filInCSVName.disabled=false;
           document.form3.filInCSVName.focus();
       document.form3.filInCSVName.select();
           document.form1.textareaCustomerID.disabled = true;
        }}
    -->
    </SCRIPT>
    <HTML><HEAD><TITLE>test</TITLE>
    <meta http-equiv="content-type" content="text/html; charset=shift_jis">
    <meta http-equiv="content-style-type" content="text/css">
    <link rel="stylesheet" href="../style01.css" type="text/css"></head>
    <body bgcolor=#ffffff>
    <BR>
    <TABLE BORDER="1" CELLSPACING="1" CELLPADDING="1" WIDTH="100%">
    <TR>
    <TD bgcolor="#FFEEEE">
    <B>message</B>
    </TD>
    </TR>
    </TABLE><form name="form1" method="post" action="msgManageCheck.asp"><TABLE WIDTH="550" BORDER="0" CELLSPACING="1" CELLPADDING="1"><tr>
    <TD bgcolor="#CCFFFF">
    <FONT SIZE="2">手順1 <b>CustomerID</b>
    </TD>
    <TD bgcolor="#CCFFFF">
    <FONT SIZE="2">手順2 <b>操作</b>
    </TD>
    </tr><tr>
       <td>
         <input type="radio" name="CIDinput"  onClick="inputCustomerID(1)" checked value="1"><font color="#F08080">画面輸入</td>
        <td>
         <input type="radio" name="CIDinput"  onClick="inputCustomerID(2)"><font color="#F08080">file輸入<br/>
        </td>
    </tr>
    <tr>
    <TD rowspan="8">
    <TEXTAREA name="textareaCustomerID" cols="15" rows="20"></TEXTAREA>
    </TD>
    </tr>
    <tr>
    <TD valign="top"><BR>
        
    </form><form name="form3" method="post" action="msgManageCheck.asp" enctype="multipart/form-data">  
       
    <input type="button" name="subSel" value="   表示   " onClick="disp()"> 
    &nbsp;&nbsp;<INPUT type="file" name="filInCSVName" size="20">
    <BR><BR><font color="#F08080">
    <BR>
    <HR>
    </TD>
    </tr></form>
    </BODY></HTML>
      

  4.   

    zhaoxiaoyang(梅雪香@hisoft)  的还有点小错误,页面history.back回去的话,textarea和file按钮都会被disable掉。
      

  5.   

    多从来没用过history.back,不知道怎么用,所以也没考虑这个问题
    不知道在onload事件里重新初始化能不能解决?To meizz:啥叫勇夫?
      

  6.   

    回复人: faisun(暖阳) ( ) 信誉:100  2005-04-06 01:25:00  得分: 0     重赏之下必有勇夫然后你就回复了