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

求助一个C#调用JS代码的例子
最近做一个网站,想用JS实现一个效果,就是点击页面上的按钮,在屏幕正中间弹出一个子窗体,原来的窗体不改变

使用windows.open只能是打开一个新页面,而不是在当前页面前方显示。

不知道有没有人知道怎么实现,谢谢了

------解决方案--------------------
http://www.why.com.cn/epublish/node625/node1202/node1209/userobject7ai12690.html
------解决方案--------------------
有很多js插件的呀,jquery就有很多,像什么colorbox,thickbox这些的都可以
------解决方案--------------------
window.showModalDialog
------解决方案--------------------
样式
<style type="text/css">
.myMessageBox_mark
{

width: 100%;
background: #cccccc;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
-moz-opacity: 0.5;
filter: alpha(opacity=50);
z-index: 99;
height: 100%;
}
.myMessageBox
{

background-color: #ffffff;
text-align: center;
line-height: 20px;
font-size: 12px;
font-weight: bold;
z-index: 999;
width: 200px;
height: 120px;
left: 50%;
top: 50%;
margin-left: -100px !important; /*FF IE7 该值为本身宽的一半 */
margin-top: -60px !important; /*FF IE7 该值为本身高的一半*/
margin-top: 0px;
position: fixed !important; /* FF IE7*/
position: absolute; /*IE6*/
_top: expression(eval(document.compatMode &&
document.compatMode=='CSS1Compat') ?
documentElement.scrollTop + (document.documentElement.clientHeight-this.offsetHeight)/2 :/*IE6*/
document.body.scrollTop + (document.body.clientHeight - this.clientHeight)/2); /*IE5 IE5.5*/
}
</style>

body中的内容

<div id="_myMessageMark" class="myMessageBox_mark">
</div>
<div id="_myMessageDisplay" class="myMessageBox">
<table border="0" cellpadding="0" cellspacing="0" class="myMessageBox_table">
<tr style="height: 25px;">
<td align="left" valign="middle" style="background-color: #87C4EB; font-size: 13px;">
&nbsp;&nbsp;本站提示:
</td>
</tr>
<tr style="height: 60px;">
<td align="center" style="font-size: 13px; font-weight: normal;">
&nbsp;&nbsp; <span id="_myMessageInfo">出错啦!</span>&nbsp;&nbsp;
</td>
</tr>
<tr style="height: 25px;">
<td align="center" valign="middle">
<input id="_myqMessageBoxEnter" type="button" value="关闭" />
</td>
</tr>
</table>
</div>

自己用js代码或者jquery去控制 display就可以了。不一定要在后台调用