慕村1994845
2016-09-26 18:44
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
function change(){
document.getElementById("daan").value=Math.floor(document.getElementById("shuru").value);
}
</script>
<style type="text/css">
*{font-size:18px; color:#F00;}
#shuru{background:#93C;}
button{background:#0F0;}
#daan{background:#FF0;}
</style>
</head>
<body>
<form>
<input type="text" placeholder="请输入数值" value="" id="shuru"/>
<!--在360浏览器中点击输入框,“请输入数值”不会消失,在ie中点击会消失,在DW写代码时,也会消失,这是兼容问题?-->
<button type="button" onclick="change()">Change</button>
<input type="text" placeholder="答案" value="" id="daan"/>
</form>
</body>
</html>
由于placeholder是html5的新属性,可想而知,仅支持html5的浏览器才支持placeholder,目前最新的firefox、chrome、safari以及ie10都支持,ie6到ie9都不支持。
来源:http://blog.sina.com.cn/s/blog_4a0c5a940101j8bh.html
你可以去看看,写的很详细
兼容问题,应该可以用脚本代替
placeholder是HTML5标签,在IE10中可以显示,这是浏览器不兼容问题!
JavaScript进阶篇
469186 学习 · 22584 问题
相似问题