我想根据php
变量设置javascript
值。
我想要<?php $result = "
x " ?>
而不是alert("You selected: " + x);
在此代码中:
<script type="text/javascript">
function selectOption() {
var x = document.getElementById("item1").value;
alert("You selected: " + x);
if (option == "Select Item") {
return true;
}<?php
$stmt = $user_home->runQuery('SELECT * FROM item ORDER BY Sr ASC ');
$stmt->execute();
if($stmt->rowCount() > 0)
{
while($row=$stmt->fetch(PDO::FETCH_ASSOC))
{
extract($row);
?>else if (option == "<?php echo $IRN ?>") {
return true;
}
<?php }} ?>
return false;
}
</script>