Heim >Backend-Entwicklung >PHP-Tutorial >php 怎么获取js的prompt里面的值

php 怎么获取js的prompt里面的值

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-13 12:02:322031Durchsuche

php 如何获取js的prompt里面的值
想用php 如何获取js的prompt里面的值,想着用隐藏表单来获取,可是不想设置提交按钮,要怎么提交数据,怎样改下面的代码,才能获取php 如何获取js的prompt里面的值,求解?
<script><br />var str=window.prompt('请输入修改主题', '');<br />document.getElemengById("content").value =str;<br /></script>




$content=$_POST["content"];
echo $content;
?>

------解决方案--------------------
次序错了!
虽然可以这么写,但并无使用价值。因为提交将产生新的 document
<?php<br />if($_POST) {<br />  $content=$_POST["content"];<br />  echo $content;<br />  exit;<br />}<br />?><br /><form id="form" action="" method="post"><br /><input type="hidden" name="content" id="content" value=""><br /></form><br /><script><br />var str=window.prompt('请输入修改主题', '');<br />document.getElementById("content").value =str;<br />document.getElementById("form").submit();<br /></script
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn