473,700 Members | 2,809 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="visibili ty: hidden; etc...
Aug 11 '05 #1
10 1953
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="visibili ty: 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**@martinkur z.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="visibili ty: 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="javascrip t://" onClick="showfo rm('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="visibili ty: hidden; etc...


if you like yoyo efects :

<did id="form" style="visibili ty:hidden;displ ay:none" ...>

onclick="with(d ocument.getElem entById('form') .style){
visibility='vis ible';
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="javascrip t://" onClick="showfo rm('commentform ')">


function showform(mydiv) {
var d = document.getEle mentById(mydiv) .style;
d.display = (d.display=='vi sible')? '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="javascrip t://" onClick="showfo rm('commentform ')">

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

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

Mick

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

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

Mick


Oooppss ! :-(

but (as I think default is 'none')

d.display=d.dis play=='none'?'b lock':'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.getEle mentById(mydiv) .style;
d.display = (d.display=='vi sible')? 'hidden' : 'visible';
}

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

Mick

Oooppss ! :-(

but (as I think default is 'none')

d.display=d.dis play=='none'?'b lock':'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.getEle mentById(mydiv) .style;
d.display = (d.display=='vi sible')? 'hidden' : 'visible';
}

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

Mick


Oooppss ! :-(

but (as I think default is 'none')

d.display=d.dis play=='none'?'b lock':'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.dis play=='none'?'b lock':'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.getEle mentById(mydiv) .style;
> d.display = (d.display=='vi sible')? 'hidden' : 'visible';
> }
>
d.display=d.dis play=='none'?'' :'none';

Mick
Oooppss ! :-(

but (as I think default is 'none')

d.display=d.dis play=='none'?'b lock':'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.dis play=='none'?'b lock':'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

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

Similar topics

1
1873
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
2635
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" size="32" maxlength="32" name="Name0" id="Name0"></div>
1
5776
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
18457
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 versions of Internet Explorer, Netscape and Mozilla. With Opera, however, users receive a...
9
2281
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 have changed the values in the meantime I thought about using the “onbeforeunload” event of the...
5
7439
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
6646
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 of 8-bit right shifts followed by ORs with 255 as input to the XOR. E.g.
12
7218
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 VERY spread out. I could probably save 80% of the space if I could get rid of the extra white space....
0
8721
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
8642
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9209
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9069
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8918
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5900
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4400
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3085
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2385
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.