 |
แก้โค๊ดทำ hilight form และ Datepick ให้ทีครับ คือผมอยากจะรวมทั้งการทำ Hilight ในช่องรับข้อมูล |
|
 |
|
|
 |
 |
|
ก็เอา var มาประกาศตัวแปรเพิ่มเติมลงไปเลยครับ
|
 |
 |
 |
 |
Date :
2010-04-25 14:10:30 |
By :
Manussawin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
แก้ไขแบบนี้แล้วครับ
Code (PHP)
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='';
}
}
}
}};
ผลคือไม่ทำงานทั้ง Hilight และ Datepick ครับ
ไม่ทราบว่าผิดตรงไหนอีกครับ
|
 |
 |
 |
 |
Date :
2010-04-25 14:27:39 |
By :
witter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
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='';
}
}
}
};
ลองแบบนี้ดูครับ
|
 |
 |
 |
 |
Date :
2010-04-25 14:43:25 |
By :
Manussawin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังไม่ได้ครับ
ไม่ขึ้นอะไรเลย
นี่ครับ Code Datepick
Code (PHP)
<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>
ใจจริงอยากจะเอาเฉพาะแบบ Popup มาประยุกต์ใช้ในฟอร์มรับข้อมูลทั่วไป
เช่น รับชื่อ ที่อยู่ วดป.เกิด แบบ Datepick ส่วนอื่น ๆ ก็มี Hilight ในช่องรับข้อมูลครับ
ส่วนนี่ตัวทำ Hilight ครับ
Code (PHP)
/*การ hilight form ฟอร์มด้วย javascript อย่างง่าย*/
<style type="text/css">
.hi_light{
border:1px #333333 inset;
background-color:#FFCC33;
color:#000000;
}
</style>
<script language="javascript">
window.onload=function(){
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='';
}
}
}
}
</script>
รบกวนคุณ emboy อีกครั้งนะครับ
ถ้าจะอนุเคราะห์ code ตัวอย่างซักตัวก็จะเป็นพระคุณยิ่ง
|
 |
 |
 |
 |
Date :
2010-04-25 14:56:41 |
By :
witter |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอา jquery ไปใช้ไหมครับ
|
 |
 |
 |
 |
Date :
2010-04-25 17:30:39 |
By :
Manussawin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เอา jquery ไปใช้เลยครับ จะให้มี hilight ยังไงก็ไปประยุกต์เอา
http://docs.jquery.com/UI/Datepicker
|
 |
 |
 |
 |
Date :
2010-04-25 20:46:06 |
By :
Manussawin |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
พี่ครับรบกวนถามหน่อยครับ
ถ้าจะเปลี่ยนรูปแแบวันที่ต้องเปลี่ยนตรงไหมครับ
ของเก่า m/d/Y
เป็น d/m/Yทำไงอะครับ
แก้ตรงไหนบ้างครับ
|
 |
 |
 |
 |
Date :
2011-02-02 14:10:19 |
By :
Boat |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|