首先要导入jQuery(如:jquery-1.3.2.min.js)的包和弹出框所需的JS包(dialog.js),并添加JS指定需要的图片路径(图片和要用到的JS包都放到了网盘里,网盘地址: http://e.ys168.com/?rememberxing的ASP.NET相关附件目录里面)
<
script type
=
"
text/javascript
"
>
var CONTEXTPATH = " img/ " ; // 设置图片路径
< / script>
var CONTEXTPATH = " img/ " ; // 设置图片路径
< / script>
弹出JS:
Code
<script type="text/javascript">
//弹出窗口
function WindowOpen(id, title, url, property) {
var diag = new Dialog("Diag2");
diag.Width = 600;
diag.Height = 400;
diag.Title = title;
diag.URL = url + encodeURIComponent($("#" + id).val());
diag.OKEvent = function() {
$("#" + id).val($(getPopup('Diag2')).find("#dataList tr.selected").attr(property));
diag.close();//关闭弹出窗
$("#" + id).focus();
}; //点击确定后调用的方法
diag.show();
}
</script>
<script type="text/javascript">
//弹出窗口
function WindowOpen(id, title, url, property) {
var diag = new Dialog("Diag2");
diag.Width = 600;
diag.Height = 400;
diag.Title = title;
diag.URL = url + encodeURIComponent($("#" + id).val());
diag.OKEvent = function() {
$("#" + id).val($(getPopup('Diag2')).find("#dataList tr.selected").attr(property));
diag.close();//关闭弹出窗
$("#" + id).focus();
}; //点击确定后调用的方法
diag.show();
}
</script>
在点击事件中设置下对应的属性就可以啦
<
input type
=
"
button
"
id
=
"
btntest
"
onclick
=
'
WindowOpen("btntest", "Test", "Default.aspx", "id")
'
value
=
"
Click
"
/>
只有不断的记录才能不被时间冲洗得太多。