jsp and javascript

I'm developing a website. I had an idea to simplified the jsp content.

Simple example is like this

<html>

<script language="JavaScript" src="input.js">

</script>

<form>

<script>

addInput('email','text');

addInput('password','password');

</script>

<input type="submit">Submit</input>

</form>

</html>

while the content of the input.js is:

function addInput(name, type){

document.write(<input name="' + name + '" type="' + type + '"></input>);

}

My question is:

Are the idea safe to be implemented, are there any negative side of the idea?

can it run well in every browser?

thanks in advance

[1085 byte] By [mimi_tan1985a] at [2007-11-27 3:47:23]
# 1
Not a Java or JSP question. Anyway, here's a [url= http://javascript.about.com/library/blwrite.htm]link[/url] that covers your question.
karma-9a at 2007-7-12 8:51:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2
This is indeed discouraged. Look for the MVC pattern. Sun's implementation is JSF.
BalusCa at 2007-7-12 8:51:09 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...