komentarii
ne bolshe 80 simvolov s stroke
drevovidnij kod
simanticheskije premennije nazvanija
premennije ne mogut nachinatsja na cifru
confim, promt, alert
VAR dlja togo shtobi bila lokaljnoj
x= new Array()
y=[] tozhe massiv
x = new Array(Array(1,2,3), Array(4,5,6));
x="abc";
x[1] => a...
man={'name':'Max'}
man.go=function(){ }
function show_2(){}
Array.prototype.abc=show_2;
------------------------------------------
<script>
x = new Array (1,2,3,4,5);
function go()
{
alert(this[0]);
}
Array.prototype.first = go;
Array.prototype.second = function ()
{
alert(this[1]);
}
y = new Array (6,7,8,9);
y.first();
x.first();
x.second();
</script>
--------------------------------------------
student1 = { name : 'Max',
TellName : function () { alert(this.name); }
} ;
//alert(student1.name);
student1.name = "Vasja";
student1.TellName();
student2 = (function()
{
var name = 'Max';
function TellName()
{
alert(name);
}
return {
introduce : function ()
{
TellName();
}
}
})();
student2.introduce();
----------------------------------------------
[[scope]]
function out(Message)
{
var x = 0;
inner = function()
{
x += 1;
document.write(Message+'('+x+')<br>');
}
return inner;
}
var fun = out('hello');
fun();
fun();
fun();
fun();
fun();
----------------------------------------------
setTimeout(alert(1), 2000 vremja v milisekundh)
setInterval()
----------------------------------------------
<id = "id1" ...name="myname">
document.forms[1].elements[0]
document.forms[1].myname
document.getElementById('id1')
.innerHtml
----------------------------------------------
document.getElementById().style.backgroundColor
----------------------------------------------
Комментариев нет:
Отправить комментарий