我试图通过POST首先将div的内容传递给javascript变量:
<html>
<head>
<title>Test</title>
<script type="text/javascript">
var x=document.getElementById("lambda");
var promenna = x.innerHTML;
function nastavit()
{document.getElementById("formular").jsvalue.value = promenna;}
</script>
</head>
<body>
<div id="lambda">
Lorem Ipsum
</div>
<form action="ulozit.php" method="post" id="formular">
<input type="hidden" name="jsvalue" value="javascript:promenna.toString()" />
<input type="submit" value="Submit" onclick="nastavit();" />
</form>
</body>
</html>
问题是它只有在我为变量'promenna'设置特定值时才有效,例如var promenna =“blah blah”。这有什么不对?