For example, in the following code
<form name="myform> <input name="para1" type="hidden" value="false" /></form>
var x = document.getElementsByName('para1')[0].value;x = (x === 'false' ? false : true);alert(x);
JScript code
var x = document.getElementsByName('para1 ')[0].value;
x = (x === 'false' ? false : true);
alert(x);
Thank you T5500, I have tried this method , the result proves that even if a Boolean value false is assigned to It is troublesome to define another variable and use if statement to judge. I don’t know if there is any other way
The attribute values of DOM are all strings.
The attribute values of DOM are all strings.
That’s it, thank you~