开发者

Does COLSPAN work in textarea?

Im back!....well the powers that be want to change my nice comment box....does colspan work in a textarea?. If so...am I formatting it wrong??

As you can see it looks funky....much appreciated the help :)

Does COLSPAN work in textarea?

<form id="commentForm" name="commentForm" action="" method="post">
<ctl:vertScroll height="300" headerStyleClass="data_table_scroll" bodyStyleClass="data_table_scroll" enabled="${user.scrollTables}">
<ctl:sortableTblHdrSetup topTotal="false" href="show.whatif_edit_entry?entryId=${entry.entryId}"/>
 <table class="data_table vert_scroll_table" style="width:360px;">
    <tr>

    <ctl:sortableTblHdr styleClass="center" title="User" property="auditable.createdBy.lastName" type="top">User</ctl:sortableTblHdr>
    <ctl:sortableTblHdr styleClass="center" title="Date" property="auditable.createdDate" type="top">Date</ctl:sortableTblHdr>
    <ctl:sortableTblHdr styleClass="center" title="Comments" property="comment" type="top">Comments</ctl:sortableTblHdr>  
    </tr>
    <c:forEach var="comments" items="${entry.comments}">
    <tr id="id${comments.id}">
        <c:choose>
            <c:when test="${comments.auditable != null}">
        <td>
            ${comments.auditable.createdBy.lastName}, ${comments.auditable.createdBy.firstName}
   开发者_StackOverflow中文版   </td>


          <td title="<fmt:formatDate value="${comments.auditable.createdDate}" pattern="${date_time_pattern}" />"><span class="mouseover_text"><fmt:formatDate value="${comments.auditable.createdDate}" pattern="${date_time_pattern}" /></span>
          </td>

          </c:when>
        <c:otherwise>
         <td  colspan="1">&nbsp;</td>
         <td  colspan="1">&nbsp;</td>
    </c:otherwise>
    </c:choose>
    <td id="comments-${comments.id}"  style="width:400px;"><pre style="width: auto;">${comments.comment}</pre></td>

    </c:forEach>
    </tr> 


    <c:if test="${lock.locked || form.entryId < 0 }">

    <%-- This is the row for adding a new comment. --%>           

        <tr id="commentRow">              
         <td>
         You have <strong><span id="commentsCounter">${const['COMMENT_MAX_LENGTH'] - fn:length(commentForm.comment)}</span></strong> characters left.<br/>
            <textarea id="comment" colspan="3" name="comment" rows="2" cols="125" style="width:380px;"
                 onkeypress="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
                 onkeydown="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
                 onkeyup="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"></textarea>

                    <a href="javascript:addComment();"><img src="../images/icon_add.gif" border="0" alt="Add"/></a>
        </td>

        </tr>

    </c:if>
</table>
</ctl:vertScroll>


No, the colspan attribute belongs on the <td> element that contains the textarea.


The colspan attribute doesn't belong on a <textarea>. You definitely want to apply it to its containing <td> instead:

<%-- This is the row for adding a new comment. --%>           

    <tr id="commentRow">              
     <td colspan="3">
     You have <strong><span id="commentsCounter">${const['COMMENT_MAX_LENGTH'] - fn:length(commentForm.comment)}</span></strong> characters left.<br/>
        <textarea id="comment" name="comment" rows="2" cols="125" style="width:380px;"
             onkeypress="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
             onkeydown="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"
             onkeyup="characterCounter('commentsCounter',${const['COMMENT_MAX_LENGTH']}, this)"></textarea>

                <a href="javascript:addComment();"><img src="../images/icon_add.gif" border="0" alt="Add"/></a>
    </td>

    </tr>


No, colspan works only on tables. If you want to span columns, you should use colspan on <td> instead of textarea.


No. colspan is for <td> and <th> elements, to state how many columns in their table they should span. It doesn’t make any sense on elements that aren’t table cells.

You want:

<tr id="commentRow">              
    <td colspan="3">
     You have <strong><span id="commentsCounter">${const['COMMENT_MAX_LENGTH'] - fn:length(commentForm.comment)}</span></strong> characters left.<br/>
        <textarea id="comment"...


you should enclose colspan in the tag, then use with rows and cols to adjust the textarea size. example: this is for a 9 column table, using the first and last columns for other stuff

<td colspan="7"><textarea rows="3" cols="110">{{ book.description }}</textarea></td>

I had to adjust the cols (does not relate to columns - more like pixels) number to fill the empty space out

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜