怎么在页面中设置,点击按钮弹出一个带有输入框的对话框

qq_30573053 2015-08-13 01:51:37
怎么在页面中设置,点击按钮弹出一个带有输入框的对话框
...全文
58113 9 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
山东蓝鸟贵薪 2016-09-15
  • 打赏
  • 举报
回复
我是来学习学习的
qq_30573053 2015-08-13
  • 打赏
  • 举报
回复
嗯,改为button就可以了,但是要让页面的其他内容不动,使对话框悬浮该怎么设置呢?
旋雨沐 2015-08-13
  • 打赏
  • 举报
回复
window.onload=function(){ var btn=document.getElementsByClassName("ClassName")[0], popdiv=document.getElementsByClassName("popDiv")[0]; btn.onclick=function(){ popdiv.style.display="block"; } }
天际的海浪 2015-08-13
  • 打赏
  • 举报
回复
引用 5 楼 qq_30573053 的回复:
我要在原来的页面上添加对话框,我一点击按钮,对话框闪一下就消失了
别用提交按钮,要用普通按钮
qq_30573053 2015-08-13
  • 打赏
  • 举报
回复
我要在原来的页面上添加对话框,我一点击按钮,对话框闪一下就消失了
datarrow 2015-08-13
  • 打赏
  • 举报
回复 2
如果你的对话框 不仅是消息提示,是有输入(与用户有交互),建议自定义一个对话框, 即先预订一个对话框,隐藏起来,需要时打开。 <!doctype html> <html> <head> <meta charset="utf-8"> <title>My Test Document</title> <style> .box{ width:50%; margin-top:10%; margin:auto; padding:28px; height:350px; border:1px #111 solid; display:none; /* 默认对话框隐藏 */ } .box.show{display:block;} .box .x{ font-size:18px; text-align:right; display:block;} .box input{width:80%; font-size:18px; margin-top:18px;} </style> </head> <body> <h2>测试</h2> <input type="button" onClick="msgbox(1)" value="点击弹出输入框"> <script> function msgbox(n){ document.getElementById('inputbox').style.display=n?'block':'none'; /* 点击按钮打开/关闭 对话框 */ } </script> <div id='inputbox' class="box"> <a class='x' href=''; onclick="msgbox(0); return false;">关闭</a> <input type="text"> <input type="text"> <input type="button" value="确定"> </div> </body>
qq_30573053 2015-08-13
  • 打赏
  • 举报
回复
我点了按钮后没反映
DaveLeeCN 2015-08-13
  • 打赏
  • 举报
回复
<script type="text/javascript">
function diag()
{
    var str=prompt("随便写点儿啥吧","比如我叫啥");
    if(str)
    {
        alert("您刚输入的是:"+ str)
    }
}

</script>
<p>
<input type="submit" value="Sumit" name="Su1" onclick="diag()" />
</p>
qq_30573053 2015-08-13
  • 打赏
  • 举报
回复
自己来顶一下

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧