[帮助]锚标记问题(链接) [英] [HELP] Anchor Tag Problem (Links)

查看:81
本文介绍了[帮助]锚标记问题(链接)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何获取这些锚标记的文本以用于下一页?



How can I get the text of these anchor tags to use for the next page?

<div class = "cont-holder"style="removed-118px;removed50px;height:50%;width:30%;removed:relative;color:#FFFFFF;float:right;margin-removed 75px;">
                                <ul>
          <li>    <a href=reports.php><h2 style="font-family:Tahoma; text-align:left;"> Daily Reports </h2></a></li>
          <li>    <a href=reports.php><h2 style="font-family:Tahoma; text-align:left;"> Weekly Reports </h2></a></li>
          <li>    <a href=reports.php><h2 style="font-family:Tahoma; text-align:left;"> Monthly Reports </h2></a></li>
          <li>    <a href=reports.php><h2 style="font-family:Tahoma; text-align:left;"> Yearly Reports </h2></a></li>
          <li>    <a href=reports.php><h2 style="font-family:Tahoma; text-align:left;"> Cancelled Transaction Reports </h2></li>
        </ul>

    </div>





我需要将文字设置为每日报告作为下一页的标题。谢谢。



I need to set the text like daily reports as the title for the next page. THanks.

推荐答案

给你的ul一个id

,然后你可以进行以下查询:



give your ul an id
and then you can do the query below:

var arr=array();
var i=0;
var lists=document.querySelector("#ul_id").querySelectorAll("li");
[].forEach.call(
lists, 
  function(li){
    array[i]=li.querySelector("h2").innerHTML;
  }
);





可能存在语法错误。



there may be some syntax error.


这篇关于[帮助]锚标记问题(链接)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆