473,472 Members | 2,139 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Show/Hide DIV on delay

9 New Member
I've seen plenty of scripts for showing/hiding divs, and i'm no javascript expert, but I need a hidden DIV to appear after a delay. It's for lead capture purposes so I need the div to close by someone manually closing it or filling out the short information form.

I've come across a few functions that handle the delay but I don't know where to start merging that with the show/hide function.

Thanks in advance for your help.
Dec 2 '07 #1
5 3875
Markus
6,050 Recognized Expert Expert
I've seen plenty of scripts for showing/hiding divs, and i'm no javascript expert, but I need a hidden DIV to appear after a delay. It's for lead capture purposes so I need the div to close by someone manually closing it or filling out the short information form.

I've come across a few functions that handle the delay but I don't know where to start merging that with the show/hide function.

Thanks in advance for your help.
Could you post some of the code you have?

We could then work with what you have :)
Dec 2 '07 #2
colt28
9 New Member
Thanks for your reply. I actually figured it out in the meantime, BUT I would like to know how I'd go about making the DIV close once someone fills out the form. Here's what i've got...

[HTML]<script>
setTimeout("document.getElementById(\"formlayer\") .style.visibility=\"visible\"",5000)
</script>


<script language=javascript type='text/javascript'>
function hidediv() {
if (document.getElementById) { // DOM3 = IE5, NS6
document.getElementById('formlayer').style.visibil ity = 'hidden';
}
else {
if (document.layers) { // Netscape 4
document.hideShow.visibility = 'hidden';
}
else { // IE 4
document.all.hideShow.style.visibility = 'hidden';
}
}
}
</script>


<style type="text/css">
<!--
#formlayer {
background-color: #ffffff;
margin: 0px;
position: absolute;
visibility: hidden;
z-index: 1000;
height: 100%;
width: 100%;
filter:alpha(opacity=75);
-moz-opacity:0.75;
opacity:0.75;
}
-->
</style>


<body>
<div id="formlayer"><a href="javascript:hidediv()">Placeholder text for closing the div.</a></div>
[/HTML]
Dec 2 '07 #3
acoder
16,027 Recognized Expert Moderator MVP
BUT I would like to know how I'd go about making the DIV close once someone fills out the form.
Check the form elements onchange. Once all fields are filled in, set the style.visibility property to "hidden" again.

Show the form code.
Dec 3 '07 #4
colt28
9 New Member
I'm back :)

After doing a pretty good job of figuring most of this stuff out, I'm stuck. I've gotten the div to appear after a number of seconds with the lead capture form. Now I need the form to submit, send an email and close the div all at the same time.

The form script i'm using posts the information to a php file which sends the email. This is no good obviously because i don't want to leave the page.

Is it smarter to open a new window and send the information to the php file or use a different script?

Any advice is welcome.

Thanks.
Dec 5 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
Now I need the form to submit, send an email and close the div all at the same time.

The form script i'm using posts the information to a php file which sends the email. This is no good obviously because i don't want to leave the page.

Is it smarter to open a new window and send the information to the php file or use a different script?
Use Ajax to submit the form and send the email. This means you won't leave the page.
Dec 5 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Steve | last post by:
Visual Studio 2003 C# Windows: I have a tree view control as my main menu control down the left side of my application. This has 2 Parent Nodes on it (Jobs and Employees). beneath these 2 main...
0
by: Efkas | last post by:
I have a full custom application with some widged extending Controls like Label and PictureBox. I build a menu with these widgets. When I click on one of them, it calls a function to display...
7
by: Steve Kallal | last post by:
I have seen this subject tossed around in this forum before. But in my case I need a simple solution. I do NOT need to show progress in terms on percentage complete. But rather I need to show a...
5
by: ali | last post by:
Hello every one i need you help regarding div hide and show. i am having a link like <a href="#" onClick="expandWin()">show/hide </a> <div id=showHide> </div> within div i have lots of...
1
by: proplady | last post by:
I've had this menu for some time, and periodically make changes. I've made some changes now (just some menu items), and the menu will not show up on my webpages. I know it's something simple,...
3
by: Patrick Dugan | last post by:
I am using VS2005 (vb) and I have a program that starts when Windows boots up. Occasionally the icon that should appear in the system tray does not show up. The program is still running in memory...
1
by: pamate | last post by:
hi, I want to show hide layers. I am able to show and hide layers but i am facing problem that, cant view the cursor in Mozilla,but i can type in input text box, its overlapping the layers. ...
1
oranoos3000
by: oranoos3000 | last post by:
hi would you please help me i have a online shopping center that i show pictures of the my product in home page. in the InterExplorer pictures is shown correctly but in Firefox browser is shown...
0
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,...
0
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,...
0
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...
1
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...
0
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...
0
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,...
1
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.