Re: advantage of document.write
- From: Randy Webb <HikksNotAtHome@xxxxxxx>
- Date: Fri, 09 Jun 2006 13:33:29 -0400
radykl@xxxxxxxxx said the following on 6/9/2006 11:16 AM:
sonnystarks wrote:
Of course using a programming language to generate your HTML makes only
sense if you have some dynamic content (e.g. date/time) you generate
with the programming language or you have data you want to write out.
But in general, if you want to generate a page with dynamic content, it
would be better to use a server/side technology like jsp, aspx, php,
etc...
Depending on where that dynamic content comes from.
You would use Javascript more to react to users actions in the
browser, not to generate the page in the first place, therefore for
practical purposes and in my experience document.write is nothing you
typically use.
Really?
Question 1: Sow would you create a button that can only be used if Javascript is enabled?
Second question: How would you add a button that copies text to the clipboard?
Third question: How would you add the current date - according to my system clock - with server side code?
Server side code please.
Client-side code:
Answer 1: document.write ('button code here');
Answer 2:
if (window.clipboardData) {
document.write('<input type="button" onclick="copyIt()" value="Copy It">');
}
Where copyIt() is a function that copies text to the clipboard.
document.write has it's place, if you know what that place is.
Answer 3: document.write(new Date());
At it's simplest.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
.
- References:
- advantage of document.write
- From: sonnystarks
- Re: advantage of document.write
- From: Randy Webb
- Re: advantage of document.write
- From: sonnystarks
- Re: advantage of document.write
- From: Martin Honnen
- Re: advantage of document.write
- From: radykl
- advantage of document.write
- Prev by Date: Re: "for loop" works in FF but not in IE
- Next by Date: Re: Internet Explorer Blocks JavaScript
- Previous by thread: Re: advantage of document.write
- Next by thread: Re: advantage of document.write
- Index(es):
Relevant Pages
|