0

我正在尝试通过 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”。这里有什么问题?

4

0 回答 0