标题:求教高手看看 为什么这个 javascript 不执行
取消只看楼主
cy5505chyu
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2011-5-7
结帖率:33.33%
 问题点数:0 回复次数:0 
求教高手看看 为什么这个 javascript 不执行
程序代码:
<!--#include file="inc/conn.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="style/css.css" type="text/css">
<title>无标题文档</title>
<style type="text/css">
body{ text-decoration:none; margin:auto; padding-top:0; margin-top:0;}
.td{ color:#666666;text-align:left; text-decoration:none;font-size: 14px;
}
.to{font:'宋体'; font-size:13px; text-decoration:none; color:#000000;}
.tou{text-decoration:none; color:#000000;}
.midd{ margin:0 auto; text-align:center; width:1000px;}
</style>
<script language="javascript">
function checkform()
{

  if (form.name.value =="" ){
    alert("昵称不能为空");
  
    return(false);

 }


 if (form.email.value =="" ){
    alert("电子邮件不能为空");
  
    return(false);

 }

 if (form.content.value =="" ){
    alert("留言内容不能为空");
  
    return(false);

 }

 
}
</script>

</head>
<body >
<table id="__01" width="1000" border="0" cellpadding="0" cellspacing="0" align="center">
    <tr>
        <td colspan="5">
            <img src="images/index_01.gif" width="1000" height="31" alt=""></td>
            </tr>

        <tr>
    <td colspan="5" background="images/index_02.gif" width="1000" height="34"  class="to"  >   
    <table width="680"   height="34" align="right">
    <tr><td width="82"><a href="index.asp" class="tou">首页</a></td>
    <td width="104"><a href="#" class="tou">公司简介</a>    </td>
    <td width="96"><a href="news_list.asp" class="tou">新闻中心</a></td>
    <td width="99"><a href="#" class="tou">产品中心</a>    </td>
    <td width="113"><a href="#" class="tou">招聘向导</a>    </td>
    <td width="110"><a href="content.asp" class="tou">联系我们</a></td>
    <td width="39"></td>
    <td width="21"></td>
    </tr>
    </table></td>

    </tr>
    <tr>
        <td colspan="5">
            <img src="images/index_03.gif" width="1000" height="33" alt=""></td>

    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_04.gif" width="1000" height="37" alt=""></td>
    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_05.gif" width="1000" height="45" alt=""></td>
    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_06.gif" width="1000" height="39" alt=""></td>
    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_07.gif" width="1000" height="44" alt=""></td>
    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_08.gif" width="1000" height="38" alt=""></td>
    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_09.gif" width="1000" height="36" alt=""></td>
    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_10.gif" width="1000" height="34" alt=""></td>
    </tr>
    <tr>
        <td colspan="2">
            <img src="images/news1_11.gif" width="1000" height="31" alt=""></td>
    </tr>
</table>
    <table id="__01" border="0" cellpadding="0" height="500" cellspacing="0" width="859" align="center" >   
    <tr>   
        <td valign="top" width="300"><img src="images/news_13_02.gif" border="0"></td><td width="559" valign="top">
         <form name="from" id="from" action="content.asp?action=add" method="post" onSubmit="return checkform()" >
        <table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
       
  <tr>
    <td width="19%"><strong>联系方式:</strong></td>
    <td width="81%">&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><strong>给我留言</strong></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>

  <tr>
    <td align="right">昵称:</td>
    <td>
      <input type="text" name="name">    </td>
  </tr>
  <tr>
    <td align="right">性别:</td>
    <td>
      <input name="sex" type="radio" value="先生" checked="checked">
      先生
      <input type="radio" name="sex" value="女士">女士 </td>
  </tr>
  <tr>
    <td align="right">E-mail:</td>
    <td>
      <input type="text" name="email" onblur=email(this.value)>    </td>
  </tr>
  <tr>
    <td align="right" valign="top">内容:</td>
    <td><textarea name="content" cols="30" rows="5" ></textarea></td>
  </tr>
  <tr>
    <td height="37" align="center">&nbsp;</td>
    <td><input type="submit" name="Submit" value=" 添 加 " border="0" style="background-color: #cccccc" />     &nbsp;&nbsp;&nbsp;&nbsp;
      <input name="Submit2" type="reset" value=" 重 置 " border="0" style="background-color: #cccccc" /></td>
  </tr>
</table>
         </form>
</td>
    </tr>   
</table>
    <table width="1000" align="center" cellpadding="0" cellspacing="0">
    <tr>
        <td>
            <img src="images/news1_15.gif" width="1000" alt="" border="0"></td>
    </tr>
    <tr>
        <td >
            <img src="images/news1_16.gif" width="1000" alt="" border="0"></td>
    </tr>
</table>
<%
dim rs,sql
if request("action")="add" then 
  set rs=server.createobject("adodb.recordset")
  sql="select * from Guest"
   rs.open sql,conn,1,3
   if request.Form("name")<>"" and request.Form("content") <>""  then
   rs.addnew
   rs("name")=request.Form("name")
   rs("sex")=request.Form("sex")
   rs("content")=request.Form("content")           
   rs.update
   rs.close  
  response.write("<Script language=JavaScript>alert('留言添加成功!')</Script>")
   Response.Write("<script>window.location ='content.asp'</script>")
   else
    response.write("<Script language=JavaScript>alert('昵称和内容都不能为空!')</Script>")
   Response.Write("<script>window.location ='content.asp'</script>")
   end if
end if
%>
</body>
</html>
搜索更多相关主题的帖子: javascript 
2011-06-11 14:03



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-342484-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.361469 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved