我要实现一个提示效果,如果判断未通过则把对应行中的LABEL显示出来(datagrid中,JAVASCRIPT实现),问题是在JAVASCRIPT中获取不到label控件,哪位给个意见!!!!!!!!!!!!!!1

解决方案 »

  1.   

    当然除了用CSS去格式化TEXT文本框样式
      

  2.   

    问题是在JAVASCRIPT中获取不到label控件
    ---------------------------------------
    何以见得?label解析后对应html标签是span,控制该span即相当于控制label
      

  3.   

    靠,html中,有label这个控件好不LABEL Element | label Object--------------------------------------------------------------------------------Specifies a label for another element on the page.Members TableThe following table lists the members exposed by the label object. Click a tab on the left to choose the type of member you want to view
    ResTo bind a LABEL to another control, set the FOR attribute of the LABEL element equal to the ID of the control. Binding a LABEL to the NAME attribute of the control has no effect. However, to submit a form, you must specify a NAME on the control to which the LABEL element is being bound. There are two ways to underline the designated access key. The rich text support in the LABEL element makes it possible to wrap the U element around the character in the label text specified by the ACCESSKEY attribute. If you prefer to use cascading style sheets (CSS) to apply style formatting, enclose the designated character in a SPAN and set the style to "text-decoration: underline".If the user clicks the LABEL, the onclick event fires on the LABEL and then on the control specified by the htmlFor property. Pressing the access key for the LABEL sets the focus but does not fire the onclick event.Labels cannot be nested.This element is available in HTML and script as of Internet Explorer 4.0.This element is an inline element.This element requires a closing tag.ExampleThis example uses the LABEL element and the ACCESSKEY attribute to set focus on a text box.<LABEL FOR="oCtrlID" ACCESSKEY="1">
        #<SPAN style="text-decoration:underline;">1</SPAN>: Press Alt+1 to set focus to textbox
    </LABEL>
    <INPUT TYPE="text" NAME="TXT1" VALUE="binding sample 1" 
           SIZE="20" TABINDEX="1" ID="oCtrlID">Standards InformationThis object is defined in HTML 4.0 .
      

  4.   

    把以下代码复制到一个HTML文件中看看,
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    </head>
    <SCRIPT LANGUAGE="JavaScript">
    <!--
    window.onload=function()
    {
    alert(document.getElementById("df").innerHTML);
    }
    //-->
    </SCRIPT>
    <body>
    <label id="df">sdf</label>
    </body>
    </html>
      

  5.   

    不用LABEL可以用DIV、SPAN标签,加runat="server",后台就可以访问了