Re: [請益] 要如何傳值給JavaScript
※ 引述《woeijou ( =資三連線= wei)》之銘言:
: 請問一下
: 在同一頁的話
: PHP要如何將傳變數給JavaScript
sorry i can only type in english.
my question is quite the same to the previous one so that i post it here.
would somebody tell me why my program can not disply the value 100 and
even the "Hello" string?
I am also trying to pass a variable from PHP to javascript in the same page
(the same file xxx.htm).
really appreciate any response!
<html>
<head>
<?php $myvar = 100;?>
<script language="javascript" type="text/javascript">
function Check()
{
document.write("Hello");
jsVar = <?php echo $myvar;?>;
document.write(jsVar);
}
</script>
</head>
<body>
<input type="submit" value="send" onclick="Check();"/>
</body>
</html>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 128.2.238.94
→
03/13 09:42, , 1F
03/13 09:42, 1F
→
03/13 09:42, , 2F
03/13 09:42, 2F
推
03/13 09:44, , 3F
03/13 09:44, 3F
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 2 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章