/    Sign up×
Community /Pin to ProfileBookmark

Hi, I’m trying to build a selectbox without using the common selectbox tag.
I planned to use a input object and a layer to show and to hide. If I have no problem showing the layer, just putting the code in the onclick event of the input, I get some trouble hiding it: I want to cloak it when it loses his focus but the div tag doesn’t have the blur event, only the layer tag, but it’s supported just by netscape.
So to hide it I tought to put the code for hiding it at window.click and to set cancelbubble to the input tag.
In that way it should works when clicking on the body of the page but not when resizing or doing anything out of the html area of the page.
I wondered how scripts like the one you can get at [url]http://webfx.eae.net/dhtml/dhtmlmenu4/demos.html[/url] catch the click out of the page and hide the layer.
Thank you

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@PittimannMay 19.2004 — Hi!

For my self made "select box" I am using a global variable. I called it isActive. At the beginning of my script, I have:

var isActive=0;

In my body tag:

<body onmouseup="if(isActive==0)document.getElementById('divToHide').style.visibility='hidden'">

And in my div tag:

<div id='divToHide' onmouseout="isActive=0;" onmouseover="isActive=1;">

I am using the stuff like described above to avoid, that the div is hidden in Mozilla, when the user clicks the scrollbar of the "select"...

Hope that helps.

Cheers - Pit
×

Success!

Help @echo1 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,
)...