asp.net 中应用javascript问题. (对我来说,实在太郁闷了.找了两天的答案)在线等!QQ450787172
我在GRIDVIEW有这么一个列:
<asp:TemplateField>
<ItemTemplate>
<a href= 'javascript:window.open( "ModifyAudit.aspx?userid= <%# Eval( "Userid ")%> ", " ",
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=300,top=30,width=450,height=640 "); ' target= "_blank ">
<%# Eval( "audit ").ToString()== "0 "? "未审核 ":(Eval( "audit ").ToString()== "1 "? "已通过审核 ": "黑名单 ") %> </a>
</ItemTemplate>
</asp:TemplateField> --%>
我运行的时候可以通过.
不过多了一个页面出来!地址栏为:
javascript:window.open( "ModifyAudit.aspx?userid=25136 ", " ", "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=300,top=30,width=450,height=640 ");
页面内容为[object]
然后还有一个想要的要面已经可以得到!
[解决办法]
'javascript:window.open( "ModifyAudit.aspx?userid= <%# Eval( "Userid ")%> ", " ",
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=300,top=30,width=450,height=640 ");
这个返回本来就是一个打开窗口对象
<a href= '[object] '
这样肯定错误的
[解决办法]
或者,2个多试试
<a href= ' <%# "javascript:window.open(\ "ModifyAudit.aspx?userid= " + Eval( "Userid ") .ToString() + "\ ",\ "\ ",\ "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=300,top=30,width=450,height=640\ " "%> '>
[解决办法]
<a href= "# " onclick= 'javascript:window.open( "ModifyAudit.aspx?userid= <%# Eval( "Userid ")%> ", " ",
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=300,top=30,width=450,height=640 "); '>
<%# Eval( "audit ").ToString()== "0 "? "未审核 ":(Eval( "audit ").ToString()== "1 "? "已通过审核 ": "黑名单 ") %> </a>
[解决办法]
<a href= 'javascript:void(window.open( "ModifyAudit.aspx?userid= <%# Eval( "Userid ")%> ", " ",
"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,left=300,top=30,width=450,height=640 ")); ' target= "_blank ">
<%# Eval( "audit ").ToString()== "0 "? "未审核 ":(Eval( "audit ").ToString()== "1 "? "已通过审核 ": "黑名单 ") %> </a>
或 <a href= "void(0) " onclick= 'javascript:window.open(... '