Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Redirect (Before or after a set date)

Status
Not open for further replies.

keepingbusy

Programmer
Apr 9, 2000
1,470
GB
Hi All

This one's probably easy (but not for me!). When a visitor to a website clicks on a hyperlink, I am trying to send them to a certain page if the date is before half way through the month (Or it can be on the 15th if its easier). If the date is after the 15th then they get sent to a different page on the site. Is this possible (and simple)?

Many thanks in anticipation

KB When everything else is said and done, there will be nothing else to say or do! God Bless everyone....
 
I don't know what you are calling simple, but what you want to do is possible with a script. If you use VBScript Server Side it would go something like:

<%If Date < DesiredDate Then%>
response.redirect &quot;page.htm&quot;
<%Else%>
response.redirect &quot;OtherPage.htm&quot;
<%End If%>

Put it in the event where you direct the page (eg, button_onclick).


Or

If Date < DesiredDate Then
location.href = &quot;Page.htm&quot;
Else
Location.href = &quot;OtherPage.htm&quot;
End If

Hope this is what you were looking for. Rob
Just my $.02.
 
Hi rtshort
Many thanks for replying. I'm not up on VBscript but someone sent me this code to insert on my website

<script language=&quot;JavaScript&quot;>
function linkTo(p1,p2){
var today = new Date();
var page = (today.getDate() < 15)?p1:p2
window.location = page;
}
</script>
<a href=&quot;#&quot; onclick=&quot;linkTo('firsthalf.htm','secondhalf.htm'); return false;&quot;>click</a>

Many thanks again for taking the time reply
KB When everything else is said and done, there will be nothing else to say or do! God Bless everyone....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top