[thelist] Toggle disable/enable of text box

Jonathan Chard jonathan at familygenetix.com
Thu Jan 18 12:19:31 CST 2001


Joshua>>In JavaScript, *all* data types are strings.  So, an unquoted true,
because
Joshua>>it is a keyword, is the same is a quoted true, so (true=='true') is
true.

Maybe it's a browser version thang (I'm on IE5 / NT ) but if I do the
following:

<html><head>
<script language="JavaScript" type="text/JavaScript">
<!--
function test()
{
   if ( false == 'false' ) alert( 'false == "false"' );
   else alert( 'false != "false"' );
}
//-->
</script>
</head>
<body>
<form><input type="button" onclick="test()" value="test" /></form>
</body>

It says that false != 'false'.

What's that all about, then?!

'true' may be equal to true, but 'false' isn't equal to false... (Unless
there's a bug in my code up there... Getting a bit blind with all this true
and false stuff now..)

Dontcha just love this untyped JavaScript stuff?


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org]On Behalf Of Joshua OIson
Sent: 18 January 2001 18:48
To: thelist at lists.evolt.org
Subject: Re: [thelist] Toggle disable/enable of text box



Event the way I coded it, it still fails if you do not put the return true
at the end of the event.  So, it's more than good practice, it's the way it
has to be coded to make it work.  When events I code don't work as expected,
adding a return value of true is the first thing I do, and in 90% of the
cases it fixes the problem.  It saves me from have to look the event handler
up in a book to check to see if it needs one.

-joshua

---------------------------------------
For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !





More information about the thelist mailing list