This is Interesting: Free Magazines for Graphics designers and webmasters
Home > Archive > Webmaster forum > August 2006 > javascript to display text based on a date?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
javascript to display text based on a date?
|
|
| Beowulf 2006-08-27, 6:39 pm |
| Hi, I am a college online teacher, I know enough javascript to be
dangerous, pretty good at basic HTML. I could use some help on what I
think is a simple problem: I need to be able to have my HTML web page
display text in a paragraph or cell of a table only after a certain
date. Is there a simple way to do this with javascript?
Basically I have my online course entry page with topics listed in a
table-- left column calendar date ranges, right column descriptions of
the topics with links to the page for each topic. I do not want
students to get ahead of themselves, so I would like to be able to
pre-program the webpage with javascript to only display a link for a
topic after a specified calendar date.
Any help greatly appreciated, thank you.
| |
| Swampy Bogtrotter 2006-08-27, 6:39 pm |
| Beowulf wrote:
> Hi, I am a college online teacher, I know enough javascript to be
> dangerous, pretty good at basic HTML. I could use some help on what I
> think is a simple problem: I need to be able to have my HTML web page
> display text in a paragraph or cell of a table only after a certain
> date. Is there a simple way to do this with javascript?
>
> Basically I have my online course entry page with topics listed in a
> table-- left column calendar date ranges, right column descriptions of
> the topics with links to the page for each topic. I do not want
> students to get ahead of themselves, so I would like to be able to
> pre-program the webpage with javascript to only display a link for a
> topic after a specified calendar date.
>
> Any help greatly appreciated, thank you.
The problem with Javascript is, it works client-side.....So if someone wants
to vew the text before the due date, all they have to do is alter their
system clock.....I'd personally go with a client-side solution using ASP if
this were my project.....
Having said that.....
<script type="javascript">
<!--
var triggerDate=new Date()
triggerDate.setFullYear(2006,08,01)
var today = new Date()
if (today=>triggerDate)
{
document.write('The text from your inserted paragraph goes here')
}
//-->
</script>
This should display the paragraph text if the current date is equal to, or
later than September 1st 2006.
Note that the days of the month are counted starting from 1, but the months
of the year are counted starting from 0....
| |
| Jerry Stuckle 2006-08-27, 6:39 pm |
| Beowulf wrote:
> Hi, I am a college online teacher, I know enough javascript to be
> dangerous, pretty good at basic HTML. I could use some help on what I
> think is a simple problem: I need to be able to have my HTML web page
> display text in a paragraph or cell of a table only after a certain
> date. Is there a simple way to do this with javascript?
>
> Basically I have my online course entry page with topics listed in a
> table-- left column calendar date ranges, right column descriptions of
> the topics with links to the page for each topic. I do not want
> students to get ahead of themselves, so I would like to be able to
> pre-program the webpage with javascript to only display a link for a
> topic after a specified calendar date.
>
> Any help greatly appreciated, thank you.
>
Even if it didn't display in the browser window, with Javascript it
would still display in the source. Javascript is client-side, so all
the data would be sent and Javascript would decide whether to display it
or not. But displaying the page source will always show it.
You need a server-side language such as PHP, Perl, VBScript, etc.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
|
|
|
| | Copyright 2003 - 2008 forum4designers.com Software forum Computer Hardware reviews |
|