jsp的web项目中有个模块是关于评论的我想做的好看一点像qq中那样应该怎么编写??下面是截图
当点击评论或文本框里的“我也说一句”会变成

解决方案 »

  1.   

    额  
    onfocus 事件 然后 各种处理...
    最简单的就是 隐藏你当前的input然后显示出来你要显示的input和其他 或者在原有基础上改造
      

  2.   

    onfocus 事件
    判断内容是否为 我也说一句 ,是则清空否则不变。
      

  3.   

    <html>
    <head>
    <title>test</title>
    <script type="text/javascript" src="jquery-1.3.2.min.js"></script>
    <script type="text/javascript">
    $(function(){
    $("span").mouseover(function(){
    $(this).removeClass("mousemovespan");
    $(this).addClass("mouseoverspan");
    }).mouseout(function(){
    $(this).removeClass("mouseoverspan");
    $(this).addClass("mousemovespan");
    });
    $("#comment").click(function(){
    $("#comments_input").css('display','block');
    $("#comments").css('display','none');
    });
    $("#comments_input").focus(function(){
    $("#comments_input").css('display','none');
    $("#comments").css('display','block');
    });
    });
    </script>
    <style>
    div{
    margin:2px;
    }
    .mousemovespan{
    font-size:14px;
    margin:5px;
    padding:5px;
    cursor: pointer;
    color:grey;
    }
    .mouseoverspan{
    font-size:14px;
    margin:5px;
    padding:5px;
    cursor: pointer;
    color:blue;
    }
    #comments_input{
    color:grey;
    }
    </style>
    </head>
    <body>
    <div>
    <span class="mousemovespan" id="praise">赞</span>
    <span class="mousemovespan" id="comment">评论</span>
    <span class="mousemovespan" id="trans">转发</span>
    </div>
    <div>
    <input id="comments_input" value="我也说一句" style="display:none;"></input>
    <textarea id="comments" cols="20" rows="1" style="display:none;"></textarea>
    </div>
    </body>
    </html>