我想將php圖像url作爲javascript函數參數傳遞。如何將php變量作爲參數傳遞給JavaScript函數
請讓我知道我該怎麼做。
<html>
<?php
$image=$row['image'];
$img=$loc.'user/'.$image;
?>
<script type=text/javascript>
function demo()
{
some code here;
}
</script>
<body>
<button type="submit" onclick=demo(<?php echo $img?>) >
</body>
</html>
在javascript中我做的一些圖像編輯工作。
如何傳遞這個PHP變量(即圖像的URL作爲JavaScript函數參數)
,你havr關閉按鈕。檢查我的答案。 –