bang brow .. lo buat testimonial box yang kalo misalkan prend kita mau isi coment gak usah buka send coment ,,, yang box nya ada di bawah view all coment ntuh loeh bang brow... gimana cieh cara nya
tubhi masih bingung nieh bang brow cara nyimpennya
jararin domz bang brow sekalian ok
nieh code nya ,, saya ambil dari post nya bang kanal yg page ke 2
JS code :
Code:
/* auto comment */
if (!attachOnLoadHandler(function(){ COMMENTOR.init()})) window.onload = function(){COMMENTOR.init()};
if (typeof COMMENTOR == "undefined") { COMMENTOR = {}; }
COMMENTOR.vars = {
authcode: "",
linker: "",
base_domain: "http://www.friendster.com"
};
COMMENTOR.init = function() {
var ls=new Array();
var olinks=document.links;
for(var x=0; x<olinks.length;x++) {
if(olinks[x].innerHTML.match(/Post a Comment|Add Comment/)) {
ls.push(olinks[x]);
}
}
COMMENTOR.vars.linker=ls;
COMMENTOR.getCode();
};
COMMENTOR.getCode = function() {
COMMENTOR.vars.linker[0].innerHTML="Please Wait...";
COMMENTOR.vars.linker[1].innerHTML="Please Wait...";
try{COMMENTOR.vars.linker[2].innerHTML="Please Wait...";}catch(e){}
var httprequest= window.XMLHttpRequest? new XMLHttpRequest():new ActiveXObject("Msxml2.XMLHTTP");
httprequest.onreadystatechange=function() {
if (httprequest.readyState==4){
var myregexp = /authcode" value="([\da-z]+?)"/;
var match = myregexp.exec(httprequest.responseText);
COMMENTOR.vars.authcode=match[1];
COMMENTOR.vars.linker[0].innerHTML="Add Comment";
COMMENTOR.vars.linker[0].setAttribute("href","javascript: void(COMMENTOR.openForm())");
COMMENTOR.vars.linker[1].innerHTML="Post a Comment";
COMMENTOR.vars.linker[1].setAttribute("href","javascript: void(COMMENTOR.openForm())");
try{
COMMENTOR.vars.linker[2].innerHTML="Post a Comment";
COMMENTOR.vars.linker[2].setAttribute("href","javascript: void(COMMENTOR.openForm())");}
catch(e){}
}
};
httprequest.open( 'GET', COMMENTOR.vars.base_domain+"/comments.php?uid="+pageOwnerID, true);
httprequest.send(null);
}
COMMENTOR.openForm = function() {
COMMENTOR.vars.linker[0].setAttribute("href","#quickcomment");
COMMENTOR.vars.linker[1].setAttribute("href","#quickcomment");
try{COMMENTOR.vars.linker[2].setAttribute("href","#quickcomment");}catch(e){}
var commform="<div id='bb'><style type='text/css'>.buttonBox{margin-top:5px;margin-bottom:5px}.butter {background: #dddddd; padding: 5px 5px 5px 5px;margin-right: 5px;margin-bottom: 5px}</style><div class=\"strong\">Add a Comment</div>"+
"<div style='DISPLAY: block'>"+
"<p style='font-style: italic; font-size: 90%'>"+
"You can also dress up your testimonial or comment with HTML, CSS and embed images & video! <a href=\"javascript:popup('/info/helpmedia.php',450,400,'yes');\">Click here</a> to find out how to <a href=\"javascript:popup('/info/helpmedia.php',450,400,'yes');\">add videos and images</a>."+
"</p>"+
"<form name='comment_form' id='comment_form' method='post' onsubmit=\"return checkFormSubmit('comment_form');\">"+
"<input type='hidden' name='authcode' value='"+COMMENTOR.vars.authcode+"'><div class='flo466'>"+
"<textarea id='commentTextArea' class='pc_textarea' name='comment' onKeyDown='textCounter(document.comment_form.comment,document.comment_form.inputcount,1000);' onKeyUp='textCounter(document.comment_form.comment,document.comment_form.inputcount,1000);'></textarea><div class='ic'><br />"+
"<input type='hidden' value='submit' name='postaction'><div class='buttonBox'>"+
"<input style='font: 12px tahoma;' class='submitButtons' type='submit' name='submit' onClick='javascript: void(COMMENTOR.send())' value='Submit'> <input style='font: 12px tahoma;' class='cancelButtons' type='reset' name='cancel' onClick='javascript: void(COMMENTOR.cancelForm())' value='Cancel'>"+
"</div>"+
"</div>"+
"<div class='dc'>Characters remaining: "+
"<input id='inputcount' readonly maxlength='4' size='4' value='1000' name='inputcount'>"+
"</div>"+
"</div>"+
"</form>"+
"</div>"+
"</div></div></div>";
addMainBox("Quick Comment Box",commform,"quickcomment","publiccomments_1_7");
location.href="#quickcomment";
}
COMMENTOR.send = function() {
var httprequest= window.XMLHttpRequest? new XMLHttpRequest():new ActiveXObject("Msxml2.XMLHTTP");
httprequest.onreadystatechange=function() {
if (httprequest.readyState==4){
var myregexp = /lc">([\S\s]+?)<div class="commonbox/;
var match = myregexp.exec(httprequest.responseText);
document.getElementById("quickcomment").childNodes[0].innerHTML="Comment Posted";
document.getElementById("quickcomment").childNodes[1].innerHTML=match[1];
COMMENTOR.cancelForm();
}
};
var inputcount=document.getElementById("inputcount").value;
var comment=document.getElementById("commentTextArea").value;
var param="&authcode="+COMMENTOR.vars.authcode+"&postaction=submit&inputcount="+inputcount+"&comment="+encodeURI(comment);
httprequest.open( 'POST', COMMENTOR.vars.base_domain+"/comments.php?uid="+pageOwnerID, true);
httprequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
httprequest.setRequestHeader("Content-length", param.length);
httprequest.setRequestHeader("Connection", "close");
httprequest.send(param);
document.getElementById("quickcomment").childNodes[0].innerHTML="Posting comment, please wait..." ;
document.getElementById("quickcomment").childNodes[1].innerHTML="" ;
location.href="#quickcomment";
}
COMMENTOR.cancelForm = function() {
setTimeout("document.getElementById('quickcomment').parentNode.removeChild(document.getElementById('quickcomment'));location.href='#publiccomments_1_7'",1000);
COMMENTOR.init();
}
function addMainBox (head,htm,id,bro_id) {
var ul=document.getElementById("controlpanel_1_1").parentNode;
var bro=document.getElementById(bro_id).parentNode;
try {
var li=document.createElement("li");
} catch(e) {
var li=document.createElement("<li>");
}
li.innerHTML= "<div id='"+id+"' class='commonbox "+id+"'>"+
"<h2>"+head+"</h2>"+
"<div id='content_"+id+"'>"+
"<div class='boxcontent'>"+
htm+
"</div>"+
"</div>"+
"</div>";
ul.parentNode.insertBefore(li,bro);
}
CSS code :
Code:
/* CUSTOMIZED COMMENT BOX FORM */
#quickcomment {
border: 2px 'solid' #HEX VALUE;
background-color: transparent;
background: url(BACKGROUND URL);
background-position: center center;
background-repeat: repeat;
}
.pc_textarea {
width: 490px;
height: 150px;
background-color: transparent;
border: 2px 'solid' #HEX VALUE;
color: #HEX VALUE;
font-family: 'FONT STYLE';
font-size: ##px;
font-weight: normal;
rows='3' cols='83'
}
:midfinger: :midfinger: :midfinger:
di atas bang ,, gimana cieh
,, ajarin yahg
tanks yah brow