时间:2021-07-01 10:21:17 帮助过:5人阅读
这个是html代码:
<p class="contain"> <p class="inputFullNameContain"><input class="inputFullName" type="text" id="search_content" /> </p> </p>
下面是js代码:
<script type="text/javascript" > (function () { var id = document.getElementById('search_content'); if (id) { var name = id; var unclicked = function () { if (name.value == '') { name.style.background = 'url("images/inputBackground.png") no-repeat center'; } }; var clicked = function () { name.style.background = 'none'; }; name.onfocus = clicked; name.onblur = unclicked; unclicked(); } })(); </script>
更多相关教程请访问 JavaScript教程