这个页面是自己做的类似动易后台在文章中加关键字的页面
点击父窗体的更多
通过url传值,将值放入文本框
这个时候文本框里面的文字还没有问题
只要在添加关键词的那个页面点击了翻页
文本框里面的文字全部变为乱码
本地测试不出是什么问题
服务器上又不知道是哪儿出了问题 郁闷 翻页前的html(翻页控件用的)AspNetPager.dll
<!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 id="Head1"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>
选择对话框
</title>
<style type="text/css">
*
{
margin: 0px;
padding: 0px;
}
.content
{
width: 559px;
margin: 0px auto 0px auto;
}
.msgbox1
{
border: 1px solid #449AE8;
background-color: #F0F0F0;
}
.msgbox1 h1
{
background-color: #449AE8;
font-size: 12px;
color: White;
line-height: 24px;
vertical-align: middle;
padding-left: 3px;
padding-top: 0px;
}
.return
{
font-size: 12px;
float: right;
padding: 5px 5px 0px 0px;
cursor:pointer;
}
#txtkeyword
{
width: 360px;
margin-left: 3px;
font-size: 12px;
}
.button
{
height: 20px;
font-size: 12x;
}
#Button1
{
margin-left: 20px;
}
.msgbox2
{
border: 1px solid #449AE8;
background-color: #F0F0F0;
margin-top: 20px;
position: relative;
}
.msgbox2 .search
{
position: absolute;
right: 10px;
top: 1px;
}
.msgbox2 h1
{
background-color: #449AE8;
font-size: 12px;
color: White;
line-height: 24px;
vertical-align: middle;
padding-left: 3px;
padding-top: 0px;
}
.msgbox2 .list
{
background-color: White;
font-size: 12px;
padding-left: 20px;
line-height: 20px;
min-height: 80px;
}
.msgbox2 .list span
{
padding-right: 15px;
cursor: pointer;
}
.msgbox2 .list span:hover
{
color: #FF6600;
}
.msgbox2 .add_all
{
text-align: center;
font-size: 12px;
line-height: 24px;
}
.msgbox2 .add_all span
{
cursor: pointer;
}
.msgbox2 .add_all span:hover
{
color: #FF6600;
}
.font_red
{
color: #FF0000;
}
.pager
{
text-align: right;
}
.pager a
{
color: Black;
font-size: 12px;
text-decoration: none;
padding-left: 5px;
}
</style>
<script type="text/javascript">
function addWord(word,IsShowBox)
{
var txtkeyword = document.getElementById("txtkeyword");
var currentValue = txtkeyword.value;
var values = currentValue.split('|');
for(var i = 0;i< values.length;i++)
{
if (word ==values[i] )
{
if (IsShowBox)
{
alert(""+word+" 关键字已经存在,此操作已忽略!");
}
return;
}
}
if (currentValue!="")
{
txtkeyword.value = currentValue+"|"+word;
}
else
{
txtkeyword.value = word;
}
opener.addWord(word,false);
}
function removeAll()
{
var txtkeyword = document.getElementById("txtkeyword");
txtkeyword.value = "";
opener.removeAll();
}
function removeLast()
{
var reg=new RegExp("(\\|?([^\\|]*?))$","g");
var txtkeyword = document.getElementById("txtkeyword");
txtkeyword.value = txtkeyword.value.replace(reg,"");
opener.removeLast();
}
function addAll()
{
var list = document.getElementById("list");
var spans = list.getElementsByTagName("span");
for(var j = 0;j<spans.length;j++)
{
addWord(spans[j].innerHTML,false);
opener.addWord(spans[j].innerHTML,false);
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="/Admin/append/openwindow.aspx?value=鍖椾含JAVA鍩硅|JAVA鍩硅" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTExNzM0NjA4NjMPZBYCAgMQZGQWBAIHDxYCHgtfIUl0ZW1Db3VudAIFFgoCAQ9kFgJmDxUBEuW+rui9r+iupOivgeiAg+ivlWQCAg9kFgJmDxUBEua0u+WKqOebruW9lei/geenu2QCAw9kFgJmDxUBEua0u+WKqOebruW9leaBouWkjWQCBA9kFgJmDxUBFW9yYWNsZeaVsOaNruW6k+WfueiurWQCBQ9kFgJmDxUBEE9yYWNsZSBkYmHln7norq1kAgkPDxYCHgtSZWNvcmRjb3VudAIIZGRkDOjXMDY1gHPOZICP6yHxK14T9rk=" />
</div>
<div class="content">
<div class="msgbox1">
<div class="return" onclick="window.close()">
返回>></div>
<h1>
已经选定的关键字:</h1>
<input name="txtkeyword" type="text" value="北京JAVA培训|JAVA培训" id="txtkeyword" class="text" />
<input id="Button1" type="button" value="删除最后" class="button" onclick="removeLast()" />
<input id="Button2" type="button" value="删除全部" onclick="removeAll()" class="button" />
</div>
<div class="msgbox2">
<h1>
<font class="font_red">关键字</font>列表:</h1>
<div class="search">
<input name="txtSearch" type="text" id="txtSearch" />
<input type="submit" name="btnSearch" value="查找" id="btnSearch" class="button" />
</div>
<div class="list" id="list">
<span onclick="addWord(this.innerHTML,true)">微软认证考试</span>
<span onclick="addWord(this.innerHTML,true)">活动目录迁移</span>
<span onclick="addWord(this.innerHTML,true)">活动目录恢复</span>
<span onclick="addWord(this.innerHTML,true)">oracle数据库培训</span>
<span onclick="addWord(this.innerHTML,true)">Oracle dba培训</span>
</div>
<div class="add_all">
<span onclick="addAll()">增加以上所有关键字</span>
</div>
<div id="AspNetPager1" class="pager">
<a disabled="true">首页</a><span style="width:5px;"></span><a disabled="true">上一页</a><span style="width:5px;"></span><font style="font-weight:Bold;color:red;">1</font><span style="width:5px;"></span><a class="pager" title="转到第2页" href="javascript:__doPostBack('AspNetPager1','2')">2</a><span style="width:5px;"></span><a class="pager" title="转到第2页" href="javascript:__doPostBack('AspNetPager1','2')">下一页</a><span style="width:5px;"></span><a class="pager" title="转到第2页" href="javascript:__doPostBack('AspNetPager1','2')">尾页</a><span style="width:5px;"></span>
</div>
</div>
</div>
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBAKP0s70CAK+sdP5DwKZ7YzdCgKln/PuCp1UAynNAhM7lr/8hSq3uzDCcbSC" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
</form>
<script type="text/javascript">
var thisurl = window.location.href;
var txtkeyword = document.getElementById("txtkeyword");
txtkeyword.value = thisurl.split('=')[1];
</script>
</body>
</html>
Code
<!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 id="Head1"><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>
选择对话框
</title>
<style type="text/css">
*
{
margin: 0px;
padding: 0px;
}
.content
{
width: 559px;
margin: 0px auto 0px auto;
}
.msgbox1
{
border: 1px solid #449AE8;
background-color: #F0F0F0;
}
.msgbox1 h1
{
background-color: #449AE8;
font-size: 12px;
color: White;
line-height: 24px;
vertical-align: middle;
padding-left: 3px;
padding-top: 0px;
}
.return
{
font-size: 12px;
float: right;
padding: 5px 5px 0px 0px;
cursor:pointer;
}
#txtkeyword
{
width: 360px;
margin-left: 3px;
font-size: 12px;
}
.button
{
height: 20px;
font-size: 12x;
}
#Button1
{
margin-left: 20px;
}
.msgbox2
{
border: 1px solid #449AE8;
background-color: #F0F0F0;
margin-top: 20px;
position: relative;
}
.msgbox2 .search
{
position: absolute;
right: 10px;
top: 1px;
}
.msgbox2 h1
{
background-color: #449AE8;
font-size: 12px;
color: White;
line-height: 24px;
vertical-align: middle;
padding-left: 3px;
padding-top: 0px;
}
.msgbox2 .list
{
background-color: White;
font-size: 12px;
padding-left: 20px;
line-height: 20px;
min-height: 80px;
}
.msgbox2 .list span
{
padding-right: 15px;
cursor: pointer;
}
.msgbox2 .list span:hover
{
color: #FF6600;
}
.msgbox2 .add_all
{
text-align: center;
font-size: 12px;
line-height: 24px;
}
.msgbox2 .add_all span
{
cursor: pointer;
}
.msgbox2 .add_all span:hover
{
color: #FF6600;
}
.font_red
{
color: #FF0000;
}
.pager
{
text-align: right;
}
.pager a
{
color: Black;
font-size: 12px;
text-decoration: none;
padding-left: 5px;
}
</style>
<script type="text/javascript">
function addWord(word,IsShowBox)
{
var txtkeyword = document.getElementById("txtkeyword");
var currentValue = txtkeyword.value;
var values = currentValue.split('|');
for(var i = 0;i< values.length;i++)
{
if (word ==values[i] )
{
if (IsShowBox)
{
alert(""+word+" 关键字已经存在,此操作已忽略!");
}
return;
}
}
if (currentValue!="")
{
txtkeyword.value = currentValue+"|"+word;
}
else
{
txtkeyword.value = word;
}
opener.addWord(word,false);
}
function removeAll()
{
var txtkeyword = document.getElementById("txtkeyword");
txtkeyword.value = "";
opener.removeAll();
}
function removeLast()
{
var reg=new RegExp("(\\|?([^\\|]*?))$","g");
var txtkeyword = document.getElementById("txtkeyword");
txtkeyword.value = txtkeyword.value.replace(reg,"");
opener.removeLast();
}
function addAll()
{
var list = document.getElementById("list");
var spans = list.getElementsByTagName("span");
for(var j = 0;j<spans.length;j++)
{
addWord(spans[j].innerHTML,false);
opener.addWord(spans[j].innerHTML,false);
}
}
</script>
</head>
<body>
<form name="form1" method="post" action="/Admin/append/openwindow.aspx?value=閸栨ぞ鍚獼AVA閸╃顔剕JAVA閸╃顔" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTExNzM0NjA4NjMPZBYCAgMQZGQWBAIHDxYCHgtfIUl0ZW1Db3VudAIEFggCAQ9kFgJmDxUBEE9yYWNsZSBkYmHln7norq1kAgIPZBYCZg8VARJXaW5kb3dzIDIwMDPnvqTpm4ZkAgMPZBYCZg8VAQpKQVZB5Z+56K6tZAIED2QWAmYPFQEQ5YyX5LqsSkFWQeWfueiurWQCCQ8PFgQeEEN1cnJlbnRQYWdlSW5kZXgCAh4LUmVjb3JkY291bnQCCGRkZEukkmlKS+OZqxISBk3mzyt12jtu" />
</div>
<div class="content">
<div class="msgbox1">
<div class="return" onclick="window.close()">
返回>></div>
<h1>
已经选定的关键字:</h1> <input name="txtkeyword" type="text" value="北京JAVA培训|JAVA培训" id="txtkeyword" class="text" />
<input id="Button1" type="button" value="删除最后" class="button" onclick="removeLast()" />
<input id="Button2" type="button" value="删除全部" onclick="removeAll()" class="button" />
</div>
<div class="msgbox2">
<h1>
<font class="font_red">关键字</font>列表:</h1>
<div class="search">
<input name="txtSearch" type="text" id="txtSearch" />
<input type="submit" name="btnSearch" value="查找" id="btnSearch" class="button" />
</div>
<div class="list" id="list">
<span onclick="addWord(this.innerHTML,true)">Oracle dba培训</span>
<span onclick="addWord(this.innerHTML,true)">Windows 2003群集</span>
<span onclick="addWord(this.innerHTML,true)">JAVA培训</span>
<span onclick="addWord(this.innerHTML,true)">北京JAVA培训</span>
</div>
<div class="add_all">
<span onclick="addAll()">增加以上所有关键字</span>
</div>
<div id="AspNetPager1" class="pager">
<a class="pager" title="转到第1页" href="javascript:__doPostBack('AspNetPager1','1')">首页</a><span style="width:5px;"></span><a class="pager" title="转到第1页" href="javascript:__doPostBack('AspNetPager1','1')">上一页</a><span style="width:5px;"></span><a class="pager" title="转到第1页" href="javascript:__doPostBack('AspNetPager1','1')">1</a><span style="width:5px;"></span><font style="font-weight:Bold;color:red;">2</font><span style="width:5px;"></span><a disabled="true">下一页</a><span style="width:5px;"></span><a disabled="true">尾页</a><span style="width:5px;"></span>
</div>
</div>
</div>
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWBAKTwoulBgK+sdP5DwKZ7YzdCgKln/PuCsnGuWdXn3xScsa2xtpLm8qI5Qsc" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['form1'];
if (!theForm) {
theForm = document.form1;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
</form>
<script type="text/javascript">
var thisurl = window.location.href;
var txtkeyword = document.getElementById("txtkeyword");
txtkeyword.value = thisurl.split('=')[1];
</script>
</body>
</html>
翻页前查看源文件
<input name="txtkeyword" type="text" value="北京JAVA培训|JAVA培训" id="txtkeyword" class="text" />
浏览器显示 北京JAVA培训|JAVA培训
翻页后查看 源文件
<input name="txtkeyword" type="text" value="北京JAVA培训|JAVA培训" id="txtkeyword" class="text" />
浏览器显示 鍖椾含JAVA鍩硅|JAVA鍩硅
这个问题应该是AspNetPager.dll控件自身的问题!建议更新该控件到最新版本,应该就可以解决此问题。
目前你可以使用英文字母或者数字来测试一下应该就能知道他的编码, 一般来说AspNetPager.dll控件会自动对你传入的参数进行编码,为了验证说法的可靠性你可以调试获取一下传入的参数就能看出来,这个是由于AspNetPager.dll本身造成的,所以我建议你更新到最新版本。
应该是字符集的问题,一个是UTF-8 一个是 GB2312
escape() unescape()
转义?、
我用这个控件好象还没遇到过这种问题....
URL地址编码下试试看