mozilla

Revision 126775 of Talk:en

  • Revision slug: Talk:en
  • Revision title: Talk:en
  • Revision id: 126775
  • Created:
  • Creator: itlong
  • Is current revision? No
  • Comment bug; 189 words added, 36 words removed; page display name reset to default

Revision Content

Firefox 3.0,

I have found some problem that: 

and I set some validate rule for some field: username, can't be empty.

/*code*/

<script type="text/javascript">

function valid(){

var obj = document.getElementById('username');

if('' == obj.value){

obj.focus();//here notice the user where the form field invalid;

alert('the field can't empty!');

}

}

</script>

/*end code*/

when some body fill a form,and invalid, It will give some alert message, It can't work, the firefox3.0 will stop!!! like death!! but this code can work on IE, google, opera...

and change this cod to:

/*code*/

<script type="text/javascript">

function valid(){

var obj = document.getElementById('username');

if('' == obj.value){

        alert('the field can't empty!');

obj.focus();//here notice the user where the form field invalid

}

}

</script>

/*end code*/

Revision Source

<p>Firefox 3.0,</p>
<p>I have found some problem that: </p>
<p>and I set some validate rule for some field: username, can't be empty.</p>
<p>/*code*/</p>
<p>&lt;script type="text/javascript"&gt;</p>
<p style="margin-left: 40px;">function valid(){</p>
<p style="margin-left: 80px;">var obj = document.getElementById('username');</p>
<p style="margin-left: 80px;">if('' == obj.value){</p>
<p style="margin-left: 120px;">obj.focus();//here notice the user where the form field invalid;</p>
<p style="margin-left: 120px;">alert('the field can't empty!');</p>
<p style="margin-left: 80px;">}</p>
<p style="margin-left: 40px;">}</p>
<p>&lt;/script&gt;</p>
<p>/*end code*/</p>
<p>when some body fill a form,and invalid, It will give some alert message, It can't work, the firefox3.0 will stop!!! like death!! but this code can work on IE, google, opera...</p>
<p>and change this cod to:</p>
<p>/*code*/</p>
<p>&lt;script type="text/javascript"&gt;</p>
<p style="margin-left: 40px;">function valid(){</p>
<p style="margin-left: 80px;">var obj = document.getElementById('username');</p>
<p style="margin-left: 80px;">if('' == obj.value){</p>
<p style="margin-left: 80px;">        alert('the field can't empty!');</p>
<p style="margin-left: 120px;">obj.focus();//here notice the user where the form field invalid</p>
<p style="margin-left: 80px;">}</p>
<p style="margin-left: 40px;">}</p>
<p>&lt;/script&gt;</p>
<p>/*end code*/</p>
Revert to this revision