html使用字符串拼接js函數時傳字符串參數


<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body>
    <div id="dd">
        <input type="button" onclick="aaa('aaa')" value="click1" />
    </div>
</body>
</html>
<script>
    document.getElementById("dd").innerHTML += '<input type="button" onclick="aaa(\'bbb\')" value="click2" />';
    function aaa(param) {
        alert(param);
    }
</script>

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM