> 백엔드 개발 > PHP 튜토리얼 > php-JS判断文本框是否是空的问题,为什么我的代码不能判断,就指点

php-JS判断文本框是否是空的问题,为什么我的代码不能判断,就指点

WBOY
풀어 주다: 2016-06-02 11:32:45
원래의
1104명이 탐색했습니다.

phphtmljavascrpit

$conn = mysql_connect ( 'localhost', 'root', 'admin' ) or die ( 'could not connect: ' . mysql_error () );
mysql_select_db ( 'sybgtjxt' ) or die ( 'could not select database' );
mysql_query ( "set names gbk" );

?>


实验报告提交系统
h2, font { font-style: oblique; color: #FCC898; font-weight: normal id=top; valign =top; position: relative;}function YanZheng() { var cname = document.getElementById("cname").value; var tname = document.getElementById("tname").value; var ppro = document.getElementById("ppro").value; var pgrade = document.getElementById("pgrade").value; var pcol = document.getElementById("pcol").value; //var pcutdate = document.getElementById("pcutdate").value; var pname = document.getElementById("pname").value; var paim = document.form1.paim.value; var pcontent = document.getElementById("pcontent").value; var pstep = document.getElementById("pstep").value; var panalyse = document.getElementById("panalyse").value; var presult = document.getElementById(" presult").value; //这个功能没实现 if (cname=="") { window.alert("请输入所有内容"); return false; } } function Reset() { document.getElementById("cname").value = ""; document.getElementById("tname").value = 0; document.getElementById("ppro").value = 0; document.getElementById("pgrade").value = 0; document.getElementById("pcol").value = 0; document.getElementById("pcutdate").value = ""; document.getElementById("pname").value = ""; document.getElementById("paim").value = ""; document.getElementById("pcontent").value = ""; document.getElementById("pstep").value = ""; document.getElementById("panalyse").value = ""; document.getElementById("presult").value = ""; } function YYYYMMDDstart() { MonHead = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]; //先给年下拉框赋内容 var y = new Date().getFullYear(); for (var i = (y-30); i =1&&i

onsubmit="return YanZheng();">
<code>        <caption>            <h2>布置作业</h2>        </caption>        <tr>            <th style="text-align: left">课程名称:</th>            <td>
<input type="text" name="cname" id="cname" style="border-color: #FCC898; border-width: 3px; border-style: solid; font-weight: normal; width: 400px;">            </td>        </tr>        <tr>            <th style="text-align: left">任课老师:</th>            <td><select name="tname" id="tname">                    <option value="0" selected>请选择</option>
<p><?php <br>$sql = "select tname from tblteacher";<br>$result = mysql_query ( $sql );<br>while ( $row = mysql_fetch_assoc ( $result ) ) {<br>    ?></p>
<p>学    院:<br></p>
<td>
<br>请选择<br><?php <br>$sql = "select colname from college";<br>$result = mysql_query ( $sql );<br>while ( $row = mysql_fetch_assoc ( $result ) ) {<br>    ?><p>专    业:<br></p>
</td>
<td>
<br>请选择<br><?php <br>$sql = "select pro_name from pro";<br>$result = mysql_query ( $sql );<br>while ( $row = mysql_fetch_assoc ( $result ) ) {<br>    ?><p>年    级:<br></p>
</td>
<td>
<br>请选择<br><?php <br>$sql = "select sgrade from tblstudent";<br>$result = mysql_query ( $sql );<br>while ( $row = mysql_fetch_assoc ( $result ) ) {<br>    ?><p>截止日期:<br></p>
</td>
<td>
<br>年<br><br>月<br><br>日<br>
</td>
<br><pre class="brush:php;toolbar:false"><code>        <tr>            <th style="text-align: left">实验名称:</th>            <td>
<input type="text" name="pname" id="pname" style="border-color: #FCC898; border-width: 3px; border-style: solid; font-weight: normal; width: 400px;">            </td>        </tr>        <tr>            <th style="text-align: left">实验目的:</th>            <td>
<textarea cols="58" rows="4" name="paim" id="paim" cellspacing="0" style="border-color: #FCC898; resize: none; border-width: 3px; border-style: solid; font-weight: normal; width: 400px;"></textarea>            </td>        </tr>        <tr>            <th style="text-align: left">实验内容:</th>            <td>
<textarea cols="58" rows="4" name="pcontent" id="pcontent" cellspacing="0" style="border-color: #FCC898; resize: none; border-width: 3px; border-style: solid; font-weight: normal; width: 400px;"></textarea>            </td>        </tr>        <tr>            <th style="text-align: left">实验步骤:</th>            <td>
<textarea cols="58" rows="4" name="pstep" id="pstep" cellspacing="0" style="border-color: #FCC898; resize: none; border-width: 3px; border-style: solid; font-weight: normal; width: 400px;"></textarea>            </td>        </tr>        <tr>            <th style="text-align: left">实验结果:</th>            <td>
<textarea cols="58" rows="4" name="presult" id="presult" cellspacing="0" style="border-color: #FCC898; resize: none; border-width: 3px; border-style: solid; font-weight: normal; width: 400px;"></textarea>            </td>        </tr>        <tr>            <th style="text-align: left">分析讨论:</th>            <td>
<textarea cols="58" rows="4" name="panalyse" id="panalyse" cellspacing="0" style="border-color: #FCC898; resize: none; border-width: 3px; border-style: solid; font-weight: normal; width: 400px;"></textarea>            </td>        </tr>        <tr>            <td colspan="2" align="center">
<input type="submit" value="提交"> <input type="reset" value="重置" onclick="Reset()">
</td>        </tr>    </code>
로그인 후 복사


관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿