<link rel="stylesheet" type="text/css" href="js/epoch_styles.css" />
<script type="text/javascript" src="js/epoch_classes.js"></script>
<script type="text/javascript">
/*You can also place this code in a separate file and link to it like epoch_classes.js*/
var bas_cal,dp_cal,ms_cal;
window.onload = function () {
bas_cal = new Epoch('epoch_basic','flat',document.getElementById('basic_container'));
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
ms_cal = new Epoch('epoch_multi','flat',document.getElementById('multi_container'),true);
};
</script>
จะเห็นว่าจะมีคำว่า window.onload = function () อยู่ทั้งสองตัว ไม่ทราบว่าจะนำมาเป็นตัวเดียวกันได้ยังไงครับ
window.onload = function ()
{
var bas_cal,dp_cal,ms_cal;
var mytext=document.form1.elements;
bas_cal = new Epoch('epoch_basic','flat',document.getElementById('basic_container'));
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
ms_cal = new Epoch('epoch_multi','flat',document.getElementById('multi_container'),true);
/*You can also place this code in a separate file and link to it like epoch_classes.js*/
for(i=0;i<mytext.length;i++){
if(mytext[i].type!="" && mytext[i].type!="submit"){
mytext[i].onfocus=function(){
this.className='hi_light';
}
mytext[i].onblur=function(){
this.className='';
}
}
}
}};
window.onload = function ()
{
var bas_cal,dp_cal,ms_cal;
bas_cal = new Epoch('epoch_basic','flat',document.getElementById('basic_container'));
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
ms_cal = new Epoch('epoch_multi','flat',document.getElementById('multi_container'),true);
/*You can also place this code in a separate file and link to it like epoch_classes.js*/
var mytext=document.form1.elements;
for(i=0;i<mytext.length;i++){
if(mytext[i].type!="" && mytext[i].type!="submit"){
mytext[i].onfocus=function(){
this.className='hi_light';
}
mytext[i].onblur=function(){
this.className='';
}
}
}
};
ลองแบบนี้ดูครับ
<link rel="stylesheet" type="text/css" href="js/epoch_styles.css" />
<script type="text/javascript" src="js/epoch_classes.js"></script>
<script type="text/javascript">
/*You can also place this code in a separate file and link to it like epoch_classes.js*/
var bas_cal,dp_cal,ms_cal;
window.onload = function () {
bas_cal = new Epoch('epoch_basic','flat',document.getElementById('basic_container'));
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
ms_cal = new Epoch('epoch_multi','flat',document.getElementById('multi_container'),true);
};
</script>
</head>
<body>
<h2>Basic</h2>
<div id="basic_container"></div>
<h2>Popup</h2>
<form id="placeholder" method="get" action="#">
<input id="popup_container" type="text" />
</form>
<h2>Multiselect</h2>
<div id="multi_container"></div>
</body>