IdeaForKhmerសូមបង្ហាញជូនកូនគន្លឹះតូចមួយ
ដែលមាននាទីបង្ហាញពាក្យស្វាគមន៍
និងបង្ហាញពាក្យបញ្ជាក់ដល់អ្នកធ្លាប់ចូលមកប្លកអោយគេដឹងអំពីពេលវេលាចុងក្រោយដែលគេធ្លាប់មក។
គន្លឹះនេះជាប្រភេទ Cookies
ដែលអាចចងចាំបាន។
សូមមើលពីរបៀបដាក់
ខាងក្រោមនេះ៖
- រួចចូលទៅ Layout >> Add a Gadget ។
- ស្វែងរកមើល Gadget ដែរមានឈ្មោះ HTML/JavaScript (មើលរូបខាងក្រោមនេះ)
- បិទភ្ជាប់ Codeពណ៌ខៀវ ខាងក្រោមទាំងអស់នេះចូលក្នុង Gadget HTML/JavaScript ជាការស្រេច។
អ្នកអាច៖
អ្នកអាចកែប្រែពាក្យទៅតាមអ្វីដែលអ្នកចូលចិត្ត។
<script type = "text/javascript">
var days = 730; // days until cookie expires = 2 years.
var lastvisit=new Object();
var firstvisitmsg="សូមអគុណចំពោះការចូលមកកាន់ប្លករបស់យើងខ្ញុំ";
lastvisit.subsequentvisitmsg="រីករាយណាស់ដែលអ្នកមកម្ដងទៀត គ្រាចុងក្រោយដែលអ្នកធ្លាប់មកគឺ <b>[displaydate]</b>";
lastvisit.getCookie=function(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1];
return'';
}
lastvisit.setCookie=function(name, value, days){
var expireDate = new Date();
var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}
lastvisit.showmessage = function() {
var wh = new Date();
if (lastvisit.getCookie("visitc") == "") {
lastvisit.setCookie("visitc", wh, days);
document.write(firstvisitmsg);
}
else {
var lv = lastvisit.getCookie("visitc");
var lvp = Date.parse(lv);
var now = new Date();
now.setTime(lvp);
var day = new Array("Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat");
var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var dd = now.getDate();
var dy = now.getDay();
dy = day[dy];
var mn = now.getMonth();
mn = month[mn];
yy = now.getFullYear();
var hh = now.getHours();
var ampm = "AM";
if (hh >= 12) {ampm = "PM"}
if (hh >12){hh = hh - 12};
if (hh == 0) {hh = 12}
if (hh < 10) {hh = "0" + hh};
var mins = now.getMinutes();
if (mins < 10) {mins = "0"+ mins}
var secs = now.getSeconds();
if (secs < 10) {secs = "0" + secs}
var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " + hh + ":" + mins + ":" + secs + " " + ampm
document.write(lastvisit.subsequentvisitmsg.replace("[displaydate]", dispDate))
}
lastvisit.setCookie("visitc", wh, days);
}
lastvisit.showmessage();
</script>
var days = 730; // days until cookie expires = 2 years.
var lastvisit=new Object();
var firstvisitmsg="សូមអគុណចំពោះការចូលមកកាន់ប្លករបស់យើងខ្ញុំ";
lastvisit.subsequentvisitmsg="រីករាយណាស់ដែលអ្នកមកម្ដងទៀត គ្រាចុងក្រោយដែលអ្នកធ្លាប់មកគឺ <b>[displaydate]</b>";
lastvisit.getCookie=function(Name){
var re=new RegExp(Name+"=[^;]+", "i");
if (document.cookie.match(re))
return document.cookie.match(re)[0].split("=")[1];
return'';
}
lastvisit.setCookie=function(name, value, days){
var expireDate = new Date();
var expstring=expireDate.setDate(expireDate.getDate()+parseInt(days));
document.cookie = name+"="+value+"; expires="+expireDate.toGMTString()+"; path=/";
}
lastvisit.showmessage = function() {
var wh = new Date();
if (lastvisit.getCookie("visitc") == "") {
lastvisit.setCookie("visitc", wh, days);
document.write(firstvisitmsg);
}
else {
var lv = lastvisit.getCookie("visitc");
var lvp = Date.parse(lv);
var now = new Date();
now.setTime(lvp);
var day = new Array("Sun", "Mon", "Tues", "Wed", "Thur", "Fri", "Sat");
var month = new Array ("Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
var dd = now.getDate();
var dy = now.getDay();
dy = day[dy];
var mn = now.getMonth();
mn = month[mn];
yy = now.getFullYear();
var hh = now.getHours();
var ampm = "AM";
if (hh >= 12) {ampm = "PM"}
if (hh >12){hh = hh - 12};
if (hh == 0) {hh = 12}
if (hh < 10) {hh = "0" + hh};
var mins = now.getMinutes();
if (mins < 10) {mins = "0"+ mins}
var secs = now.getSeconds();
if (secs < 10) {secs = "0" + secs}
var dispDate = dy + ", " + mn + " " + dd + ", " + yy + " " + hh + ":" + mins + ":" + secs + " " + ampm
document.write(lastvisit.subsequentvisitmsg.replace("[displaydate]", dispDate))
}
lastvisit.setCookie("visitc", wh, days);
}
lastvisit.showmessage();
</script>
នៅក្នុងកូដពណ៌ខៀវនេះគឺ៖
- សូមអគុណចំពោះការចូលមកកាន់ប្លករបស់យើងខ្ញុំ:
ជាពាក្យស្វាគមន៍អ្នកទើបចូលមកលើកដំបូង។
-រីករាយណាស់ដែលអ្នកមកម្ដងទៀត គ្រាចុងក្រោយដែលអ្នកធ្លាប់មកគឺ : ជាពាក្យបញ្ជាក់ប្រាប់អ្នកដែលធ្លាប់ចូលទស្សនាប្លកដែលមានបង្ហាញពេលវេលាចុងក្រោយដេលគេបានចូល។