Razorster Posted September 3, 2009 Share Posted September 3, 2009 Hi there, I really hope someone can help me out on this. I've got a list of items generated using a php script: http://www.liftedmusic.co.uk/home/index.php?option=com_podcast&view=album&id=&Itemid=38 Upon clicking on track listing, text should expand for that item. I am not sure how to get this to work for each item without opening the wrong tracklisting (of another item) upon clicking an items track listing. If you click PODCAST013, the top podcast track listing opens. The script code is below: <div class="div1" onclick="expand('text1', this);"><h2 class="tracklistingtext">TRACKLISTING +</h2></div> <span id="text1" style="display:none;"> <div class="tracklistingitems"> <?php echo $this->detail_album->review; ?> <---- This displays the text for tracklisting </div> </span> This is the javascript code I am using: <script type="text/javascript"> function expand(thistag, tag) { styleObj=document.getElementById(thistag).style; if (styleObj.display=='none') { styleObj.display=''; tag.innerHTML = "<h2 class=\"tracklistingtext\">TRACKLISTING:</h2>"; } else { styleObj.display='none'; tag.innerHTML = "<h2 class=\"tracklistingtext\">TRACKLISTING +</h2>"; } } </script> I'd much appreciate it if someone could help me out, or at least tell me if its possible to do what I want. Thanks so much! Quote Link to comment https://forums.phpfreaks.com/topic/172989-solved-expand-text-using-java-on-multiple-items/ Share on other sites More sharing options...
MatthewJ Posted September 3, 2009 Share Posted September 3, 2009 It looks like you're trying to use the same name for the different tracklists... You need to tell the link you're clicking to open the proper list by giving the divs holding them unique names (right now they both have the id "text1"). Not familiar with Joomla, but viewing the source of your link, there is a lot of stuff going on in there not the least of which is multiple head and body sections. good luck Quote Link to comment https://forums.phpfreaks.com/topic/172989-solved-expand-text-using-java-on-multiple-items/#findComment-911720 Share on other sites More sharing options...
Razorster Posted September 3, 2009 Author Share Posted September 3, 2009 Thanks for the reply matt. How would I go about setting unique names for each div in a script that generates each item automatically? Could I use the id the script generates for each item? I know whats there, but im not sure how to piece it together. Any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/172989-solved-expand-text-using-java-on-multiple-items/#findComment-911726 Share on other sites More sharing options...
Razorster Posted September 3, 2009 Author Share Posted September 3, 2009 Problem solved, I set the item id as the div id and the source to expand the text. Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/172989-solved-expand-text-using-java-on-multiple-items/#findComment-911732 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.