Re: advantage of document.write



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/
.



Relevant Pages

  • Re: How to get the contnet of clipboard
    ... >Simply turning off Javascript ... having your clipboard read by a web page is a security risk. ... > Simply turning off Javascript ... >> If you have the CB text you can invoke a post to the server. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to get the contnet of clipboard
    ... > I wonder how ASP.NET reacts:) ... can function as efficiently without client-side Javascript as with it. ... having your clipboard read by a web page is a security risk. ... >> That lands us right back into the server scenario again, where it simply can't be done. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Windows Security Flaw - The Clipboard
    ... but it is also very easy for a client-side JavaScript ... function to grab the clipboard contents, append it to a URL as a parameter ... > Client side and server side script ain't the same. ...
    (microsoft.public.windowsxp.security_admin)
  • Re: How suited are purely functional programming languages for I/O-intensive and database-re
    ... on Data.Map you can write a simple internal database server in a matter ... programming language, because it seems that a multi-user online ... real-time on the client to include more and more types of arguments, ... separately, where "gesture" defines '+' as adding, say, a gesture of ...
    (comp.lang.functional)
  • Re: How suited are purely functional programming languages for I/O-intensive and database-re
    ... on Data.Map you can write a simple internal database server in a matter ... programming language, because it seems that a multi-user online ... real-time on the client to include more and more types of arguments, ... separately, where "gesture" defines '+' as adding, say, a gesture of ...
    (comp.lang.functional)