使用层弹出对话框

  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
  5. </head>
  6. <body>
  7. <a href="javascript:showBox();">忘记了密码?</a>
  8. <div id="box" style="display:none;height:auto !important; height:150px; min-height:150px; width:320px; top:100px; left:150px; position:absolute;FILTER: alpha(opacity=0); opacity:0;border:1px #CCCCCC solid; padding:10px; text-align:left; line-height:24px; background-color:#FAFCFD; z-index:999; ">
  9. <table width="100%" border="0" cellspacing="0" cellpadding="5">
  10.   <tr>
  11.     <td align="right"><a href="javascript:GradientClose();">[关闭]</a></td>
  12.   </tr>
  13.   <tr>
  14.     <td>若您忘记密码,职业帆的客服人员可以帮您找回密码!</td>
  15.   </tr>
  16.   <tr>
  17.     <td>客服人员的联系方式:</td>
  18.   </tr>
  19.   <tr>
  20.     <td>1.<img src="image/mail.gif" width="15" height="11" align="absmiddle" /> 电子邮箱:vsail@oafar.com</td>
  21.   </tr>
  22.   <tr>
  23.     <td>   请在邮件中注明您的会员名,会员类型,以及联系方式。</td>
  24.   </tr>
  25.   <tr>
  26.     <td>2.<img src="image/telepone.gif" width="16" height="16" align="absmiddle" /> 电  话:0571-28931325</td>
  27.   </tr>
  28. </table>
  29. </div>
  30. <SCRIPT language=javascript>
  31. var intDelay=50; //设置显示速度,越大越慢
  32. var intInterval=10
  33. var box = document.getElementById("box");
  34. var isIE = /msie/.test(navigator.userAgent.toLowerCase());
  35. function showBox(){
  36. if(isIE)
  37. box.filters.alpha.opacity=0
  38. else
  39. box.style.opacity=0;
  40. box.style.display="block"
  41. GradientShow();
  42. function GradientShow() 
  43. if(isIE){
  44. box.filters.alpha.opacity+=intInterval; 
  45. if (box.filters.alpha.opacity<100
  46. setTimeout(GradientShow,intDelay);  
  47. }else{
  48. box.style.opacity=parseFloat(intInterval/100)+parseFloat(box.style.opacity);
  49. if (box.style.opacity<1)
  50. setTimeout(GradientShow,intDelay);
  51. }
  52. }
  53. function GradientClose() 
  54. if(isIE){
  55. box.filters.alpha.opacity-=intInterval
  56. if (box.filters.alpha.opacity>0)
  57. setTimeout(GradientClose,intDelay); 
  58. else 
  59. box.style.display="none";
  60. }else{
  61. box.style.opacity=parseFloat(box.style.opacity)-parseFloat(intInterval/100);
  62. if (box.style.opacity>0)
  63. setTimeout(GradientClose,intDelay); 
  64. else 
  65. box.style.display="none";
  66. }
  67. }
  68. </SCRIPT>
  69. </body>
  70. </html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Vue中弹对话框可以使用第三方组件库如Element UI或者自己手动实现。以下是一个手动实现的示例: 1. 在需要弹对话框的组件中,添加一个按钮并绑定一个方法: ``` <template> <div> <button @click="showDialog">弹对话框</button> <div v-if="dialogVisible"> <!-- 对话框内容 --> </div> </div> </template> <script> export default { data() { return { dialogVisible: false } }, methods: { showDialog() { this.dialogVisible = true; } } } </script> ``` 2. 在data中添加一个变量dialogVisible,用于控制对话框的显示与隐藏。 3. 在showDialog方法中将dialogVisible设置为true,即可显示对话框。 4. 在对话框中添加内容,可以使用第三方组件库如Element UI的Dialog组件,也可以手动实现。 5. 对于手动实现对话框,可以在对话框中添加一个遮罩层,并使用CSS实现弹效果: ``` <template> <div> <button @click="showDialog">弹对话框</button> <div v-if="dialogVisible" class="dialog-wrapper"> <div class="dialog-mask"></div> <div class="dialog-content"> <!-- 对话框内容 --> </div> </div> </div> </template> <style> .dialog-wrapper { position: fixed; top: 0; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; align-items: center; } .dialog-mask { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(0, 0, 0, 0.6); } .dialog-content { background-color: #fff; width: 400px; height: 300px; border-radius: 4px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); } </style> ``` 这样就实现了一个简单的手动弹对话框

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值