interesting.now, I come across this in one of jsp page. why would the author specify the input tag through document.write instead of directly writing it .
is there any reason to do like above?
Everything is hard-coded it seems. The only reason one might use document.write() is to produce dynamic content
based on variables. Maybe at some point the literals were variable ?
now it could also be based on where the fragment is. If at the very end of the rendering of the table it may be
stopping someone clicking the deleteAll before everything is finished being presented.
William P O'Sullivan wrote:
The only reason one might use document.write() is to produce dynamic content
based on variables.
This may have been true in 1998. Even for such purposes document.write is a dinosaur. There are much better ways to inject dynamic content in the current millennium.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35238
7
posted
0
The checkbox will only be shown if JavaScript is enabled - which makes sense, because it's a JavaScript URL that wouldn't work without it.
There are still better ways to do it. document.write is looked at in the JavaScript world with the same level of derision that scriptlets are in JSPs -- perhaps even more so.