代码如下
许愿人:<input type="text" runat="server" id="txtAuthor" onkeydown="showAuthor(this)" onkeyup="showAuthor(this)"/>//预览时显示作者
function showAuthor(Object)
{
    document.getElementById("divAuthor").innerHTML = Object.value;
    
}
显示许愿人:<div style="text-align: right;" id="divAuthor">
                            <asp:Label ID="lblAuthor" runat="server"></asp:Label>
                        </div>
我现在想加一列“被祝福人” : 如  许愿人 对 被祝福人 说
请问怎么修改可以实现呢  

解决方案 »

  1.   

    许愿人:<input type="text" runat="server" id="txtAuthor" onkeydown="showAuthor(this)" onkeyup="showAuthor(this)"/><br />
    被许愿人:<input type="text" id="callName" />
    <div id="divAuthor" ></div>
    <script type="text/javascript">
    //预览时显示作者
    function showAuthor(Object)
    {
      document.getElementById("divAuthor").innerHTML = "许愿人 对 " + document.getElementById("callName").value + " 说" + Object.value;
    }
    </script>
      

  2.   

    许愿人:<input type="text" runat="server" id="txtAuthor" onkeydown="showAuthor(this)" onkeyup="showAuthor(this)"/>//预览时显示作者
    function showAuthor(Object)
    {
      divAuthor.innerHTML = Object.value;
        
    }
    显示许愿人:<div style="text-align: right;" id="divAuthor">
      <asp:Label ID="lblAuthor" runat="server"></asp:Label>
      </div>
      

  3.   


    把"许愿人" 等同的换成  document.getElementById("txtAuthor").value 
      

  4.   

    许愿人:<input type="text" runat="server" id="txtAuthor" style="width:80px" onkeydown="showAuthor(this)" onkeyup="showAuthor(this)"/>
                    对 <input type="text" runat="server" id="txtZhufu" style="width:80px" onkeydown="showAuthor(this)" onkeyup="showAuthor(this)"/>说//预览时显示
    function showAuthor(Object)
    {
        document.getElementById("divAuthor").innerHTML = Object.value;
        
        
    }
     <div style="text-align: right;" id="divAuthor">
                                <asp:Label ID="lblAuthor" runat="server"></asp:Label>&nbsp;对
                            </div>我这样写了,但输入许愿人后,再输入被祝福人,被祝福人就把许愿人给覆盖了