把javascript里面的变量传给php

<body>

<script>

function winopen(str)

{  

location.href="1.php?str="+str;

}

</script>

<input type="button" onclick="winopen('传个值试试')" value="传值">

<?php

if(isset($_GET['str'])&&$_GET['str']!="")

{   
echo $_GET['str'];

}

?>

</body>

posted @ 2013-07-25 10:58  寂夜冷风  阅读(561)  评论(0编辑  收藏  举报