Inserting HTML inside a script

  • Thread starter Serious_Practitioner
  • Start date
S

Serious_Practitioner

Hi, and thank you in advance for any assistance.

I would like to use a script to determine if a date meets a condition, and,
if it does, then create a table row with a couple of cells, and then put
some text in the cells. I don't know if that is possible, so that's my first
question. It seems to me that the HTML would have to be in the script, but
I'm not experienced enough to know.

The second question is how might I search for info through a search engine
for this? Any suggestions on terms?


Thank you...


Steve E.
 
V

VK

I would like to use a script to determine if a date meets a condition, and,
if it does, then create a table row with a couple of cells, and then put
some text in the cells.

var deadline = new Date(2006,1,1);
// year, month, day where month goes 0-11
// (0 - January, 11 - December)
// day goes in the regular way 1-31
// silly, I know ;-) so just memorize

var now = new Date();
// current date

if ( now.getTime() < deadline.getTime() ) {
// here I'm not sure: if you want to insert the row
// right on page load then use document.write();
// otherwise DOM methods will be needed.
// More info would help.
}

The second question is how might I search for info through a search engine
for this? Any suggestions on terms?

javascript scripting dynamic table insert row DOM
 
S

Serious_Practitioner

Thank you, VK, for your note. More info -

The information that I want to present this way is about classes or seminars
that will take place on given dates. For each seminar, I'd like to make the
comparison to the date, then, if the date has not passed, build a table with
one row and three (or four) cells; one cell would be the name of the class,
the next cell would be a description, the next cell would be the date and I
forgot what I wanted the fourth cell for. I realize that the date of the
class would have to be in the code for the comparison. And I know it's a
little awkward, because we would need similar code blocks for each class. I
can't take the time now to learn enough about MySQL and PHP to do this using
those tools - that's a few months away. This is a stopgap solution.

Thank you again.


Steve E.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,431
Messages
2,571,679
Members
48,796
Latest member
Greg L.

Latest Threads

Top