我的页面源代码中有很多这样的字符<u>D</u>  <u>E</u> <u>D</u>我想用JS读取第一个D,请问该怎么写

解决方案 »

  1.   

    对了要完整一点的,怎么读取,怎么在DIV中写出
    最好带上script language="javascript"这样的全部语句,我是文盲,谢谢了
      

  2.   

    <u></u>里只有类似D这样的字符
      

  3.   

    已经用PHP实现
    <?php 
    preg_match('@^(?:<u>)?([^</u>]+)@i','<u>D</u> <u>E</u> <u>Cm</u>', $matches); 
    $host = $matches[1]; 
    echo $host; 
    ?> 
      

  4.   

    <!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=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript">
    window.onload = function(){
        alert(document.getElementsByTagName("U")[0].innerHTML);
    };
    </script>
    </head><body>
    <u>D</u> <u>E</u> <u>D</u>
    </body>
    </html>