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'
}
查看全文
相关阅读:
Java多线程问题
pattern-matching as an expression without a prior match -scala
从Zero到Hero,OpenAI重磅发布深度强化学习资源
What-does-git-remote-and-origin-mean
flink source code
如何生成ExecutionGraph及物理执行图
rocketmq 源码
Flink source task 源码分析
flink 获取上传的Jar源码
fileupload
原文地址:https://www.cnblogs.com/boolean/p/623675.html
最新文章
aspnet_regiis.exe -i 报 “此操作系统版本不支持此选项”
build MYSQL source code Using visual studio 2017
Flink performance test
ES Grafana
https://stackoverflow.com/questions/51751426/failed-to-run-the-da-platform-trial-vm
Blink
linux source code search
https://www.liepin.com/company/9288808/
using-sys-session-as-an-alternative-to-show-processlist
Performance Schema for MySQL Troubleshooting
热门文章
How Logs Work On MySQL With InnoDB Tables
MySQL Interviews
extent-descriptor-page-of-innodb
mysql locks
https://dev.mysql.com/doc/refman/8.0/en/innodb-locking.html
MYSQL 线程池
MYSQL
cap理论
a-gentle-introduction-to-asymmetric-encryption-and
maven dependencies
Copyright © 2011-2022 走看看