[whatwg] Placeholder option for text input boxes

Kristof Zelechovski giecrilj at stegny.2a.pl
Thu Oct 2 01:53:41 PDT 2008


INPUT. CHECKED = "checked" 
is equivalent to 
INPUT. SETATTRIBUTE "checked", "checked"
as of MSIE7.  

Chris

My unit test:

SET L5ELEMS = ME. ELEMENTS
SET A1C = L5ELEMS. NAMEDITEM("ITSTEST")
IF A1C. TAGNAME <> "INPUT" THEN STOP
IF A1C. GETATTRIBUTE("type") <> "checkbox" THEN STOP
IF A1C. GETATTRIBUTE("checked") THEN STOP
REM A1C. SETATTRIBUTE "checked", "checked"
A1C. CHECKED = "checked"
IF NOT A1C. GETATTRIBUTE("checked") THEN STOP


-----Original Message-----
From: whatwg-bounces at lists.whatwg.org
[mailto:whatwg-bounces at lists.whatwg.org] On Behalf Of Garrett Smith
Sent: Thursday, October 02, 2008 2:46 AM
To: whatwg
Subject: Re: [whatwg] Placeholder option for text input boxes

IE:
(did not test) -  FWIRC, getAttribute('checked') will return the value
|false|, what happens after that, I do not know.

<!DOCTYPE html>
<html lang="en">
<head>
	<title>CHeckbox-attribute.html</title>
</head>
<body>
<form action="">
  <input type="checkbox" checked="checked" id="c">
  <input id="b" value='asdf'>
</form>
<pre>
<script type="text/javascript">
var d = document, c = d.getElementById('c');
var b = d.getElementById('b');

b.value = 1;
d.writeln("b.getAttribute('value'):..." + b.getAttribute('value'));

c.checked = false;
d.writeln("\nc.checked:................." + c.checked);
d.writeln("c.getAttribute('checked'): "+c.getAttribute('checked'));
d.writeln("c.setAttribute('checked', 'checked');");
c.setAttribute('checked', 'checked');
d.writeln("c.checked:................." + c.checked);
</script>
</pre>
</body>
</html>





More information about the whatwg mailing list