Passing dynamic parameter to a JavaScript function using innerHTML
        Posted  
        
            by 
                user958263
            
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by user958263
        
        
        
        Published on 2012-07-04T03:03:16Z
        Indexed on 
            2012/07/04
            3:15 UTC
        
        
        Read the original article
        Hit count: 169
        
JavaScript
|html
I am having issues passing a dynamic parameter to a JavaScript function using innerHTML.
Included below is the current code that I am using:
var name = "test";
frm.innerHtml = '<button name="close" id="close" title="Cancel" type="button"
     onclick="closeTab('+name+');">Return</button>';
When I debug the code of the CloseTab() function, the parameter specified by the name variable is null.
I believe there is a problem with the declaration of the value while modifying the innerHTML property.
Any help would be greatly appreciated.
Thanks
© Stack Overflow or respective owner