这里说的模拟不会只是形式上的模拟,关键是 当弹出信息后 程序会挂起,然后点击“确定”程序再继续
解决方案 »
- 在IE8中 onload事件不执行FireFox可以执行
- 一个关于层的问题,大家帮帮我啊!
- 如何输出一个网站的所有cookies(用js和asp)
- 怎样才可以重载js文件
- 请问javascript中有像 int cstr 这样的转换函数吗?
- 求助—如何去除弹出的3721和百度窗口!
- 大家帮我看看为什么这样连接不上Access数据库
- 弹出一个js对话框,怎么把输入的值返回到页面里的textarea里面去啊?
- 怎么样弹出一个没有ie边框、工具栏...滚动条的窗口,不是全屏窗口?
- echarts 异步切换数据显示问题
- JavaScript源码分析 高手群(84507704) 欢迎加入!!研究Js面向对象 jQuery Extjs
- 鼠标移上换图的超链接怎么做?
#test{
width:200px;
height:100px;
float:left;
background:#999;
display:none;
}
#yes{
margin-left:40px;
margin-top:50px;
}
#no{
margin-left:20px;
margin-top:50px;
}html:<div id="test">
<input type="button" id="yes" value="确定" />
<input type="button" id="no" value="取消" />
</div>jquery:$(document).ready(function(){
$("#btn").click(function(){
$("#test").show();
});
$("#yes").click(function(){
$("#test").hide();
alert("填入处理")
});
$("#no").click(function(){
$("#test").hide();
return;
});
});
<input type="button" id="btn" value="测试" />
<div id="test">
<input type="button" id="yes" value="确定" />
<input type="button" id="no" value="取消" />
</div>少写了一个
<body>
<head>
<script type="text/javascript">
function showdiv()
{
if(!document.getElementById('divv'))
{
var obj = document.createElement("div");
obj.id="divv";
document.body.appendChild(obj);
//obj.style.backgroundColor='red';
with(obj.style)
{
width='150px';
height='150px';
left = '300px';
top = '300px';
position = 'absolute';
}
obj.innerHTML = "<div style='font-size: 9pt;height: 25px; padding: 5px; background-color: dodgerblue; color: #fff;' align='right'><a style='color: #fff;text-decoration: none;' alt='Close' href='#' onclick = 'closeAlert();'>X</a></div><div style='padding: 5px;' id='text_div' style='background: #ccc;height:100px;'>电机这里!</div>";
}
else
{
divv.removeNode(true);
}
}
function closeAlert()
{
document.getElementById('divv').style.display = 'none';
}
</script> </head><body>
<input type="button" value="click me" onclick="showdiv();" size="10px" /><br/>
</body>
</html>比较简单的一个DIV+CSS模拟层!在此基础可以修改其样式,比如添加蒙板层,设置效果等,就会更漂亮多了!没必要另外去定义ALERT();