eatspinach

msg:3947597 | 11:25 am on Jul 7, 2009 (gmt 0) |
I seemed to have solved my own problem, here is my solution.. <script type='text/javascript'> var questions="<?php echo $hideMe; ?>"; var arry = questions.split(', '); for(var i=0; i<arry.length; i++){ element = document.getElementById(arry[i]); element.style.display="none"; alert(arry[i]); } </script>
|
DrDoc

msg:3947832 | 5:23 pm on Jul 7, 2009 (gmt 0) |
That's actually better handled by PHP itself. <style type="text/css"> <?=$hideMe?> { display: none; } </style> Now, whether $hideMe is only a single element or contains a comma separated list of elements, they will all be hidden.
|
eatspinach

msg:3948239 | 8:11 am on Jul 8, 2009 (gmt 0) |
You are right my way turned out to be a little buggy.. Thanks a million :)
|
whoisgregg

msg:3948629 | 7:39 pm on Jul 8, 2009 (gmt 0) |
DrDoc's solution is far more reliable. However, short tags and the shorthand echo (the <?=) are both deprecated and may not be supported in future versions of PHP. Your code will last longer if you go ahead and use the full echo statement:
|
|