Script

本类阅读TOP10

·一个简单的javascript菜单
·网站流量统计代码
·可编辑的 HTML JavaScript 表格控件 DataGrid II
·JavaScript通用库(一)
·在网页中控制wmplayer播放器
·层遇到select框时
·TYPEING TEST ON LINE 在线打字测试 Free Software Javascript (aiiiq)
·javascript表单之间的数据传递!
·让网页自动穿上外套
·搜索gb2312汉字在网上的频率

分类导航
VC语言Delphi
VB语言ASP
PerlJava
Script数据库
其他语言游戏开发
文件格式网站制作
软件工程.NET开发
默认选中第二个按钮(取消)的conform

作者:未知 来源:月光软件站 加入时间:2005-2-28 月光软件站

test.htm
=====================================
<html>
<head>
<title> New Document </title>
<script language="javascript">
/*************************************************
功能:可以自己定制的confirm提示框,在IE6下测试通过

这个confirm用还可以做好多扩展,比如修改背景的颜色,修改那个显示的图片,修改按钮的样式,可以打开象查找那样的非模态的窗口(需要IE5+),可以象定制网页一样随便你修改

**************************************************/

/*
参数说明: strTitle confirm框的标题
   strMessage confirm框要显示的消息
   intType  confirm框的选中的类型1为选中YES,2为选中NO
   intWidth confirm框的宽度
   intHeight  confirm框的高度

*/
function myConfirm(strTitle,strMessage,intType,intWidth,intHeight)
{
 var strDialogFeatures = "status=no;center=yes;help=no;dialogWidth="+intWidth+";dialogHeight="+intHeight+";scroll=yes;resize=no";
 var args = new Array();
 args[args.length] = strTitle;
 args[args.length] = strMessage;
 args[args.length] = intType;
 var result = showModalDialog("myConfirm/myConfirm.htm",args,strDialogFeatures);
 return result;
}
function test()
{
 var myConfirmResult = myConfirm("这里是标题","aaa",2,12,7)
 if(myConfirmResult)
  alert("您点了YES");
 else if(myConfirmResult == false)
  alert("您点了NO");
 else
  alert("您点了右上角的关闭");
}
</script>
</head>

<body>
<input type="button" value="点我试试" onclick="test()">
</html>

myConfirm/myConfirm.htm
=================================
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
var args = window.dialogArguments
try{
 document.title = args[0]; //设置标题
}catch(e)
{
//这里屏蔽了错误,防止万一调用的传递参数不足
}

//-->
</script>
<title></title>
<style type="text/css">
<!--
body {
 margin-left: 0px;
 margin-top: 0px;
 background-color: menu;
 overflow: hidden;
 overflow-x:hidden;
    overflow-y:hidden;
}
-->
</style>
<script language="javascript">
function init()
{
 var args = window.dialogArguments
 try{
  message.innerHTML = args[1]; //设置提示的信息
  if(args[2] == 1)    //设置按钮的选中状态
   ok.focus(); 
  else
   cancel.focus();
 }catch(e)
 {
 //这里屏蔽了错误,防止万一调用的传递参数不足
 }
 ok.attachEvent("onclick",okClick); //设置YES按钮的事件处理函数
 cancel.attachEvent("onclick",cancelClick);//设置NO按钮的事件处理函数
}
function okClick()//YES按钮的事件处理函数
{
  window.returnValue = true;
  window.close();
}
function cancelClick()//NO按钮的事件处理函数
{
  window.returnValue = false
  window.close();
}
window.attachEvent("onload",init)
</script>
</head>

<body>
<table width="100%"  border="0" cellspacing="5">
  <tr>
    <td><div align="center">
      <img src="images/ico.gif" width="33" height="32"> </div></td>
    <td><div align="left" id="message"></div></td>
  </tr>
  <tr>
    <td>
      <div align="right">
        <input name="ok" type="button" id="ok" value="  确定  ">   
      </div></td>
    <td>
      <div align="left">
        <input name="cancel" type="button" id="cancel" value="  取消  ">
      </div></td>
  </tr>
</table>
</body>
</html>

用到的一个图片如下:


有点麻烦,如果你不介意用VBscript的话还是用VBscript简单

msgbox("aaa?",257)




相关文章

相关软件




月光软件程序下载编程文档电脑教程网站设计网址导航网络文学游戏天地幽默笑话生活休闲写作范文安妮宝贝
电脑技术编程开发网络专区谈天说地情感世界游戏元素分类游戏热门游戏体育运动手机专区业余爱好影视沙龙
音乐天地数码广场教育园地科学大观古今纵横谈股论金人文艺术医学保健动漫图酷二手专区地方风情各行各业

月光软件站·版权所有