1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<script type="text/javascript">
function init(){
   var inp = document.getElementsByTagName('textarea');
   for(var i = 0; i < inp.length; i++) {

      inp[i].setAttribute('rel',inp[i].defaultValue)
      inp[i].onfocus = function() {
         if(this.value == this.getAttribute('rel')) {
            this.value = '';
         } else {
            return false;
         }
      }
      inp[i].onblur = function() {
         if(this.value == '') {
            this.value = this.getAttribute('rel');
         } else {
            return false;
         }
      }
      inp[i].ondblclick = function() {
         this.value = this.getAttribute('rel')
      }
   }
}
if(document.childNodes) {
   window.onload = init
}</script>