Call the id in JavaScript - Stack Overflow

I have a span like this:<span id="selectedTests" class="emrFG"><span id

I have a span like this:

<span id="selectedTests" class="emrFG">  
  <span id="lblSelectedTests" class="emrHDR" style="top:3;left:6;font-size:8pt;">Selections</span>  
  <span class="emrHDR" style="top:3;left:190;font-size:8pt;">Tests</span>  
  <div id="recordSet" style="top:19;height:112;width:444;"></div>
</span>

The span shows some rows of data and I want to call those rows individually by using document.all method.
How would I do that?

I have a span like this:

<span id="selectedTests" class="emrFG">  
  <span id="lblSelectedTests" class="emrHDR" style="top:3;left:6;font-size:8pt;">Selections</span>  
  <span class="emrHDR" style="top:3;left:190;font-size:8pt;">Tests</span>  
  <div id="recordSet" style="top:19;height:112;width:444;"></div>
</span>

The span shows some rows of data and I want to call those rows individually by using document.all method.
How would I do that?

Share Improve this question edited Jan 3, 2023 at 8:39 Brian Tompsett - 汤莱恩 5,89372 gold badges61 silver badges133 bronze badges asked Jun 8, 2010 at 22:43 Asim ZaidiAsim Zaidi 28.4k49 gold badges138 silver badges224 bronze badges 3
  • <span. id="selectedTests" class="emrFG"> <span. id="lblSelectedTests" class="emrHDR" style="top:3;left:6;font-size:8pt;">Selections</span> <span class="emrHDR" style="top:3;left:190;font-size:8pt;">Tests</span> <div id="recordSet" style="top:19;height:112;width:444;"></div> – Asim Zaidi Commented Jun 8, 2010 at 22:44
  • @user: Have a look at How do I format my code blocks?. – Marcel Korpel Commented Jun 8, 2010 at 22:47
  • Your CSS (within style attributes) is malformed: you have to use a unit identifier (e.g., px, em, etc.) when defining top, left, height and width. Your HTML is malformed, too: <span> elements can only contain inline elements. <div> is a block-level element. See w3/TR/html401/struct/global.html#h-7.5.3 – Marcel Korpel Commented Jun 8, 2010 at 22:55
Add a ment  | 

1 Answer 1

Reset to default 1

document.all is very old, see my answer to another question. Use document.getElementById instead.

Example:

var theElement = document.getElementById("lblSelectedTests");

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744848616a4596991.html

相关推荐

  • Call the id in JavaScript - Stack Overflow

    I have a span like this:<span id="selectedTests" class="emrFG"><span id

    2天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信