<script> function placeholder(){ var $textarea =document.getElementById('textarea'); console.error($textarea.value); $textarea.onfocus=function(){ if($textarea.value=="如:我厂生产的面包想进商超,需要检测产品是否合格。"){ $textarea.value=""; $textarea.style.color="#333"; } } $textarea.onblur=function(){ if($textarea.value==""){ $textarea.value="如:我厂生产的面包想进商超,需要检测产品是否合格。"; $textarea.style.color="#666"; } } } placeholder(); </script>
textarea模拟placeholder效果
最新推荐文章于 2025-03-27 17:57:32 发布
本文介绍了一种改进的代码编辑器自定义功能,包括如何通过脚本实现自动补全、语法高亮和代码折叠,提升编程效率。
704

被折叠的 条评论
为什么被折叠?



