The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
|
#1
|
||||
|
||||
javascript and vbulletin-ajax editor
In my forum i have a javascript function for display the multiple images that used in user ranks. that save a bit repeating html in every page and works for my custom rank system.
Code:
function rank(number,color){ document.open(); for(i=0;i<number;i++){ document.write('<img src=\"$stylevar[imgdir_rating]/rank_'+color+'.gif" />'); } document.close(); } Code:
<script type="text/javascript">rank(5,'1');</script> The problem start when i apply the quickpost and editor in postbit. the new/edited message doesnt load the function. I read in internet alot for the problem and i found the solution (or i was think i do). The document.write doesnt work after the page is load and either work with xml, so, i try a DOM based solution like this: Code:
function rank(number,color,id){ for(i=0;i<number;i++){ imgrank=document.createElement('img'); imgrank.setAttribute('src','$stylevar[imgdir_rating]/rank_'+color+'.gif'); document.getElementById('rank_'+id).appendChild(imgrank); } } Now the question is, what method i need to use for preserve the function after editing a post? The doc.write and DOM solutions fails and i not much skilled in the JS area Regards Victor |
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|