473,606 Members | 2,110 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Creating temporary links that expire?

I am developing a web site for a summer comedy series. The site has
links to buy tickets but I want them to disappear two hours before the
show begins. Does anyone know how to use a simple javascript that
shows and hides text and links after a date has passed?

lee317
Jul 23 '05 #1
3 6574
Lee
Levi said:

I am developing a web site for a summer comedy series. The site has
links to buy tickets but I want them to disappear two hours before the
show begins. Does anyone know how to use a simple javascript that
shows and hides text and links after a date has passed?


This example only hides the "buy" link after the date has passed
(it actually checks to see if it's within 2 hours of the data/time).
It assumes that you and your customers are within the same time
zone and that there won't be a Daylight Saving Time change just
before showtime. Older browsers and browsers that have javascript
disabled will still see the link.
<html>
<head>
<script type="text/javascript">
var TWO_HOURS=72000 00;
function checkExpiry(img ,dateString){
var showTime=new Date(dateString );
var now=new Date();
if(img.parentNo de && (showTime-now)<TWO_HOURS) {
img.parentNode. style.visibilit y="hidden";
}
}
</script>
</head>
<body>
<table>
<tr>
<td>Show 1</td>
<td><a href="linkToBuy Tickets.html">< img border="0"
src="http://www.azphx.com/dhtml/tmp/buy5025.gif"
onload="checkEx piry(this,'Mon, 25 Dec 1995 13:30')"></a>
</td>
</tr>
<tr>
<td>Show 2</td>
<td><a href="linkToBuy Tickets.html">< img border="0"
src="http://www.azphx.com/dhtml/tmp/buy5025.gif"
onload="checkEx piry(this,'Mon, 25 Dec 2004 13:30')"></a>
</td>
</tr>
</table>
</body>
</html>

Jul 23 '05 #2
you could also do it in php.
check php.net for date-calculation functions
Jul 23 '05 #3
Thanks so much...this is perfect!

Lee <RE************ **@cox.net> wrote in message news:<c9******* **@drn.newsguy. com>...
Levi said:

I am developing a web site for a summer comedy series. The site has
links to buy tickets but I want them to disappear two hours before the
show begins. Does anyone know how to use a simple javascript that
shows and hides text and links after a date has passed?


This example only hides the "buy" link after the date has passed
(it actually checks to see if it's within 2 hours of the data/time).
It assumes that you and your customers are within the same time
zone and that there won't be a Daylight Saving Time change just
before showtime. Older browsers and browsers that have javascript
disabled will still see the link.
<html>
<head>
<script type="text/javascript">
var TWO_HOURS=72000 00;
function checkExpiry(img ,dateString){
var showTime=new Date(dateString );
var now=new Date();
if(img.parentNo de && (showTime-now)<TWO_HOURS) {
img.parentNode. style.visibilit y="hidden";
}
}
</script>
</head>
<body>
<table>
<tr>
<td>Show 1</td>
<td><a href="linkToBuy Tickets.html">< img border="0"
src="http://www.azphx.com/dhtml/tmp/buy5025.gif"
onload="checkEx piry(this,'Mon, 25 Dec 1995 13:30')"></a>
</td>
</tr>
<tr>
<td>Show 2</td>
<td><a href="linkToBuy Tickets.html">< img border="0"
src="http://www.azphx.com/dhtml/tmp/buy5025.gif"
onload="checkEx piry(this,'Mon, 25 Dec 2004 13:30')"></a>
</td>
</tr>
</table>
</body>
</html>

Jul 23 '05 #4

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

Similar topics

4
49433
by: gonzal | last post by:
Hi Dose any body know why a temporary table gets deleted after querying it the first time (using SELECT INTO)? When I run the code bellow I'm getting an error message when open the temp table for the second time. Error Type: Microsoft OLE DB Provider for SQL Server (0x80040E37) Invalid object name '#testtable'.
10
10803
by: Ranga | last post by:
I was unable to run the statement "CREATE GLOBAL TEMPORARY TABLE" on unix version of DB2, it gave the follwing error db2 => create global temporary table temp ( OGI_SYS_NR char(8) ) DB21034E The command was processed as an SQL statement because it was not a valid Command Line Processor command. During SQL processing it returned: SQL0104N An unexpected token "create global temporary table temp ( OGI_S" was
7
6646
by: John Baker | last post by:
Hi: I would like to know how to create a temp DB to store the data in a table while I do something else with the table. Specifically, how do I create the temp remove the temp I want to be certain that these are not linked or anything.
1
2411
by: Donald | last post by:
How do I prevent I WebForm from being cached in the "Temporary Internet Files" folder on the client computer? The web form is displayed in a popup modal dialog (window.showModalDialog). If the client closes the popup modal window and re-displays the web form again, I want the page to be retreived from the server instead of the temporary internet files folder. Here's what I've tried (and it didn't work of course):
4
2339
by: Nicolás Castagnet | last post by:
Hi, I write this post because I notice a strange behavior related with "Temporary Internet Files" and maybe some of you can help me to understand it. I am working in a web application with ASP.NET. Recently, I group of user have problems with it because the values of the sessions were not stored correctly (the application save the username in a login page, then other page try to get it and the result was always ""). We restart the web...
1
2000
by: umamy | last post by:
Hi, I am writing code to do the followin: - user clicks a link - the page reloads and sets a cookie with a js function in the header. The function reloads the same page with the cookie set and points it to an anchor My problem is that after the page loads with the anchor, it also reloads again without the anchor because of the href="some page" part. I've tried changing that to nothing, or to include the anchor, but it messes up the...
0
1534
by: aspineux | last post by:
setacl and getacl look to be already "Cyrus" specific (according the doc), why not to extend imaplib a little bit more ? Here are some code I wrote and tested to support cyrus "expire" that manage how long a message can stay into a mailbox. This is usefull for NEWS server ! The code is preceded by lot of sample.
11
6282
by: rawu | last post by:
hi , all . I got a question about creating indexes in db2 . a table has 44236333 rows an index planed to be build include 2 field ( 6 byte ) accordding to db2 document temporary tablespaces requirement size will be (6+9)*44236333*3.2/1024/1024/1024 = 1.98G
10
2564
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess is that it's not destroyed, but I'm not sure. I have the following program: #include<iostream>
0
8432
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
8428
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...
1
8078
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6753
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5962
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5456
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
3919
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
2442
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
1
1548
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.