The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

Script problem

View previous topic View next topic Go down

Solved Script problem

Post by Pamoon on February 6th 2016, 1:50 pm

Hi, i post this to ask that why my code isnt working well, at least it worked.
Code:
<!-- BEGIN switch_vote_active -->
<div id="pacount{comment.displayed.U_POST_ID}" class="pavotecmnt">
<span class="gensmall">
<script type="text/javascript"> var str ='{comment.displayed.switch_vote_active.L_VOTE_TITLE}'; if (str=="Message not voted") {str="Not liked.";document.write(str); } else {str=str.replace("Message reputation :",""); str=str.replace("100%",""); str=str.replace("(",""); str=str.replace(")","");str=str.replace("vote","likes."); str=str.replace("s",""); document.write(str); }</script>
</span></div>
<!-- BEGIN switch_vote -->
<span class="pavotecmnt"id="{comment.displayed.U_POST_ID}">
<a href="{comment.displayed.switch_vote_active.switch_vote.U_VOTE_PLUS}" target="v{comment.displayed.U_POST_ID}v" onclick="document.getElementById('{comment.displayed.U_POST_ID}').innerHTML='';var str ='{comment.displayed.switch_vote_active.L_VOTE_TITLE}'; if (str=='Message not voted') {str='Not liked.'; }else {str=str.replace('Message reputation :',''); str=str.replace('100%',''); str=str.replace('(',''); str=str.replace(')','');str=str.replace('vote','likes.'); str=str.replace('s',''); } if(str=='Not liked.') {str='1 like.'; }else{ for (i=0; i<=(str.length-1);i++) {if (str.charCodeAt(i)>=48 && str.charCodeAt(i)<=57 && str.charAt(i+1)==' ') {str=str.replace(String.fromCharCode(str.charCodeAt(i)),String.fromCharCode((str.charCodeAt(i))+1));}}}document.getElementById('pacount{comment.displayed.U_POST_ID}').innerHTML='<span class=gensmall>'+ str+'</span>'; ">Like</a>
</span>
<!-- END switch_vote --><!-- END switch_vote_active -->
This code is worked, but it cant show the text correctly, it doesnt show "x like." (or "x likes.") but "x like.s" or something even worse than it.


Last edited by Draud0229 on February 6th 2016, 2:08 pm; edited 1 time in total

Pamoon
Forumember

Posts : 25
Reputation : 10
Language : en.js

http://animoe.twilight-mania.com/

Back to top Go down

Solved Re: Script problem

Post by Genesis on February 6th 2016, 1:57 pm

Try this:
Code:
<!-- BEGIN switch_vote_active -->
<div id="pacount{comment.displayed.U_POST_ID}" class="pavotecmnt">
<span class="gensmall">
<script type="text/javascript"> var str ='{comment.displayed.switch_vote_active.L_VOTE_TITLE}'; if (str=="Message not voted") {str="Not liked.";document.write(str); } else {str=str.replace("Message reputation :",""); str=str.replace("100%",""); str=str.replace("(",""); str=str.replace(")","");str=str.replace("vote","likes"); str=str.replace("s",""); document.write(str); }</script>
</span></div>
<!-- END switch_vote_active --> <!-- BEGIN switch_vote_active --><!-- BEGIN switch_vote -->
<span class="pavotecmnt"id="{comment.displayed.U_POST_ID}">
<a href="{comment.displayed.switch_vote_active.switch_vote.U_VOTE_PLUS}" target="v{comment.displayed.U_POST_ID}v" onclick="document.getElementById('{comment.displayed.U_POST_ID}').innerHTML='';var str ='{comment.displayed.switch_vote_active.L_VOTE_TITLE}'; if (str=='Message not voted') {str='Not liked'; }else {str=str.replace('Message reputation :',''); str=str.replace('100%',''); str=str.replace('(',''); str=str.replace(')','');str=str.replace('vote','likes'); str=str.replace('s',''); } if(str=='Not liked') {str='1 like'; }else{ for (i=0; i<=(str.length-1);i++) {if (str.charCodeAt(i)>=48 && str.charCodeAt(i)<=57 && str.charAt(i+1)==' ') {str=str.replace(String.fromCharCode(str.charCodeAt(i)),String.fromCharCode((str.charCodeAt(i))+1));}}}document.getElementById('pacount{comment.displayed.U_POST_ID}').innerHTML='<span class=gensmall>'+ str+'</span>'; ">Like</a>
</span>
<!-- END switch_vote --><!-- END switch_vote_active -->

Genesis
Helper
Helper

Male Posts : 2331
Reputation : 322
Language : English
Location : Forumountain

http://forumpromocean.com

Back to top Go down

Solved Re: Script problem

Post by Pamoon on February 6th 2016, 2:06 pm

so to fix it is just remove "."? ._. thank sir.

Pamoon
Forumember

Posts : 25
Reputation : 10
Language : en.js

http://animoe.twilight-mania.com/

Back to top Go down

Solved Re: Script problem

Post by Genesis on February 6th 2016, 2:27 pm

Draud0229 wrote:so to fix it is just remove "."? ._. thank sir.
You're very much welcome.

Genesis
Helper
Helper

Male Posts : 2331
Reputation : 322
Language : English
Location : Forumountain

http://forumpromocean.com

Back to top Go down

Solved Re: Script problem

Post by SLGray on February 6th 2016, 8:42 pm

Topic solved and archived


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36705
Reputation : 2445
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum