系统弹出窗口的时候能否让确定、取消的按钮自定义呢?例如换成yes\no??<form name="form1" action="http://cn.yahoo.com">
<input type="button" value="删除" onclick="javascript:if(confirm('确定删除?')){submit()}" />
</from>
解决方案 »
- |zyciis| window.parent.frames[0] 在FireFox中要怎么写呢,谢谢
- 一种打断被闭包引入的循环引用的窍门是添加另外一个闭包,应该如何理解?
- innerHTML怪问题
- 帮忙该几行代码,我有点晕~~~~~~~~~~~
- 如何将汉字转化为16进制数
- 关于parent对象的问题
- <script language='javascript'>window.location.href = './aaa/index.htm'</script>为什么在2000系统下不执行
- 一个日期问题!
- javascript 读文件的问题?
- 在javascript代码中嵌套html标签,如何在html标签中的事件里面输出指定的字符串呢?代码如下:
- 求一个js无缝滚动的简单点的代码,thanks very much!
- 如何知道用户处于那一页
好像不能~·confirm是根据浏览器语言定义的~·你浏览器要是英文的那就弹出yes/no要不你就用层写个模拟~·
原理很简单,底下一个 div 做遮罩,上面一个 div 做提示框,至于按钮样式可以完全随心所欲!俺参考以下代码实现了自定义 confirm
http://www.leigeber.com/2008/04/custom-javascript-dialog-boxes/
http://www.ajaxbbs.net/post/product/ymPrompt3.1.html
<style type="text/css">
.opaqueLayer{display:none;position:absolute;top:0px;left:0px;opacity:0.6;filter:alpha(opacity=60);background-color: #000000;z-Index:1000;}
</style>
<script type="text/javascript">
function getBrowserHeight() {
var intH = 0;
var intW = 0;if(typeof window.innerWidth == 'number' ) {
intH = window.innerHeight;
intW = window.innerWidth;
}
else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
intH = document.documentElement.clientHeight;
intW = document.documentElement.clientWidth;
}
else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
intH = document.body.clientHeight;
intW = document.body.clientWidth;
}
return { width: parseInt(intW), height: parseInt(intH) };
}function setLayerPosition() {
var shadow = document.getElementById('shadow');
var question = document.getElementById('question');var bws = getBrowserHeight();
shadow.style.width = bws.width + 'px';
shadow.style.height = bws.height + 'px';
question.style.left = parseInt((bws.width - 350) / 2)+ 'px';
question.style.top = parseInt((bws.height - 200) / 2)+ 'px';
shadow = null;
question = null;
} function showLayer() {
setLayerPosition();
var shadow = document.getElementById('shadow');
var question = document.getElementById('question');
shadow.style.display = 'block';
question.style.display = 'block';
shadow = null;
question = null;
}
function hideLayer() {
var shadow = document.getElementById('shadow');
var question = document.getElementById('question');
shadow.style.display = 'none';
question.style.display = 'none';
shadow = null;
question = null;
}window.onload=function(){
window.onresize = setLayerPosition;
}
</script>
<iframe id="shadow" class="opaqueLayer" style="border:0;" src="about:blank"></iframe>
<input type="button" value="click" onclick="showLayer();">
<div id="question" style="width:300px;height:120px;padding:20px;display:none;position:absolute;z-index:1001;background:#CCC;border:10px solid #999;">
<input type="button" value="按钮1234">
<input type="button" value="取消关闭" onclick="hideLayer()">
</div>