/    Sign up×
Community /Pin to ProfileBookmark

Toggle floating box

Hey, i have made a floating box which can be shown and hidden by clicking on two other images, however i was wondering whether i could use one button to toggle the floating box.

This is the code i am currently using to control it;

<a href=”#” onclick=”return floatingMenu.show()”>
<div id=”floatdiv” style=”

position:absolute;

width:2px;height:2px;left:1410px;top:30px;

padding:1px;background:#FFFFFF;

border:0px solid #2266AA”>

<IMG src=”http://bmilne.webs.com/info.png“>
</div> </a>

<a href=”#” onclick=”return floatingMenu.hide()””>
<div id=”floatdiv” style=”

position:absolute;

width:2px;height:2px;left:1410px;top:30px;

padding:1px;background:#FFFFFF;

border:0px solid #2266AA”>

<IMG src=”http://bmilne.webs.com/info.png“>
</div></a>

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@FangDec 12.2009 — function hideShow() {
var floatdiv=document.getElementById('floatdiv').style;
floatdiv.display=(floatdiv.display=='none')? '' : 'none';
}
Copy linkTweet thisAlerts:
@xdotauthorDec 12.2009 — Thankyou for your reply, how would i apply this to my case?
Copy linkTweet thisAlerts:
@FangDec 12.2009 — &lt;a href="#" onclick="hideShow(); return false;"&gt;
Copy linkTweet thisAlerts:
@xdotauthorDec 12.2009 — Ah yes perfect, thank you very much.
×

Success!

Help @xdot spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...