html如何呼叫外部js檔案,外部的js檔案該怎麼寫,是什麼格式的 外部js應該怎麼寫
- 綜合知識
- 關注:2.9W次
<script src = "index_1.js" type="text/javascript"></script>; 你這個呼叫的就是外部js檔案index_1.js。
onmouseover 和onmouseout直接寫到html程式碼就可以。
<style>
.header_1{position:absolute;top:40px;left:220px;height:auto;width:auto;color:#FFFFFF;}
.d_over{background:#FF0000;}
.d_out{background:#FFFFFF;}
</style>
<div onm ouseover="this.className='d_over'" onm ouseout="this.className='d_out'">333333333333333</div>
2.怎麼寫一個外部js檔案,網頁裡怎麼用啊//JS檔案內容:
var mySelect=new mSelect('mySelect','images/mSelect.css');
window.onload=function(){
var aS=document.getElementsByTagName('select');
for (var i=0;i<aS.length;i++){
switch(aS[i].getAttribute('mSty')){
case 'redLine':
mySelect.Create(aS[i],'redLine');
break;
case 'blueCircle':
mySelect.Create(aS[i],'blueCircle',true);
break;
case 'orangeHeart':
mySelect.Create(aS[i],'orangeHeart',true);
break;
}
}
}
//網頁呼叫
<script type="text/javascript" src="scripts/mSelect.js"></script>
- 文章版權屬於文章作者所有,轉載請註明 https://shqsg.com/zonghezhishi/6ymx54.html