รบกวนดูโค้ดให้หน่อยค่ะ คือจะแทรกฟังชั่นเพิ่ม ไม่ทราบว่าจะต้องวางตรงไหนค่ะ
รบกวนดูโค้ดนี้ให้หน่อยค่ะ
คือจะใส่ฟังชั่นนี้เพิ่มไป
ไม่ทราบว่าจะวางยังไงค่ะ
โค้ดเดิมค่ะ
<!--
function checkStr (val) {
var str = '^'; //?????????????????????????
if (val.indexOf("'")!= -1) return true //?????????? '
if (val.indexOf('"')!= -1) return true //?????????? "
for (i = 0; i < str.length; i++) {
if (val.indexOf(str.charAt(i))!= -1) return true
}
return false
}
function sellist(jglist) {
if(document.formsend1.number_phone.value == "" ){
document.formsend1.number_phone.value+=jglist
}else{
document.formsend1.number_phone.value+=","+jglist
}
}
function smspick(sms) {
window.opener.top.document.formsend1.text_msg.value=sms
}
function IsNumber(phone_number) {
var valid = "0123456789" ;
var temp, ok = "yes";
for (var i=0; i<phone_number.length; i++) {
temp = "" + phone_number.substring(i, i+1);
if (valid.indexOf(temp) == "-1") ok = "no";
}
if (ok == "yes") {
// alert("Number");
return true;
} else {
//alert("Text");
return false;
}
}
function delcont(jdgrid) {
if (confirm("????????????????? ?") ){
window.location.href="deleted.php?dgrid="+jdgrid
}
}
function setcount () {
enable = setInterval("counter()",100);
}
function counter() {
var chal,mpart;
chal = document.formsend1.text_msg.value.length;
document.formsend1.lang.value="eng"
for(i=0;i<chal;i++){
if(document.formsend1.text_msg.value.charCodeAt(i)>160){
document.formsend1.lang.value="tha"
}
}
if(document.formsend1.lang.value== "eng"){
onemsg = 160 ;
numcha1=1;
mainchar=160;
document.formsend1.pasa.value="E"
}else{
onemsg = 70;
numcha1=1;
mainchar=70;
document.formsend1.pasa.value="T"
}
mpart = parseInt(chal / onemsg);
if ((chal % onemsg ) > 0)
mpart += 1;
document.formsend1.maxcha.value = onemsg;
document.formsend1.restcha.value = onemsg-chal;
if(document.formsend1.restcha.value< 0 ){
numcha1=2;
onemsg = onemsg *2;
document.formsend1.maxcha.value = onemsg;
document.formsend1.restcha.value = onemsg-chal;
}
if(document.formsend1.restcha.value< 0 ){
numcha1=3;
onemsg = onemsg +mainchar;
document.formsend1.maxcha.value = onemsg;
document.formsend1.restcha.value = onemsg-chal;
}
if(document.formsend1.restcha.value< 0 ){
numcha1=4;
onemsg =onemsg +mainchar;
document.formsend1.maxcha.value = onemsg;
document.formsend1.restcha.value = onemsg-chal;
}
c=document.formsend1.number_phone.value.split(",");
n = c.length*numcha1;
document.formsend1.musecre.value = n;
document.formsend1.numcha.value = numcha1;
var jmusecre=document.getElementById('jmusecre');
jmusecre.innerHTML= n;
}
function checkf(){
if("y"!="y"){
alert("??????????????????????????");
return false;
}
var jrest=parseInt(document.formsend1.restcre.value)
var jmuse=parseInt(document.formsend1.musecre.value)
if(jrest<jmuse){
alert("????????????????????????????????????");
return false;
}
if(document.formsend1.number_phone.value== "" || document.formsend1.number_phone.value == " "){
alert("???????? Phone Number");
return false;
}
var jdest = document.formsend1.number_phone.value;
var len = jdest.length;
for(var i=0 ; i<len ; i++){
var digit = jdest.charAt(i);
if(!(digit >="0" && digit <="9") && !(digit==",")){
alert("???????? Phone Number ??????????????????? ?????????????????(,)????????");
return false;
}
}
if(document.formsend1.number_phone.value.length>10999){
alert("Phone Number ?????????? 1000 ?????");
return false;
}
var phone_num = document.formsend1.number_phone.value;
if (document.formsend1.number_phone.value == ""){
alert("????????????????????????!");
return false;
}
var arr = document.formsend1.number_phone.value.split(',')
n=0;
l = arr.length;
while (n < l){
if (IsNumber(arr[n]) != true) {
alert("???????????????????????????!");
return false;
}
if (arr[n].length < 10){
alert("????????????????? ??????? 10 ??????????? !");
return false;
}
if (arr[n].length >= 11){
alert("????????????????? ??????? 10 ??????????? !");
return false;
}
n++;
}
var str =document.formsend1.text_msg.value;
if ( checkStr( str ) ) {
alert( "????????????? ???? ?????? ??????? ?? SMS");
return false;
}
if(document.formsend1.text_msg.value== "" || document.formsend1.text_msg.value == " "){
alert("???????? Message ???????????");
return false;
}
if(document.formsend1.text_msg.value.length>parseInt(document.formsend1.maxcha.value)){
alert("Message ??????????????????? " + document.formsend1.maxcha.value + " ????????");
return false;
}
if(document.formsend1.send_time.value =="1" ){
document.formsend1.submit();
return true;
}else{
if (document.formsend1.YetAnotherDate.value =="") {
alert("????? ???????? ??????????????? !!");
return false;
}
document.formsend1.submit();
return true;
}
}
ฟังชั่นที่ต้องกหารใส่เพิ่ม
var rudewords = new Array("เลว", "เหี้ย", "มึง", "ควย", "กู", "สัตว์", "เย็ด", "แม่ง", "ชิบ");
for(i = 0; i < rudewords.length; i++){
if(f.text_msg.value.indexOf(rudewords[i]) != -1){
alert("กรุณาใช้คำพูดที่สุภาพด้วยน่ะค่ะ");
return false;
}
}Tag : PHP, JavaScript
Date :
2013-01-25 10:52:20
By :
แอนนา
View :
759
Reply :
2
ที่จริงแล้วไม่จำเป็นต้องพิมพ์คำเหล่านี้มาแสดงก็ได้ครับ ใช้คำอื่นก่อนแล้วค่อยไปเปลี่ยนกลับที่หลัง
Code (JavaScript)
var rudewords = new Array("คำไม่ดี1", "คำไม่ดี2", "คำไม่ดี3", "คำไม่ดี4", "คำไม่ดี5", "คำไม่ดี6", "คำไม่ดี7");
ผมเห็นคำเหล่านี้แล้วหมดความรู้สึกอยากแ้ก้ไขให้เลย
Date :
2013-01-25 12:50:56
By :
dreamlover
Code (PHP)
function Vulgarity(){
var rudewords = new Array("fish", "cat", "rat");
for(i=0;i< rudewords.length;i++){
if(document.formsend1.txtDescription.value.indexOf(rudewords[i]) != -1){
alert("น่าว๊ากกอ่ะ");
return false;
}
}}
</script>
<form name="formsend1">
<input type="text" id="txtDescription" name="txtDescription" onchange="Vulgarity();">
</form>
Date :
2013-01-25 15:24:17
By :
Ex-[S]i[L]e[N]t
Load balance : Server 04