在javascript中插入标记的链接

时间:2017-08-18 22:40:24

标签: javascript

我尝试在<a>之前和class1关闭<lable>标记之后在</label>中插入</a>标记。 我的代码

 <div class="class1>

<label  class="class2">test</label>

</div>

我想在javascript受影响后,代码输出看起来像这个

 <div class="class1>
<a>
<label  class="class2">test</label>
</a>                                                   
</div>

请帮助我得到这个结果。

2 个答案:

答案 0 :(得分:0)

我在php中的程序得到了这个结果我

<div class="class1>

<label  class="class2">test</label>

</div>

我想在我的php项目结果中使用此类标记时,java脚本获取更改代码到我解释的上层信息 请给我简单的解决方法

答案 1 :(得分:0)

https://jsfiddle.net/nk50eLpv/

from multiprocessing import Pool
import numpy as np

# Global variables are OK, as long as their contents are not modified, although
# these might just as well be moved into the worker function or an initializer
nx = 20
ny = 30
myList1 = [0]*100
myList2 = [1]*25
value1 = np.zeros(nx)
value2 = np.zeros(ny)

def calc_meanvals_for(pair):
    """Process a reasonably sized chunk of the problem"""
    i, j = pair
    f = calc(value1[i], value2[j])
    results = []
    for k, data1 in enumerate(myList1):
        for p, data2 in enumerate(myList2):
            meanval = np.sum(f[:]/data1)*data2
            results.append((i,j,k,p,meanval))
    return results

# This module will be imported by every worker - that's how they will be able
# to find the global variables and the calc function - so make sure to check
# if this the main program, because without that, every worker will start more
# workers, each of which will start even more, and so on, in an endless loop
if __name__ == '__main__':
    # Create a pool of worker processes, each able to use a CPU core
    pool = Pool()
    # Prepare the arguments, one per function invocation (tuples to fake multiple)
    arg_pairs = [(i,j) for i in range(nx) for j in range(ny)]
    # Now comes the parallel step: given a function and a list of arguments,
    # have a worker invoke that function with one argument until all arguments
    # have been used, collecting the return values in a list
    return_values = pool.map(calc_meanvals_for, arg_pairs)
    # Since the function also returns a list, there's now a list of lists - consider
    # itertools.chain.from_iterable to flatten them - to be processed further
    store = np.zeros(nx, ny, len(myList1), len(myList2))
    for results in return_values:
        for i, j, k, p, meanval in results:
            store[i,j,k,p] = meanval
相关问题