I'm reading on the W3C site about scripting, and they are calling the below code a window handler. The my_onload function has no code in it right now, but that's not the part I'm having trouble with.
The if statement in the last line of the script is what has me stymied. They had the tcl code for this too, and the tcl's if statement looked more familiar to me as it tested for if (win != "") which I understand to mean if the value of win is not equal to the empty string then execute.
Could someone explain to me in plain english what that short hand if statement is doing in this javascript? I'm not at all familiar with that syntax. I was also wondering why they don't have the trailing () pair on the call to the function in the if statement. I've always seen it with them, even if no values are being passed in.
<script type="text/javascript">
function my_onload() {
. . .
}
var win = window.open("some/other/URI");
if (win) win.onload = my_onload;
</SCRIPT>Thanks for any help you can be. Later, Ray Parrish

Help




Back to top









