Closed. This question is off-topic。它当前不接受答案。
                            
                        
                    
                
            
                    
                
                        
                            
                        
                    
                        
                            想改善这个问题吗? Update the question,所以它是on-topic,用于堆栈溢出。
                        
                        5年前关闭。
                    
                
        

我想将值传递给Javascript语句。可能吗?
例如 :

function Show(msg, Id, Msgtype) { // I need to pass this Id argument to below javascript innerHtml statement
  var strVar = "";
  strVar = "Hello" + Msgtype + " <i class='icon-remove close'></i> " + msg + "</div>";
  document.getElementById("???").innerHTML = strVar; // ??? should be the Id above in the function arguments
}


或者以其他方式如何实现这种情况?

最佳答案

像这样通过Id

document.getElementById(Id).innerHTML = strVar;

10-05 20:39
查看更多