It is currently Wed Feb 08, 2012 5:38 pm

All times are UTC + 2 hours [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: javascript links bringing up white page
PostPosted: Mon Feb 22, 2010 8:17 pm 
Offline

Joined: Fri Jun 06, 2008 7:23 pm
Posts: 13
Here's what I'm trying to do: I need a div to pop-up below a list item with more information (that will basically describe the list item in detail). I also need the div code to be included on the same page- not called from a separate php file.

I've cut out the bulky content and included the styles attached to the elements in the code below (instead of leaving the classes I'm using).

Code:
<ul>
<li><a rel="nofollow" href="javascript:document.getElementById('1').style.display='inline'">First List Item</a> <br />
<div id="1" style="display:none;">
Pop-up content.
</div>
</li>

<li><a rel="nofollow" href="javascript:document.getElementById('2').style.display='inline'">Second List Item</a><br />
<div id="2"  style="display:none;">
More Pop-up content.
</div>
</li>
</ul>


This works fantastic in Safari... but for some reason, not in firefox. (these are the only two I've tested). In Firefox, clicking the links opens a blank white page with the sinlge word inline.

Any idea why this is happening and how to fix it? Or a more efficient way of accomplishing this task (without a mess of attached .js files),

Thanks!


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 22, 2010 9:20 pm 
Offline

Joined: Sun May 02, 2004 11:34 pm
Posts: 6500
Location: toronto, canada
try setting the rel="nofollow" href="#" and then using an onclick

Code:
<html><body><ul>
<li><a rel="nofollow" href="#" onclick="javascript:document.getElementById('1').style.display='inline'">First List Item</a> <br />
<div id="1" style="display:none;">
Pop-up content.
</div>
</li>

<li><a rel="nofollow" href="#" onclick="javascript:document.getElementById('2').style.display='inline'">Second List Item</a><br />
<div id="2"  style="display:none;">
More Pop-up content.
</div>
</li>
</ul>
</body></html>


Tested in FF, Opera, Chrome, Safair, IE on windows xp

_________________
Lostboy

Cat, the other other white meat

Please read Posting Etiquette before posting

You can always try Google


Top
 Profile  
 
 Post subject:
PostPosted: Mon Feb 22, 2010 9:32 pm 
Offline

Joined: Fri Jun 06, 2008 7:23 pm
Posts: 13
thank's a million lostboy! Works perfectly!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC + 2 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
cron