日期:2014-05-16  浏览次数:20348 次

极品问题,大家来找茬!
为什么传值传不了?
a.aspx:
<script   language= "javascript ">
function   showmodule()
{

var   Person_ID=   window.showModalDialog( "SearchPerson.aspx "   , 'popupWindow ',   "dialogHeight:548px;dialogWidth:700px;center:yes;status:no;resizable:no; ");  
var   Person_IDTxt=document.getElementById( 'Person_IDTxt ').innerText;
Person_IDTxt=Person_ID;
}
</script>
SearchPerson.aspx:
function   SetVal()
{
var   Person_ID   =   document.getElementById( 'Personlbl ').innerText;
    window.returnValue=Person_ID;
    close();
}
  <asp:Label   ID= "Personlbl "   Text= "1 "   Visible= "false "   runat= "server "> </asp:Label>

------解决方案--------------------
var Person_IDTxt=document.getElementById( 'Person_IDTxt ').innerText;
Person_IDTxt=Person_ID;

这样是什么意思?你是想改变innerText的值吧?你这样只赋值Person_IDTxt变量
------解决方案--------------------
还有个问题,asp.net里面,服务器控件加了Visible= "false "后在浏览器就不存在了,而不是隐藏,所以var Person_ID = document.getElementById( 'Personlbl ').innerText;这里也会出错