javascript习题(写一个文本输入框,有聚焦效果和移除聚焦效果)

    技术2022-07-11  91

    以下是html页面的代码:

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>中国的流浪猫</title> <link rel="stylesheet" type="text/css" href="regality.css"> </head> <body> <input type="text" value="请输入用户名" style="color:#999;border:1px solid #01f" onfocus="if (this.value=='请输入用户名') {this.value='';this.style.color='#424242'}" onblur="if (this.value=='') {this.value='请输入用户名';this.style.color='#999'}"> <script type="text/javascript" src="lesson.js"> </script> </body> </html>
    Processed: 0.014, SQL: 9