我在aspx页面上这样插入了一段脚本:
<script src=js/JScript1.js></script>。Script1.js文件如下:function showInfo()//展示div
{
document.getElementById("info").style.display="block";
document.getElementById("butShow").disabled=true;
}function close()//关闭
{
document.getElementById("info").style.display="none";
document.getElementById("butShow").disabled=false;
}function nowClear()//清空信息
{
document.getElementById("txtTitle").value="";
document.getElementById("txtName").value="";
document.getElementById("txtContent").value="";
document.getElementById("txtFrom").value="";
}
function save()//提交信息
{
//验证信息完整
if(document.getElementById("txtTitle").value=="")
{
alert("请输入标题!");
return;
}
if(document.getElementById("txtContent").value=="")
{
alert("您还没有输入内容。");
return;
}
/*
在这里添加保存信息的代码
*/
nowClear();//清空信息
close();//关闭div
}最后出现2个问题,1.我的js脚本的一些函数执行完了程序却回发又调用page_load(),为什么?
2.几个alert弹出框为什么都不能正常的弹出中文?都是乱码。
请高手指点,问题解决马上给分。在线等。
<script src=js/JScript1.js></script>。Script1.js文件如下:function showInfo()//展示div
{
document.getElementById("info").style.display="block";
document.getElementById("butShow").disabled=true;
}function close()//关闭
{
document.getElementById("info").style.display="none";
document.getElementById("butShow").disabled=false;
}function nowClear()//清空信息
{
document.getElementById("txtTitle").value="";
document.getElementById("txtName").value="";
document.getElementById("txtContent").value="";
document.getElementById("txtFrom").value="";
}
function save()//提交信息
{
//验证信息完整
if(document.getElementById("txtTitle").value=="")
{
alert("请输入标题!");
return;
}
if(document.getElementById("txtContent").value=="")
{
alert("您还没有输入内容。");
return;
}
/*
在这里添加保存信息的代码
*/
nowClear();//清空信息
close();//关闭div
}最后出现2个问题,1.我的js脚本的一些函数执行完了程序却回发又调用page_load(),为什么?
2.几个alert弹出框为什么都不能正常的弹出中文?都是乱码。
请高手指点,问题解决马上给分。在线等。
2.需要设置一下web.config
<globalization requestEncoding="gb2312" responseEncoding="gb2312"/>
这样试试看行不?
culture="zh-CN"
requestEncoding="gb2312"
responseEncoding="gb2312"
/>可是第一个问题还没有,我把<script src=js/JScript1.js></script>放到<head></head>里面也不行。是不是因为我的调用的控件都放在form里面了?可是只能放在这里啊。
调用时,用return save();等等
button.Attribute.Add("onclick","nowClear();return false;");
谢谢2位!