function helloworld() {
    alert('hello world');
}
static html:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="helloworld.js" type="text/javascript"></script>
</head>
<body>
    <form action="#">
     <input type="button" onclick="helloworld()" />
    </form>
</body>
</html>
1st conversion using http://accessify.com/tools-and-wizards/developer-tools/html-javascript-convertor/ works:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="helloworld.js" type="text/javascript"></script>
</head>
<body>
    <form action="#">
     <script type="text/javascript">
         document.write("<input type=\"button\" onclick=\"helloworld()\" \/>");
     </script>
    </form>
</body>
</html>
second conversion doesn't work:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="helloworld.js" type="text/javascript"></script>
</head>
<body>
    <form action="#">
     <script type="text/javascript">
document.write("     <script type=\"text\/javascript\">");
document.write("         document.write(\"<input type=\\"button\\" onclick=\\"helloworld()\\" \\/>\");");
document.write("     <\/script>");
     </script>
    </form>
</body>
</html>
Is it possible to correct the second code so that it can work ?