Convert JavaScript to jQuery
Posted
by bloggerious
on Stack Overflow
See other posts from Stack Overflow
or by bloggerious
Published on 2010-03-30T20:06:09Z
Indexed on
2010/03/30
20:13 UTC
Read the original article
Hit count: 330
I have the following JavaScript code which I like to convert to jQuery but has no luck. I would like to convert it to jQuery specifically beginning from this:
<?php if(Voting_Method == 2){
if (mnmxmlhttp[htmlid].readyState == 4) {
xvotesString[htmlid] = mnmxmlhttp[htmlid].responseText;
if (xvotesString[htmlid].match (errormatch)) {
xvotesString[htmlid] = xvotesString[htmlid].substring (6, xvotesString[htmlid].length);
<?php if(Voting_Method == 1){
echo "changemnmvalues (htmlid, value, true);";
}?>
} else {
<?php if(Voting_Method == 2){
echo "var mySplitResult = xvotesString[htmlid].split('~');\n";
echo "target3 = document.getElementById ('xvote-' + htmlid);\n";
echo "target3.style.width = mySplitResult[0] + 'px';\n";
echo "if (target4 = document.getElementById ('mnma-' + htmlid))";
echo " target4.innerHTML = mySplitResult[1];\n";
echo "if (target5 = document.getElementById ('mnmb-' + htmlid))";
echo " target5.innerHTML = mySplitResult[2];\n";
echo "if (target6 = document.getElementById ('mnmc-' + htmlid))";
echo " target6.style.display='none'; \n";
echo "if (target6 = document.getElementById ('mnmd-' + htmlid))";
echo " target6.style.display='block'; \n";
echo "target7 = document.getElementById ('xvotes-' + htmlid);\n";
echo "target7.className = 'star-rating-noh';\n";
}?>
<?php if(Voting_Method == 1){
echo 'if (xvotesString[htmlid].substring (1, 6) == "ERROR") { ';
echo "alert(xvotesString[htmlid]); } else {";
echo "changemnmvalues (htmlid, value, false); } ";
}?>
}
Any help is greatly appreciated.
© Stack Overflow or respective owner