在document.getElementById中使用变量

时间:2015-04-14 17:26:57

标签: javascript php

我想在下面给出的代码中使用php变量而不是#particles

我尝试使用:

$(" . json_encode($paramnameid) . ").particleground({

但这没有用。

$script = "<script type='text/javascript'>  
     document.addEventListener('DOMContentLoaded', function () {         
        particleground(document.getElementById('#particles'), {
                dotColor: " . json_encode($dotcolor) . ",
                lineColor: " . json_encode($linecolor) . "      
            });       
        }, false);       
    </script>";

我该怎么做?

0 个答案:

没有答案
相关问题