Congratulations to AcaCandy on her 100,000th post!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Tag Cloud
acer black screen blue screen boot bsod computer connection crash css dell driver drivers email error ethernet excel firefox firefox 3 freeze game hard drive internet internet explorer itunes laptop linux malware monitor network networking nvidia outlook outlook 2003 outlook 2007 outlook express partition password problem router slow software sound trojan usb video virus vista windows windows xp wireless
Web Design & Development
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Internet & Networking > Web Design & Development >
Making <div> appear/disappear with javascript


HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free! Click here to join today! We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
Boylett's Avatar
Computer Specs
Member with 49 posts.
 
Join Date: Dec 2006
Experience: Intermediate
05-May-2007, 06:39 AM #1
Making <div> appear/disappear with javascript
I am trying to make a script that will make a <div> appear or disappear depending on what it already is.

So if its appeared, it will disappear and vice versa.

This is what I currently have:
HTML Code:
<body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0" marginwidth="0" marginheight="0" background="pixel.png"> <style type="text/css">
span {
	cursor: pointer;
}
</style> <script type="text/javascript" language="javascript">
var v = new Array(100);
v[0] = 'none';
document.GetElementByID('v0').style.display = 'none';
v[2] = 'none';
document.GetElementByID('v2').style.display = 'none';

function Display(num)
{
	v[num]=(v[num]=='none')?'':'none';
	document.GetElementByID('v'+num).style.display = v[num];
}
</script> <img border="0" src="index.php?image&type=" alt="Map" title="Map" usemap="#playermap" /> <map name="playermap"> <area shape="circle" coords="1500.5649874149,1168.3678480557,3" href="javascript:Display(0);" \><area shape="circle" coords="1213.3671951284,1200.4351679045,3" href="javascript:Display(2);" \></map> <div id="v0" style="position:absolute; left:1500.5649874149; top:1168.3678480557;"><table cellpadding="0" cellspacing="0" border="1" bordercolor="#000000" background="bg.png"><tr><td><font size="2" face="Verdana" color="#FFFFFF">[X2G]Tr1viUm</font></td></tr></table></div> <div style="position:absolute; left:5; top:5;"><span onClick="javascript:alert('Username: [X2G]Tr1viUm\nPlayerid: 0\nHealth: 50\nMoney: 5000\nLevel: 1');"><font size="2" face="Verdana" color="#FFFFFF">(0) [X2G]Tr1viUm</font></span></div> <div id="v2" style="position:absolute; left:1213.3671951284; top:1200.4351679045;"><table cellpadding="0" cellspacing="0" border="1" bordercolor="#000000" background="bg.png"><tr><td><font size="2" face="Verdana" color="#FFFFFF">[X2G]Sneaky</font></td></tr></table></div> <div style="position:absolute; left:5; top:20;"><span onClick="javascript:alert('Username: [X2G]Sneaky\nPlayerid: 2\nHealth: 50\nMoney: 5000\nLevel: 1');"><font size="2" face="Verdana" color="#FFFFFF">(2) [X2G]Sneaky</font></span></div> </body>
Its at this location: http://www.xendot.com/samp/map/

The problem is when I click and activate the href in the <area> tags, it doesnt change the <div> appearance. Its just always appeared.

Can someone help, thanks.
haswalt's Avatar
Computer Specs
Senior Member with 416 posts.
 
Join Date: Nov 2004
Location: South Coast, UK
Experience: Advanced
08-May-2007, 10:12 AM #2
not relaly sure what you need exactly, but you will need to set the style.visibility to 'hidden' or 'visible' you can also check this value of the div to switch on it.

Harry
Closed Thread

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who help people like you solve computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 01:11 AM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.