Style
<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >5px solid Purple;}</style><script type= "Text/javascript" >functionAddstyle () {varOb=document.getelementbyid (' Div1 '); OB. style.border= "1px solid red";//Div1, plus borderob.style.height= "100px"; OB. style.backgroundcolor= "#abcdef";}functionaddclass () {varOb=document.getelementbyid (' Div1 '); OB. Classname= "C1";}</script>Scrolling title
<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >varStart=0;varT= "Today the weather is very good, the two sessions immediately convened, invited teacher, Miss Li, invited Mr. Wang, Miss Wang did not go." Today the weather is very good, the two sessions immediately convened, invited teacher, Miss Li, invited Mr. Wang, Miss Wang did not go. ";functionShowtitle () {//cut one word at a time and display it in the titlestart++; if(START==T.LENGTH/2) {Start=0; } varStr=t.substr(start); Document. title=str;}</script>setinterval (Showtitle, 250);</script>
Couplet advertisement
<! DOCTYPE html Public"-//w3c//dtd XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >;}. content{width:800px;height:100px;margin:0Auto;}#Advl, #advR {top:0;position:absolute;border:5px solid orange;width:75px;font-size:50px;text-align:center; padding:20px 0;}#advl{left:5px;}#advr{right:5px;}</style>class= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div><divclass= "Content" style= "background: #ccc;" ></div><divclass= "Content" style= "background: #abc;" ></div></body>window. onscroll=function(){ //the distance the scroll bar scrolls varT=document.body.scrolltop+document.documentelement.scrolltop; //let ADVL advr and scroll bars move together. varObl=document.getelementbyid ("ADVL"); varObr=document.getelementbyid ("ADVR"); ObL. style.top=t+ "px"; ObR. style.top=t+ "px";}</script>
Examples of JavaScript Basics summary (i)