0

I have some pages with a p tag

Page 1:     <p id="cat-one"></p>

Page 2:    <p id="cat-two"></p>

Page 3:   <p id="cat-one"></p>

and so on.

I have to first examine the para in the page and create a url dynamically and insert it into the para, depending on which category it belongs to.

Eg: cat-one
url  <a href="http://sdsdsad.com" target="_blank" />

cat-two
url  <a href="http://vbccvbcv.com" target="_blank" />

cat-three
url  <a href="http://ohgdssas.com" target="_blank" />

and so on.

This is what I have done

 var newLink = $('<a href="sdfdsfsdf.html" target="_blank"'>SomeText</a>');
    $("#cat-one").append(newLink);

however no idea who to check each para in an article and dynamically generate url;s

4

1 回答 1

0

您的意思是一个 html 文档中有 600 个 html 页面或 600 个页面元素?如果是第二个 - 那么你可以这样做 - http://jsfiddle.net/shershen08/MeF4t/8/

于 2012-05-29T14:21:08.213 回答