我有多个按钮,每个按钮都有相关文本,当用户单击按钮时,文本应根据按钮更改,文本应显示在 DIV 中。
我正在使用 if elseif 在每个按钮的文本之间进行选择,现在我无法通过该函数将文本传递给 div onclick()。
<html>  
   <head>  
      function display (selected) {  
         if (decision == firstbox)  {  
            display = "the text related to first box should be displayed";  
         }  else if (decision == secondbox)  {  
            display = "Text related to 2nd box.";  
         }  else  {  
            display ="blank";  
         } 
   </head>  
   <body>  
      <input type="button" id="firstbox" value= "firstbox" onclick="display(firstbox)" /><br>    
      <input type="button" id="secondbox" value= "secondbox" onclick="display(firstbox)" /><br>
   </body>
</html>