解决方案 »
- javascript脚本语言企业开发工具是什么?最好发上截图
- web server 如何实现显示缩略图的功能
- jQuery+css+html
- 初学JavaScript,一个取文本节点值的问题
- javascript 如何获得鼠标位置单击后的屏幕位置(FF&IE)?
- 关于在safari浏览器中 input-file的问题
- js中用DOM模型,读取或修改多个class属性该怎么写啊??在线等---
- with (document.all("oIndex"))iIndex=parseInt(value,10);
- 用js输出的position在IE下不能浮动
- 创建word对象出现错误的问题
- 这段代码哪里有点问题,请高手指点。
- Id为定义 Name未定义
这样的话具体怎么去重写呢、。?//脚本块的内容
strScript = "<script language=javascript>\n";
strScript += string.Format("alert('{0}');\n", msg);
strScript += "</script>";
1.显示一个占据浏览器全部的层(一般设置为半透明)来遮住浏览器模拟模态效果
2.再渲染一个比遮罩更高(z-index更大)的层来显示你的消息内容
//重寫alert
}調用的時候就會調用這個你自定義的了
// if ($("#simpaleMessageDiv").attr("id")=="")
var flag = document.getElementById("simpaleMessageDiv")==null;
if (flag) {
$("BODY").append('<div id="simpaleMessageDiv" style="background-color:yellow"> </div>');
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
$("#simpaleMessageDiv").css({
position: pos,
zIndex: 99999,
padding: 0,
margin: 0
});
$("#simpaleMessageDiv").text(arguments[0]);
var top = 50;
var left = (($(window).width() / 2) - ($("#simpaleMessageDiv").outerWidth() / 2)) + 0;
if( top < 0 ) top = 0;
if( left < 0 ) left = 0;
// IE6 fix
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
$("#simpaleMessageDiv").css({
top: top + 'px',
left: left + 'px'
});
// window.setTimeout(hideSimpleMessage, 3000);
} else {
$("#simpaleMessageDiv").text(arguments[0]);
// $("#simpaleMessageDiv").fadeIn(200);
// clearTimeout();
// window.setTimeout(hideSimpleMessage, 3000);
}
$("#simpaleMessageDiv").fadeIn(200).delay(4000).slideUp(200);
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>联动</title> <script language="javascript" type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script language="JavaScript" type="text/javascript">
$(document).ready(function(){
showSimpleMessage("几秒后消失。");
});function showSimpleMessage() {
// if ($("#simpaleMessageDiv").attr("id")=="")
var flag = document.getElementById("simpaleMessageDiv")==null;
if (flag) {
$("BODY").append('<div id="simpaleMessageDiv" style="background-color:yellow"> </div>');
var pos = ($.browser.msie && parseInt($.browser.version) <= 6 ) ? 'absolute' : 'fixed';
$("#simpaleMessageDiv").css({
position: pos,
zIndex: 99999,
padding: 0,
margin: 0
});
$("#simpaleMessageDiv").text(arguments[0]);
var top = 50;
var left = (($(window).width() / 2) - ($("#simpaleMessageDiv").outerWidth() / 2)) + 0;
if( top < 0 ) top = 0;
if( left < 0 ) left = 0;
// IE6 fix
if( $.browser.msie && parseInt($.browser.version) <= 6 ) top = top + $(window).scrollTop();
$("#simpaleMessageDiv").css({
top: top + 'px',
left: left + 'px'
});
// window.setTimeout(hideSimpleMessage, 3000);
} else {
$("#simpaleMessageDiv").text(arguments[0]);
// $("#simpaleMessageDiv").fadeIn(200);
// clearTimeout();
// window.setTimeout(hideSimpleMessage, 3000);
}
$("#simpaleMessageDiv").fadeIn(200).delay(4000).slideUp(200);
}
</script>
</head>
<body><span id="hiddenId" style="display:none"/>
</body>
</html>
strScript = "<script language=javascript>\n";
strScript += string.Format("alert('{0}');\n", msg);
strScript += "</script>";
拼接字符串然后page.ClientScript.RegisterStartupScript写到前台的那我重写之后的话,怎么调用呢?
重写也得有function XXX来显示div吧,注册js的时候不调用alert了,调用xxx不就行了