Javascript 提交时包含值的警报

Javascript 提交时包含值的警报,javascript,html,forms,Javascript,Html,Forms,我在java脚本中得到了这段代码,我需要在提交后或作为警报提交时打印用户名、密码和地址 function green() { document.getElementById('box').style.backgroundColor = 'white'; document.getElementById('box').innerHTML = "<form name='f1' onsubmit='alert(un.value)>Enter n

我在java脚本中得到了这段代码,我需要在提交后或作为警报提交时打印用户名、密码和地址

    function green()
    {
        document.getElementById('box').style.backgroundColor = 'white';
        document.getElementById('box').innerHTML = "<form name='f1' onsubmit='alert(un.value)>Enter name:<input name='un' type=text  /> <br/> Enter Password: <input type=password name='ps' /> <input type='hidden' value='"+interval +"' name='in' /> <br/> <a onclick='address()'>address</a> <br/> <input type=submit value=ok /> </form>";

    }

<div id="box" style="width:380px;height:400px" />   
    <td width="95" align="center"><a onclick="green()">green</a></td>
函数绿色()
{
document.getElementById('box').style.backgroundColor='white';

document.getElementById('box').innerHTML=“尝试在JavaScript中添加通风口,请参见此处脚本标记中的绿色?您的
onsubmit='alert(un.value)
缺少一个闭合的单引号。