That link doesn't appear to do anything in some browsers, best to avoid its code. If you want users to be able to input poorly constructed javascript, the best bet may be an ordinary textarea instead of a text input:
Code:
<head>
<script type="text/javascript">
function writeIt(form){
document.write(form.elements.user_text.value + '<br><input type="button" onclick="history.go(-1);" value="Back">');
document.close();
}
</script>
</head>
<body>
<div id="txt"></div>
<form action="#" onsubmit="writeIt(this); return false;">
<textarea name="user_text" cols="50" rows="5"></textarea><br>
<input type="submit" value="Write It">
</form>
</body>
</html>
The input forces everything into a single line. The textarea, though it often appears to force the text to wrap, sends it with the line breaks intact. For example, try pasting this code into the above form:
Code:
<script type="text/javascript">
alert('His steep acres absolutely juggle his stumbling beagles. Our puzzled aspersions cavalierly impress those gloating exhortations. That quarrelsome feather woefully locks our straightforward banshees. The confusing bachelors tomboyishly judge those disenchanted bongos. That frowning backer censoriously hooks her tempestuous aardvarks. Their squealing felons tonelessly interpret his nonsectarian aces. Her confiding animals courageously jail those congested chromosomes. Their mysterious bakers ceremonially appreciate his quelling fantasies. Their adoring colors unrealistically lighten his testy chocolates. His naughty clowns augustly alert his absorbing fellows.')
alert('here')
// bad comment
</script><!-- script with poor semicolon usage and a really long line -->
Bookmarks