1
我正在給定SSCCE代碼以下錯誤:的ReferenceError:電子沒有定義
Error: ReferenceError: electron is not defined
Source File: http://localhost/testingOne.php
Line: 1
雖然'electron'
是一個字符串。那麼爲什麼我會得到這個錯誤。而我試圖接受的答案here和"
包裹electron
和proton
但給出:
Error: SyntaxError: syntax error
Source File: http://localhost/testingOne.php
Line: 1, Column: 12
Source Code:
clickButton(
代碼:
<?php
echo '<html><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<script>
function clickButton(alp, bet) {
alert(alp);
alert(bet);
}
</script>
</head><body>';
$array = array('alpha'=>'electron', 'beta'=>'proton');
echo '<button type="button" onclick="clickButton('. $array['alpha'].','.$array['beta'] .')" >Click Me</button>';
echo '</body></html>';
?>