Академический Документы
Профессиональный Документы
Культура Документы
studio
objects, literals & constructors
Daniel Jackson
literals
Object
return "rgb("
+ ")"}
function...
"rgb(255,255,0)"
Object
> cyan.red
undefined
255
> cyan
Object
1.blue: 255
2.green: 255
3.red: 0
4.__proto__: Object
box notation
ReferenceError
"red"
> cyan[green]
255
<head>
<script>
legoColor = [];
legoColor['blue'] = '#0D69AB';
legoColor['green'] = '#287F46';
...
whats wrong
with this?
$(document).ready(function () {
$('#button').click(function () {
if (color)
$('#display').css('backgroundColor', color);
else
});
})
</script>
</head>
<body>
<div id=display></div>
<input id=choice></input>
<button id=button>Show</button>
</body></html>
document.body.style.backgroundColor = toCSS(yellow)
document.body.style.backgroundColor = toCSS(red)
_slots
!
JS Object
_value
Slot
...
Function
String
_property
!
methods
this.toCSS = function () {
document.body.style.backgroundColor = red.toCSS()
MIT OpenCourseWare
http://ocw.mit.edu
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.