473,516 Members | 3,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Folding closed space for a hidden form

I'm making a form that is hidden until someone clicks on a link to open it.
I can hide the form, but there is just a large white space on the screen
where the form is hiding. Is there any way to close the white space when
the form is not showing? At the moment I'm using a <div> and hiding the
visibility, and then making it visible when the link is clicked:

<div id="form" style="visibility: hidden; etc...
Aug 11 '05 #1
10 1930
Hello,

web_design schrieb:
I'm making a form that is hidden until someone clicks on a link to open it.
I can hide the form, but there is just a large white space on the screen
where the form is hiding. Is there any way to close the white space when
the form is not showing? At the moment I'm using a <div> and hiding the
visibility, and then making it visible when the link is clicked:

<div id="form" style="visibility: hidden; etc...


Just set the divs display to none instead of visibility to hidden, that's all.

Some Background: Visibilty just makes the div invisible without taking the room,
the div would take if it would be visible. A div is a block-Tag, so you can
switch a div on and off by setting display to block or none.
Aug 11 '05 #2

"Martin Kurz" <in**@martinkurz.in-berlin.de> wrote in message
news:11***************@elch.in-berlin.de...
Hello,

web_design schrieb:
I'm making a form that is hidden until someone clicks on a link to open
it.
I can hide the form, but there is just a large white space on the screen
where the form is hiding. Is there any way to close the white space when
the form is not showing? At the moment I'm using a <div> and hiding the
visibility, and then making it visible when the link is clicked:

<div id="form" style="visibility: hidden; etc...


Just set the divs display to none instead of visibility to hidden, that's
all.

Some Background: Visibilty just makes the div invisible without taking the
room,
the div would take if it would be visible. A div is a block-Tag, so you
can
switch a div on and off by setting display to block or none.


Thanks for that tip. It works great.

Do you know if there is an easy way to set my link to *toggle* the display?
Right now I have a link that shows the form, but to close it I had to make a
separate button on the form. I'd prefer that someone could click on the
link to open it, and then click again to close it.

This is my link:
<a href="javascript://" onClick="showform('commentform')">
Aug 11 '05 #3
ASM
web_design wrote:
Is there any way to close the white space when
the form is not showing? At the moment I'm using a <div> and hiding the
visibility, and then making it visible when the link is clicked:

<div id="form" style="visibility: hidden; etc...


if you like yoyo efects :

<did id="form" style="visibility:hidden;display:none" ...>

onclick="with(document.getElementById('form').styl e){
visibility='visible';
display='block';
}"
--
Stephane Moriaux et son [moins] vieux Mac
Aug 11 '05 #4
ASM
web_design wrote:
I'd prefer that someone could click on the
link to open it, and then click again to close it.

This is my link:
<a href="javascript://" onClick="showform('commentform')">


function showform(mydiv) {
var d = document.getElementById(mydiv).style;
d.display = (d.display=='visible')? 'hidden' : 'visible';
}
--
Stephane Moriaux et son [moins] vieux Mac
Aug 11 '05 #5
ASM wrote:
web_design wrote:
I'd prefer that someone could click on the link to open it, and then
click again to close it.

This is my link:
<a href="javascript://" onClick="showform('commentform')">

function showform(mydiv) {
var d = document.getElementById(mydiv).style;
d.display = (d.display=='visible')? 'hidden' : 'visible';
}

d.display=d.display=='none'?'':'none';

Mick

Aug 11 '05 #6
ASM
Mick White wrote:
ASM wrote:
function showform(mydiv) {
var d = document.getElementById(mydiv).style;
d.display = (d.display=='visible')? 'hidden' : 'visible';
}

d.display=d.display=='none'?'':'none';

Mick


Oooppss ! :-(

but (as I think default is 'none')

d.display=d.display=='none'?'block':'none';

--
Stephane Moriaux et son [moins] vieux Mac
Aug 11 '05 #7
ASM wrote:
Mick White wrote:
ASM wrote:
function showform(mydiv) {
var d = document.getElementById(mydiv).style;
d.display = (d.display=='visible')? 'hidden' : 'visible';
}

d.display=d.display=='none'?'':'none';

Mick

Oooppss ! :-(

but (as I think default is 'none')

d.display=d.display=='none'?'block':'none';


If you toggle between '' and 'none' (as suggested by Mick) it will work
for any element, block or otherwise. There are 13 different values for
the display attribute in the default HTML 4 style sheet, though not all
browsers support all of them.

<URL:http://www.w3.org/TR/2005/WD-CSS21-20050613/sample.html>
--
Rob
Aug 12 '05 #8
ASM
RobG wrote:
ASM wrote:
Mick White wrote:
ASM wrote:

function showform(mydiv) {
var d = document.getElementById(mydiv).style;
d.display = (d.display=='visible')? 'hidden' : 'visible';
}

d.display=d.display=='none'?'':'none';

Mick


Oooppss ! :-(

but (as I think default is 'none')

d.display=d.display=='none'?'block':'none';


If you toggle between '' and 'none' (as suggested by Mick) it will work
for any element, block or otherwise.


Usually : yes

However, What I wanted to say was
the div(s) to show/hide is(are) 1st styled with { display: none }
so, I think the correct code would have to be :

d.display=d.display=='none'?'block':'none';

Of course, to be compatible with eventual disabled JS
it would be better :
- to use a function to hide the shown div(s)
- then to use Mick's code

--
Stephane Moriaux et son [moins] vieux Mac
Aug 12 '05 #9
ASM wrote:
RobG wrote:
ASM wrote:
Mick White wrote:

ASM wrote:

> function showform(mydiv) {
> var d = document.getElementById(mydiv).style;
> d.display = (d.display=='visible')? 'hidden' : 'visible';
> }
>
d.display=d.display=='none'?'':'none';

Mick
Oooppss ! :-(

but (as I think default is 'none')

d.display=d.display=='none'?'block':'none';


If you toggle between '' and 'none' (as suggested by Mick) it will
work for any element, block or otherwise.

Usually : yes

However, What I wanted to say was
the div(s) to show/hide is(are) 1st styled with { display: none }
so, I think the correct code would have to be :

d.display=d.display=='none'?'block':'none';


That infers that '' is incorrect, which it isn't. Setting the display
to '' means that it will return to the default or whatever it might
have been set to in a style rule.

Using none/'' has further benefits as: the OP is free to apply a
display attribute via CSS rule should that be required at some later
time without any modification to the script; and the script is
suitable for any element, not just those that have display:block by
default.

Some scripts toggle using none/block for table elements, which works
fine in some browsers but not in those where table elements are styled
with the appropriate CSS table display attribute values (table-cell,
table-row, etc.). On the other hand, none/'' will work fine for both.

In light of the above, I think none/'' is a better solution.

[...]

--
Rob
Aug 12 '05 #10
ASM
RobG wrote:
Setting the display
to '' means that it will return to the default or
whatever it might have been set to in a style rule.

--------------------^-----------^

OK, I'll try to remember :-)

--
Stephane Moriaux et son [moins] vieux Mac
Aug 12 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1867
by: ramata | last post by:
<% name = request.Form("name") response.Write "hello " & request.Form("name") ' if name is empty then store some string with space in it ' problem is the word before space 'mr' is passed, but 'programer' is not passed if len(name)=0 then
2
2611
by: D. Alvarado | last post by:
Hello I have 5 divs, and initially the lower 4 are hidden. I would like everything beneath the 5th div to appear flush against the first visible div. But right now, there is a gap of white space between the first visible div, and everything beneath the 5th. Here is this code: <form name="f"> <div id="Item0">Item 1:<input type="text"...
1
5759
by: Andrew Wrigley | last post by:
Hi Should a hidden form become visible when all other forms are closed? This is what happens, and to ensure that it is always hidden, I have to set the on got focus event handler of the form to Me.Visible = False to ensure that it is always hidden, no matter what.
0
18437
by: BGS | last post by:
I have a web site (www.on-the-matrix.com) that displays photos in a "slide show" format on ASPX pages that run in an inline frame on an ASP page (or in a separate pop-up window). The ASPX pages use a hidden form to transmit information back to the server so it will know which is the next photo to load. All of this works as intended in modern...
9
2274
by: Daniel Walzenbach | last post by:
Hi I am faced with the following problem: I have a page (let’s call this page page1.aspx) containing some TextBoxes and a hyperlink which opens another page (let’s call this page page2.aspx) as a popup using either window.open or window.showModalDialog. Since I want to warn the users of my application when they try to close page1.aspx and...
5
7426
by: AP | last post by:
IS there a way to run a procedure if the users close access directly rather than closing a menu screen that I have built? There is an event that works on close for this form, but it doesnt seem to run if the form is open and the suer just closes access all together, is there a way around this? Thanks
5
6621
by: robert.h.lowe | last post by:
Hi, I'm looking for a computationally fast means of XOR folding the individual bytes of an unsigned 32-bit int, and an unsigned 16-bit int. Can I point a char * at the address of each of the int's (in succession), and safely access each byte? Danger, danger, Will Robinsin!?? Any better ideas?? I'm assuming this is faster than a series...
12
7191
by: JA | last post by:
Is there a way to remove all the white space in the fields? I have been using Find-and-replace - looking for 2 or 3 or 4 or 10 spaces and replacing them with none. I don't want to replace single spaces, those are the spaces between the words. But most of what is in the fields has been cut-n-pasted from online forms, and the results can be...
0
7276
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7548
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5714
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.