var xmlhttp_post = false; try {xmlhttp_post = new ActiveXObject("Msxml2.xmlhttp_post"); } catch (e) { try { xmlhttp_post = new ActiveXObject("Microsoft.xmlhttp_post"); } catch (E) { xmlhttp_post = false; } } if (!xmlhttp_post && typeof XMLHttpRequest != 'undefined') { xmlhttp_post = new XMLHttpRequest(); } var xmlhttp_get = false; try {xmlhttp_get = new ActiveXObject("Msxml2.xmlhttp_post"); } catch (e) { try { xmlhttp_get = new ActiveXObject("Microsoft.xmlhttp_post"); } catch (E) { xmlhttp_get = false; } } if (!xmlhttp_get && typeof XMLHttpRequest != 'undefined') { xmlhttp_get = new XMLHttpRequest(); } function checkComment(){ // alert(document.getElementById("txtName").value); return false; var err=0; var url=""; var err_email=0; var temp=""; var regex_email=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; if(document.getElementById("txtName").value==""){ err++; errObj("txtName"); } if(document.getElementById("txtEmail").value==""){ err++; errObj("txtEmail"); } if(!regex_email.test(document.getElementById("txtEmail").value)){ err_email++; errObj("txtEmail"); } if(document.getElementById("txtComment").value==""){ err++; errObj("txtComment"); } if(document.getElementById("txtSecurity").value==""){ err++; errObj("txtSecurity"); } if(err<1 && err_email<1){ url='http://jogjamarket.com/do-add-review-comment/give-this-post-a-comment.html'; xmlhttp_post.open('POST',url, true); xmlhttp_post.onreadystatechange = function() { if ( xmlhttp_post.readyState == 4 && xmlhttp_post.status == 200 ) { if(xmlhttp_post.responseText==0){ document.getElementById("img_loader").innerHTML="Serba-serbi tidak ditemukan"; } else if(xmlhttp_post.responseText==2){ document.getElementById("img_loader").innerHTML="Periksa kembali kode keamanan anda."; } else { location.href=xmlhttp_post.responseText; } } else {document.getElementById("img_loader").innerHTML=' loading..';} } var poststr = 'id=' + encodeURI(document.getElementById("id").value) + '&name=' + encodeURI(document.getElementById("txtName").value) + '&email=' + encodeURI(document.getElementById("txtEmail").value) + '&web='+ encodeURI(document.getElementById("txtWeb").value) + '&comment=' + encodeURI(document.getElementById("txtComment").value) + '&security=' + encodeURI(document.getElementById("txtSecurity").value); xmlhttp_post.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xmlhttp_post.setRequestHeader('Content-length', poststr.length); xmlhttp_post.setRequestHeader('Connection', 'close'); xmlhttp_post.send(poststr); } else if(err>0){ document.getElementById("img_loader").innerHTML="Item dibutuhkan(*) tidak boleh kosong."; } else { document.getElementById("img_loader").innerHTML="Periksa format email anda."; } return false; } function errObj(obj){ document.getElementById(obj).style.background='#ffebe8'; document.getElementById(obj).style.border='1px solid #cc0000'; } function ckField(obj){ if(obj.value==""){ obj.style.background='#ffebe8'; obj.style.border='1px solid #cc0000'; } else { obj.style.background='#fff'; obj.style.border='1px solid #ccc'; } } function textCount(field, countfield) { var maxlimit=500; if (field.value.length > maxlimit) { field.value = field.value.substring(0, maxlimit); } else { countfield.value = maxlimit - field.value.length; } }