在document.getElementById中使用变量

I'd like to use a php variable instead of #particles in the below given code.

I tried using:

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

but that didn't work.

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

How can I do this?