.


:




:

































 

 

 

 


HTML-

- HTML-.

HTML- , , . ( 1.1), .

1.1.

<HTML ID='DOCUM'>
<CENTER><H1 ID='zag'> </h1>
, Mozilla<P>
<FORM NAME='f1'>
<INPUT TYPE=BUTTON name="bot" onclick=bm() value=''>
<P>
</FORM >
<IMG SRC="VaskaM.jpg" ID='Vas' onclick=bm()>
</center>
<!-- -->
<SCRIPT>
/*var
msg=''
for(i=0; i<document.all.length;i++)
msg+=i + ' ' + document.all[i].tagName +' ID=' + document.all[i].id+'\n'
alert(msg) */
flag=true
function bm()
{ if(flag)

{ document.images[0].src='VaskaB.jpg' flag=false;
document.forms[0].bot.value=""
document.forms[0].bot.style.background='red'
document.all.bot.style.color='black';
}
else
{ document.getElementById("Vas").src='VaskaM.jpg';
//
document.forms[0].bot.value=""
document.forms[0].bot.style.background='green'
document.all.bot.style.color='white'; flag= true
}

}
</script>
</HTML>

1.1

1.1 . .

. <INPUT> <IMG> onclick=bm(), bm(). . SRC IMG. :

document.images[0].src='VaskaB.jpg'
document.getElementById("Vas").src='VaskaM.jpg'

images, ( ) . . getElementById() document. getElementById() ID () IMG. : " src , ID=Vas document, VaskaM.jpg ". document window. src :

window.document.images[0].src='VaskaB.jpg'
window.document.getElementById("Vas").src='VaskaM.jpg'

, , window, .

:

document.forms[0].bot.value=""

document.forms.f1.bot.style.background='red'

. (name='bot'). forms .

. forms f1. , , , style . style bot, , .

all document. all HTML-, ID . all :

document.all.bot.style.color='black'

HTML- (DOM). , , , . HTML- , () Internet Explorer 6.0 Mozilla Firefox 2.0, , . , /* */ . , . Internet Explorer 12 , Mozilla Firefox 10.

.

var msg=''
for(i=0; i<document.all.length;i++)
msg+=i + ' ' + document.all[i].tagName +' ID=' + document.all[i].id+'\n'
alert(msg)

all HTML- length, . tagName, . msg, , ID . \n .

1.1. HTML-, :

  • all
  • getElementById()

<H2>...</h2>, <P> </p>, <DIV> </div>. , . , . .

, - .

getElementById(), all.

HTML-

HTML- :

  • (. 2.1);
  • , <SCRIPT>...</script>;
  • .

HTML-. HTML- .

HTML- . HTML- . , . , .

. HTML- SRC <SCRIPT>. , , . 1.2 .

1.2

html><!-- primJs.js--> <HEAD>
<TITLE></title>
</head>
<body>
<SCRIPT language="JavaScript" src="PrimJs.js">
</script>
<H2 align=center style="color:green"> ""</h2>
: ., .2<P>
: 7, 23, 56, 93
</body>
</html>
// primJs.js
a="background-color:#00ffff; color:#ff00ff;"
a+="font-size:24pt; font-family:'Times New Roman'"
naim=' "Ѩ "'
var da=new Date()
d=da.getDate()+"."+da.getMonth()+"."+da.getYear()
document.write('<P align=center style= "'+a+'">'+
naim+'</p><P> '+d+'</p>')

1.2

, primJs.js. write(HTML-) (HTML-). , .

1.2. 1.2 . . Ѩ . , . primJs.js.



<== | ==>
I () |
:


: 2016-12-31; !; : 1199 |


:

:

, .
==> ...

1745 - | 1548 -


© 2015-2024 lektsii.org - -

: 0.014 .