Saat teks difokuskan, teks menghilang, dan ketika teks tidak fokus, teks muncul
<! Doctype html> <html> <head> <meta charset = "utf-8"> <title> unt judul dokumen </itement> </head> <body> <input id = "text" type = "text" value = "klik saya untuk menghilang"/> <script> var otext = document.getElementById ("teks"); onoff = true; otext.color = "#000"; otext.onfocus = function () {if (onoff) {this.value = ""; this.color = "red"; onoff = false;} Text.onblur = function () {if (if.value = value menghilang "; Onoff = true;}} </script> </body> </html>