Javascript 使用href with.split(';href=';)时如何指定文件夹路径[0]

Javascript 使用href with.split(';href=';)时如何指定文件夹路径[0],javascript,html,json,parsing,split,Javascript,Html,Json,Parsing,Split,我有一个代码,它可以很好地处理这个代码 "</td><td><a target='_blank' href='"+ person.documentname.split('href=')[0]+"' >"+person.documentname.split('href=')[0]+"</a></td>" 我的.js文件路径是 C:\folder1\xxx.js C:\folder1\file1.pdf 我的文件路径是 C:\fol

我有一个代码,它可以很好地处理这个代码

"</td><td><a  target='_blank' href='"+ person.documentname.split('href=')[0]+"' >"+person.documentname.split('href=')[0]+"</a></td>"
我的.js文件路径是

C:\folder1\xxx.js
C:\folder1\file1.pdf
我的文件路径是

C:\folder1\xxx.js
C:\folder1\file1.pdf
当这种情况出现时,由于与html共享的路径相同,我想添加一些外部值,如

C:\folder2\file2.pdf
如何将代码集成到此路径中

.split('href=')[0]+"
此.split标记不显示在可灵活使用的语法上。顺便说一句,我总是将此代码用于外部路径,但我们可以共享两种方式来处理相同的文件夹路径和外部文件夹路径

为了更好地理解我的html

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="new27.js"></script>
<title>
</title>
</head>
<body>
<div id="logoDiv"><img id="logo" src="images/logo.png" /></div>
<form id="search_toolbar" method="get" action="/solr/select">
<input id="searchinput" type="text" name="q" value="search" size="28" maxlength="200" onfocus="searchBarOnFocus(this)" onblur="searchBarOnBlur(this)" /></form></div>
</br>
<div class="outer-container">
<div class="container">
<div class="header"><h1 class="removeBottomPadding">
</br>
&nbsp; &nbsp; 180 Days Documents         
</div>
</div><div id="dmApplicability"><h2 id="dmApplicabilityTitle" class="removeBottomPadding"></h2><p></p></div><h1></h1><ol class="steplevel0"><li><div id="d534007e87" class="step">

<div class="note"><h4 class="removeTopBottomPadding noteText">NOTE</h4>
<div class="cautionText">This Documents Downloaded From ADDs Page/Last Revision Date : dd/mm/yy </div>
</div>
<div><table class="hoverRowBackEnabled setFixedHeaderEnabled"><thead><tr><th>
</div></li></ol></div><div class="legendDiv" id="legendDiv"><div id="legend-anchor">
<div id="legendWindow" class="legendWindow hide"></div></div></div>
<div id="scroller-anchor"></div><div id="scroller">                     
<div id="zoom_container"><div class="landmarks" data-show-at-zoom="100" data-allow-drag="false"></div></div><h3 id="canvas-title"></h3></div></div></div></div>
<div class="tirDIV"></div>
<table id="userdata" border="2">
<tr>

            <th width="10%"  axis="category_name">  Revision  Date </th>
            <th width="9%" align="center">  Document  Name </th>
            <th width="11%" align="center">  Department </th>
            <th width="46%" axis="category_name"> Description</th>
</tr>
    </table>


<script> 


 $.each(data.person, function(i, person) {
            var tblRow =  

"<tr><td>" + person.revisiondate +
"</td><td><a  target='_blank' href='"+ person.documentname.split('href=')[0]+"' >"+person.documentname.split('href=')[0]+"</a></td>"+
"<td>" + person.department +
"</td><td>" + person.description + "</td></tr>"

            $(tblRow).appendTo("#userdata tbody");
        });
</script>
</body>
</html>
我的html在运行之后

前4个文件运行良好,我的意思是,当我单击时,这些文件可以打开,因为这些PDF与html和this位于同一文件夹中。拆分代码会以某种方式触发这些PDF。我真正的问题是最后一个pdf,最后一个pdf在另一个文件夹中,由于文件路径而无法打开。Href=不足以将路径描述为前4个文件,我需要为代码编写一个文件路径,如

C:\folder2\other.pdf


我该怎么做呢?

我已经读了好几遍这个问题,恐怕我还是不明白问题出在哪里,以及您希望我们帮助什么。假设英语不是你的第一语言——这很好——我想知道你是否可以向一位朋友解释这个问题,他也许能够提供一个替代的,也许更好的,解释你需要什么。请:花点时间阅读“”指南。比如@DavidThomas,我不明白
href
是从哪里来的……这不是关于语言,而是关于代码和计算机的知识:)我读了,但我想没人知道。像我一样拆分标签。因为我找不到语法。有趣的是,它的工作方式是错误的。同样,如果您的href指定了一个与html位于同一文件夹中的pdf文件,则该文件正在工作。但我的PDF与html不在同一文件夹中。我需要在我的代码中添加一些href,以便从另一个文件夹(如“C:\path\to\myfile.pdf”)获取pdf。我如何才能做到这一点@大卫·托马斯姆我的意图不是侮辱你,或驳回你的问题,我想帮助你(和其他人一样,这就是我们很多人在这里花费时间的原因!),但除非我能理解你的问题,否则我帮不了你,这对我来说很沮丧,因为我想帮助,而对你来说,因为你需要帮助。好的,请看编辑。我试图用所有的html和示例@DavidThomas进行解释