日期:2014-05-17  浏览次数:20827 次

asp 提交表单后,采用alert弹出消息框中文出现乱码
完整贴出代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title></title>
   
  <link href="cs.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" language="JavaScript">
 
// 表单提交客户端检测
function doCheck(){
if (document.form1.projname.value==""){
alert("项目名称不能为空!");
document.form1.projname.focus();
return false;
}
if (document.form1.contact.value==""){
alert("联系人不能为空!");
document.form1.contact.focus();
return false;
}
if (document.form1.tel.value==""){
alert("电话号码不能为空!");
document.form1.tel.focus();
return false;
  }
  if (document.form1.email.value == "") {
  alert("邮箱地址不能为空!");
  document.form1.email.focus();
  return false;
  }
if (document.form1.summary.value==""){
alert("项目说明不能为空!");
document.form1.summary.focus();
return false;
  }
  //document.form1.submit(); 
}

  // 表单提交客户端检测
  function doSubmit(){
document.form1.submit();
}
function PreviewImgSingle(imgFile)
  {
  var picname,prev_picname;
  var newDate = new Date();
prev_picname = newDate.getFullYear() + ""+(newDate.getMonth() + 1) + "" + newDate.getDate() +"" + newDate.getHours() + "" + newDate.getMinutes() + "" + newDate.getSeconds() +"";
  picname =imgFile.value.substring(imgFile.value.lastIndexOf("\\")+1);
  document.getElementById('d_picname').value = prev_picname+picname;
  //alert(prev_picname+picname);
   

  }
</script>
<style type="text/css">
.deliverform
{
width:430px;
font-size:13px; 
color:#000; 
font-family:Microsoft YaHei;
margin-left:auto; 
margin-right:auto;

}
.txtstyle
{
width:110px; 
height:30px;
float:left; 
text-align:left;
}
.framestyle
{
width:300px; 
height:30px;
text-align:left;
float:left;
}
input
{
width:200px;
border:1px solid #999;
}
.upfile
{
width:270px;
border:1px solid #999;
background-color:transparent;
}
.txtarea
{
width:300px; 
text-align:left;
border:0px;
overflow-x: hidden; /*隐藏多行文本框的水平滚动条*/
float:left;
}
</style>
</head>

<body style="background:url(../images/backlogo1.png) no-repeat right bottom;">
<div class="Main_Frame">
  <div class="Head">
  <!--#include file="head.html"-->
  </div>
  <div class="Middle">
  <form name="form1" action="planupload.asp" enctype="multipart/form-data" method="post" target="hidFrame" onsubmit="return doCheck();">
  <div class="deliverform">
  <div class="txtstyle">项目名称:<