dpv21589
2013-12-29 11:31
浏览 54
已采纳

如何在JavaScript中回显PHP变量? [重复]

This question already has an answer here:

I need to echo a PHP variable into JavaScript. But I have no experience about JavaScript, I did some research but nothing worked for me.

The code

 function hide() {
   document.getElementById("myDiv").style.display="none";
   <?php echo $myVar; ?>
 }

And the $myVar looks like:

$myVar = "Hi there";
</div>
  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

4条回答 默认 最新

相关推荐 更多相似问题