用div模拟 想来想去,也只想到showModalDialog 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 try<JScript code<script type='text/javascript'>window.confirm=myConfirm;/*重写Confirm*/function myConfirm(info,f){ /*div 美化的Confrm*/eval(f); }</script>这么调用 <button onClick="confirm('测试!','alert(\"alert!\")');"> test3 </button> 测试可以:<script type='text/javascript'> window.confirm=myConfirm; /* 重写Confirm */ function myConfirm(info,f) { alert(info); /*div 美化的Confrm*/ eval(f); } </script> 这么调用 <button onClick=confirm('测试!','alert("alert!")');> test3 </button> <script type='text/javascript'>window.confirm=myConfirm;function myConfirm(info){ return true;}</script><button onClick="if(confirm('测试')){alert('Hello');}">test3</button> 难道就没有办法作得跟真正的confirm一样的阻塞效果吗?? 这个你试试,我这里试可以的。 <script type='text/javascript'> window.confirm=myConfirm; /* 重写Confirm */ function myConfirm(info,f) { alert(info); /*div 美化的Confrm*/ eval(f); } </script> 这么调用 <button onClick=confirm('测试!','alert("alert!")');> test3 </button> 你是想 用div 模拟 confirm吧 那就丢弃 原来的 confirm完全自己实现一个 很简单的.风格 可以随便改我找一会代码 这个你试试,我这里试可以的。 JScript code <script type='text/javascript'> window.confirm=myConfirm; /* 重写Confirm */ function myConfirm(info,f) { alert(info); /*div 美化的Confrm*/ eval(f); //这里可以不用立即执行,在你的选择执行完后加进去.} </script> 这么调用 <button onClick=confirm('测试!','alert("alert!")');> test3 </button> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>模拟--myConfirm</title><style type="text/css"><!--body, td, th { font-family: Arial, 宋体; font-size: 12px;}.webWinFrame { position: absolute; left:15px; top:15px; padding: 3px; background-color: #EEEEEE;}.webWin { width: 300px; border: 1px solid #80C65A; background-color: #FFFFFF;}.webWin .wTitle{ line-height: 18px; padding: 2px; padding-left:8px; font-weight: bold; cursor:move; background-color: #DDF8CC; /*display:inline-block;*/ white-space: nowrap; overflow:hidden; text-overflow:ellipsis}.webWin .wContent { overflow:hidden; text-align:center; padding-top:10px;}.webWin .wResizeBox { background-color: #80C65A; height: 5px; width: 5px; position: absolute; right: 5px; bottom: 5px; overflow:hidden; cursor:se-resize;}body { margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px;}button {border: 1px solid #80C65A;background:#DDF8CC;margin:5px;}--></style></head><script type="text/javascript">window.$ = function(obj){return (document.getElementById)?document.getElementById(obj):(document.all)?document.all[obj]:obj}window.isIE = window.Event?false:true;window.getMouseCoords=function(e){return {x:isIE?e.clientX+Math.max(document.body.scrollLeft, document.documentElement.scrollLeft):e.pageX, y:isIE?e.clientY+Math.max(document.body.scrollTop, document.documentElement.scrollTop):e.pageY};}window.vWinZIndex = 1;function vDrag(o,ho,initArr){ ho=ho||o; o.style.position="absolute"; if(!isIE){ho.firstChild.onmousedown=function(){return false;}} ho.onmousedown=function(a){ o.style.zIndex = window.vWinZIndex; window.vWinZIndex++; var d=document;if(!a)a=window.event; var x=a.layerX?a.layerX:a.offsetX,y=a.layerY?a.layerY:a.offsetY; if(ho.setCapture) ho.setCapture(); else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); d.onmousemove=function(a){ if(!a)a=window.event; var mus=getMouseCoords(a) if(!a.pageX)a.pageX=mus.x; if(!a.pageY)a.pageY=mus.y; var tx=a.pageX-x,ty=a.pageY-y; if(initArr){ o.style.left=(tx<initArr[0]?initArr[0]:tx>initArr[2]?initArr[2]:tx)+"px"; o.style.top=(ty<initArr[1]?initArr[1]:ty>initArr[3]?initArr[3]:ty)+"px"; }else{ o.style.left = tx+"px"; o.style.top = ty+"px"; } }; d.onmouseup=function(){ if(ho.releaseCapture) ho.releaseCapture(); else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); d.onmousemove=null; d.onmouseup=null; }; };}function createWebWindow(o,intW,intH){ o.style.zIndex = window.vWinZIndex; window.vWinZIndex++; var winSelf = o.childNodes[0]; var winTitle = o.childNodes[0].childNodes[0]; var winContent = o.childNodes[0].childNodes[1]; var winDbox = o.childNodes[0].childNodes[2]; var minW =50,minH = 40; var _self = this; // var wX = winSelf.offsetWidth-winContent.offsetWidth; var wH = winSelf.offsetHeight-winContent.offsetHeight; // winDbox.onmousedown = function(e){ o.style.zIndex = window.vWinZIndex; window.vWinZIndex++; var d=document;if(!e)e=window.event; var x=e.layerX?e.layerX:e.offsetX,y=e.layerY?e.layerY:e.offsetY; var MCD=window.getMouseCoords(e) winSelf.startX=MCD.x; winSelf.startY=MCD.y; winSelf.startW=winSelf.offsetWidth; winSelf.startH=winSelf.offsetHeight; // if(winDbox.setCapture) winDbox.setCapture(); else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); d.onmousemove =function(e){ if(!e)e=window.event; var mus=getMouseCoords(e) var newW = (winSelf.startW +(mus.x-winSelf.startX)); var newH = (winSelf.startH +(mus.y-winSelf.startY)) resizeWin(newW,newH); } d.onmouseup=function(){ if(winDbox.releaseCapture) winDbox.releaseCapture(); else if(window.captureEvents) window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP); d.onmousemove=null; d.onmouseup=null; } } function resizeWin(newW,newH){ newW = newW < minW?minW:newW; newH = newH < minH?minH:newH; winSelf.style.width = newW+"px"; winSelf.style.height = newH+"px"; // winTitle.style.width = isIE?newW+"px":(newW-4)+"px"; // winContent.style.width = (newW-wX)+"px"; winContent.style.height = (newH-wH)+"px"; } { resizeWin(intW,intH); vDrag(o,winTitle); }}function myConfirm(title,content) { createWebWindow($("testWinA"),300,75); $("testWinA").style.display=""; content=content+"<br /><button name='B3' onclick='alert(\"你点击了确定 你也可以用这个模拟 alert\")'>确定</button> <button name='B4' onclick='alert(\"你点击了关闭 你也可以用这个模拟 alert\");$(\"testWinA\").style.display=\"none\"'>关闭</button>"; document.getElementById("wTitle").innerHTML=title; document.getElementById("iContent").innerHTML=content;} function myAlert(title,content) { alert("你点击了确定 你也可以用这个模拟 alert")}//myConfirm("aaa","bbb"); </script><body><div class="webWinFrame" id="testWinA" style="display:none;"><div class="webWin"><div class="wTitle" id="wTitle">TitleA-ViboStudio</div><div class="wContent" id="iContent"></div><div class="wResizeBox"></div></div></div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>这里 对 居中 那些排版 你自己考虑了<br><br><button name="B3" onclick="myConfirm('Confirm的标题','Confirm的提示内容 需要图片图标 自己在旁边添加.');">弹出 myConfirm</button><a href="http://wood-son.com/">http://wood-son.com/</a></body></html> 百撕不得其姐啊,请大侠看看这段代码什么意思!!!!!! JavaScript导出页面数据到excel中能否设置sheet名? frame里的页面有个alert,如何在frame外阻止alert事件呢? js控制播放文件列表 请问ID和name有什么区别? 怎样在搜狗地图上同时显示多个infowindow 请问三级关联菜单的做法 简单的问题 图片放大 页面上的Treeview 问题,各位大侠帮忙啦!!! span class 提问 遮罩层的一个BUG问题.
<JScript code<script type='text/javascript'>
window.confirm=myConfirm;
/*
重写Confirm
*/
function myConfirm(info,f)
{
/*div 美化的Confrm*/
eval(f);
}
</script>这么调用
<button onClick="confirm('测试!','alert(\"alert!\")');"> test3 </button>
<script type='text/javascript'>
window.confirm=myConfirm;
/*
重写Confirm
*/
function myConfirm(info,f)
{
alert(info);
/*div 美化的Confrm*/
eval(f);
}
</script>
这么调用
<button onClick=confirm('测试!','alert("alert!")');> test3 </button>
window.confirm=myConfirm;
function myConfirm(info)
{
return true;
}
</script>
<button onClick="if(confirm('测试')){alert('Hello');}">test3</button>
<script type='text/javascript'>
window.confirm=myConfirm;
/*
重写Confirm
*/
function myConfirm(info,f)
{
alert(info);
/*div 美化的Confrm*/
eval(f);
}
</script>
这么调用
<button onClick=confirm('测试!','alert("alert!")');> test3 </button>
那就丢弃 原来的 confirm
完全自己实现一个 很简单的.
风格 可以随便改
我找一会代码
<script type='text/javascript'>
window.confirm=myConfirm;
/*
重写Confirm
*/
function myConfirm(info,f)
{
alert(info);
/*div 美化的Confrm*/
eval(f); //这里可以不用立即执行,在你的选择执行完后加进去.
}
</script>
这么调用
<button onClick=confirm('测试!','alert("alert!")');> test3 </button>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>模拟--myConfirm</title>
<style type="text/css">
<!--
body, td, th {
font-family: Arial, 宋体;
font-size: 12px;
}
.webWinFrame {
position: absolute;
left:15px;
top:15px;
padding: 3px;
background-color: #EEEEEE;
}
.webWin {
width: 300px;
border: 1px solid #80C65A;
background-color: #FFFFFF;
}
.webWin .wTitle{
line-height: 18px;
padding: 2px;
padding-left:8px;
font-weight: bold;
cursor:move;
background-color: #DDF8CC;
/*display:inline-block;*/
white-space: nowrap;
overflow:hidden;
text-overflow:ellipsis
}
.webWin .wContent {
overflow:hidden;
text-align:center;
padding-top:10px;
}
.webWin .wResizeBox {
background-color: #80C65A;
height: 5px;
width: 5px;
position: absolute;
right: 5px;
bottom: 5px;
overflow:hidden;
cursor:se-resize;
}
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
button {border: 1px solid #80C65A;background:#DDF8CC;margin:5px;}
-->
</style>
</head>
<script type="text/javascript">
window.$ = function(obj){return (document.getElementById)?document.getElementById(obj):(document.all)?document.all[obj]:obj}
window.isIE = window.Event?false:true;
window.getMouseCoords=function(e){return {x:isIE?e.clientX+Math.max(document.body.scrollLeft, document.documentElement.scrollLeft):e.pageX, y:isIE?e.clientY+Math.max(document.body.scrollTop, document.documentElement.scrollTop):e.pageY};}
window.vWinZIndex = 1;
function vDrag(o,ho,initArr){
ho=ho||o;
o.style.position="absolute";
if(!isIE){ho.firstChild.onmousedown=function(){return false;}}
ho.onmousedown=function(a){
o.style.zIndex = window.vWinZIndex;
window.vWinZIndex++;
var d=document;if(!a)a=window.event;
var x=a.layerX?a.layerX:a.offsetX,y=a.layerY?a.layerY:a.offsetY;
if(ho.setCapture)
ho.setCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove=function(a){
if(!a)a=window.event;
var mus=getMouseCoords(a)
if(!a.pageX)a.pageX=mus.x;
if(!a.pageY)a.pageY=mus.y;
var tx=a.pageX-x,ty=a.pageY-y;
if(initArr){
o.style.left=(tx<initArr[0]?initArr[0]:tx>initArr[2]?initArr[2]:tx)+"px";
o.style.top=(ty<initArr[1]?initArr[1]:ty>initArr[3]?initArr[3]:ty)+"px";
}else{
o.style.left = tx+"px";
o.style.top = ty+"px";
}
};
d.onmouseup=function(){
if(ho.releaseCapture)
ho.releaseCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove=null;
d.onmouseup=null;
};
};
}
function createWebWindow(o,intW,intH){
o.style.zIndex = window.vWinZIndex;
window.vWinZIndex++;
var winSelf = o.childNodes[0];
var winTitle = o.childNodes[0].childNodes[0];
var winContent = o.childNodes[0].childNodes[1];
var winDbox = o.childNodes[0].childNodes[2];
var minW =50,minH = 40;
var _self = this;
//
var wX = winSelf.offsetWidth-winContent.offsetWidth;
var wH = winSelf.offsetHeight-winContent.offsetHeight;
//
winDbox.onmousedown = function(e){
o.style.zIndex = window.vWinZIndex;
window.vWinZIndex++;
var d=document;if(!e)e=window.event;
var x=e.layerX?e.layerX:e.offsetX,y=e.layerY?e.layerY:e.offsetY;
var MCD=window.getMouseCoords(e)
winSelf.startX=MCD.x;
winSelf.startY=MCD.y;
winSelf.startW=winSelf.offsetWidth;
winSelf.startH=winSelf.offsetHeight;
//
if(winDbox.setCapture)
winDbox.setCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove =function(e){
if(!e)e=window.event;
var mus=getMouseCoords(e)
var newW = (winSelf.startW +(mus.x-winSelf.startX));
var newH = (winSelf.startH +(mus.y-winSelf.startY))
resizeWin(newW,newH);
}
d.onmouseup=function(){
if(winDbox.releaseCapture)
winDbox.releaseCapture();
else if(window.captureEvents)
window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
d.onmousemove=null;
d.onmouseup=null;
}
}
function resizeWin(newW,newH){
newW = newW < minW?minW:newW;
newH = newH < minH?minH:newH;
winSelf.style.width = newW+"px";
winSelf.style.height = newH+"px";
//
winTitle.style.width = isIE?newW+"px":(newW-4)+"px";
//
winContent.style.width = (newW-wX)+"px";
winContent.style.height = (newH-wH)+"px";
}
{
resizeWin(intW,intH);
vDrag(o,winTitle);
}
}
function myConfirm(title,content)
{
createWebWindow($("testWinA"),300,75);
$("testWinA").style.display="";
content=content+"<br /><button name='B3' onclick='alert(\"你点击了确定 你也可以用这个模拟 alert\")'>确定</button> <button name='B4' onclick='alert(\"你点击了关闭 你也可以用这个模拟 alert\");$(\"testWinA\").style.display=\"none\"'>关闭</button>";
document.getElementById("wTitle").innerHTML=title;
document.getElementById("iContent").innerHTML=content;
} function myAlert(title,content) {
alert("你点击了确定 你也可以用这个模拟 alert")
}//myConfirm("aaa","bbb");
</script>
<body>
<div class="webWinFrame" id="testWinA" style="display:none;"><div class="webWin"><div class="wTitle" id="wTitle">TitleA-ViboStudio</div><div class="wContent" id="iContent">
</div><div class="wResizeBox"></div></div></div><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
这里 对 居中 那些排版 你自己考虑了<br><br>
<button name="B3" onclick="myConfirm('Confirm的标题','Confirm的提示内容 需要图片图标 自己在旁边添加.');">弹出 myConfirm</button><a href="http://wood-son.com/">http://wood-son.com/</a></body>
</html>