zoukankan
html css js c++ java
加强的alert confirm js自定义对话框 多个按钮 ICO自定义
效果图:
<
html
>
<
head
>
<
title
>
对话框
</
title
>
<
link
rel
="stylesheet"
type
="text/css"
href
="/modules/commons/css/dialog.css"
>
<
script
src
="/modules/commons/js/prototype.js"
></
script
>
<
script
src
="/modules/commons/js/dialog.js"
></
script
>
</
head
>
<
body
>
<
div
id
="Contain"
>
<
div
id
="ICO"
style
="position:absolute; left:0px; top:5px;"
></
div
>
<
div
id
="Message"
></
div
>
<
div
id
="Buttons"
></
div
>
</
div
>
</
body
>
<
script
>
Event.observe(window, 'load',
function
()
{
//
check base config and parameter
var
objIn
=
window.dialogArguments
var
arrBt
=
['确定:
1
', '取消:
0
']
if
(objIn)
{
if
(objIn.ArrBt)
{
arrBt
=
objIn.ArrBt
}
if
(objIn.Message)
{
$('Message').innerHTML
=
objIn.Message
}
}
else
{
alert('tell me what u want to let user to confirm or alert information
')
return
}
//
ico
var
ICO
=
$('ICO')
var
img
=
document.createElement('img')
if
(objIn.ICO)
{
img.src
=
objIn.ICO
}
else
{
img.src
=
Dialog.Alert
}
ICO.appendChild(img)
//
button
var
Buttons
=
$('Buttons')
arrBt.each(
function
(bt)
{
var
input
=
document.createElement('input')
input.type
=
'button'
var
arr
=
bt.split(':')
input.value
=
arr[
0
]
input.returnValue
=
arr[
1
]
input.onclick
=
ClickBt
Buttons.appendChild(input)
}
)
}
,
false
)
function
ClickBt()
{
window.returnValue
=
this
.returnValue
window.close()
}
</
script
>
</
html
>
调用方法的封装
/**/
/*
2007-01-18 lisq custom dialog
use age:
<script src="/modules/commons/js/dialog.js"></script>
var objIn = {
Message : 'your message',
ArrBt : ['保存:1', '不保存:2', '取消:3']
}
var objOut = Dialog.Show(objIn)
if(objOut == 1){
save it
}else if(objOut == 2){
not save it
}else if(objOut == 3){
u click cancle
}
*/
var
Dialog
=
{
Show :
function
(objIn)
{
var
url
=
'
/
Commons
/
Dialog.
do
'
var
style
=
'dialogHeight:110px; dialogWidth:250px; edge:Raised; scroll:no; center:Yes; help:No; resizable:no; status:no;'
return
window.showModalDialog(url, objIn, style)
}
,
Alert : '
/
modules
/
commons
/
images
/
alert.png',
Confirm : '
/
modules
/
commons
/
images
/
confirm.png',
Error : '
/
modules
/
commons
/
images
/
error.gif.png'
}
查看全文
相关阅读:
4组Beta冲刺1/5
4组Beta冲刺总结
4组Beta冲刺2/5
4组Beta冲刺4/5
4组Beta冲刺5/5
4组Alpha冲刺6/6
软工实践个人总结
4组Alpha冲刺6/6
4组Beta冲刺3/5
4组Alpha冲刺总结
原文地址:https://www.cnblogs.com/boolean/p/623675.html
最新文章
SQL Server 分页方法
安装gitlab
C# 获取方法中的summary 读取字段注释
Windows10修复“System.EnterpriseServices.Wrapper.dll” > System.IO.FileNotFoundException: 系统找不到指定的文件
NET6 Razor学习
CenterOS部署.net core
树莓派/Linux ubuntu 开机自动改网络mac地址(主要适用于拷贝内存卡的情况/不同树莓派mac地址不同)
解决etcd集群空间占用问题 mvcc: database space exceeded
【树莓派】拷贝系统到新SD卡(系统备份/部署到另一台树莓派上)适用ubuntu 20.04.3
一键部署Home Assistant ubuntu 20.4.3 树莓派3b+脚本
热门文章
JetBrains全系列软件激活教程激活码以及JetBrains系列软件汉化包
Mac M1 在PyCharm中安装(支持GPU)TensorFlow 方法
shell 定时清理一定时间内未使用的目录下文件脚本
树莓派播放音乐
machinefinal
secutityfinal
Chrome控制台(console)给页面动态引入jQuery方便调试示例
【2022.01.06】使用树莓派安装huginn监控网页变换
【2022.01.07】拾回树莓派,折腾docker
4组Beta冲刺1/5
Copyright © 2011-2022 走看看