Current location - Health Preservation Learning Network - Slimming men and women - How to use JS to judge the data input in two text boxes is inconsistent, and a dialog box pops up.
How to use JS to judge the data input in two text boxes is inconsistent, and a dialog box pops up.
1, the page references xx.js

Pages are in two file boxes->

Password:

Duplicate password:

Check button

& ltinput type = " button " onclick = " check point()" name = " txt 2 " = " check "/& gt;

2、

Function check passed () {

var PSD 1 = document . getelementbyid(" PSD 1 ")。 Value;

var PSD 2 = document . getelementbyid(" PSD 2 ")。 Value;

if(psd 1! =psd2){

Alert ("The passwords are inconsistent, please re-enter!" );

Returns false

}

Return true

}