<script type="text/javascript">
var b=5;
(b == 5) ? a="true" : a="false";
document.write(" --------------------------- "+a);
< /script>
var b=5;
(b == 5) ? a="true" : a="false";
document.write(" --------------------------- "+a);
< /script>
结果: --------------------------- true
代码如下:
< script type="text/javascript">
var b=true;
(b == false) ? a="true" : a="false";
document.write(" --------------------------- "+a);
< /script>
结果: --------------------------- false