相关疑难解决方法(0)

通过jQuery更改链接href

可能重复:
如何使用jQuery更改超链接的href

我正在使用Drupal并且系统生成我的标题.

例如

    <a class="jquery-once-3-processed" id="quicktabs-tab-galeri-1" 
href="/?q=node&amp;qt-galeri=1#qt-galeri">NEWS</a>
Run Code Online (Sandbox Code Playgroud)

我想href通过jQuery 更改此链接.我怎样才能做到这一点?谢谢.

javascript jquery

3
推荐指数
2
解决办法
5万
查看次数

我需要使用jquery更新href值

我需要使用jquery更新页面的href值.请将href ="http://www.google.com?gsec=account"更改为href ="http://account.google.com?gsec=account"我如何完成此操作.

jquery

2
推荐指数
1
解决办法
1万
查看次数

更改Jquery中另一个链接的链接

我正在处理的网站有添加到购物车的链接我想更改该链接指向不同的页面我如何在jquery中实现这一点.

$(document).ready(function() {
    //alert('Welcome to StarTrackr! Now no longer under police …');
    $("a[href='http://www.somesite.com/scAddItem.aspx?action=add&BJID=421&extra=type,journalIssue,volume,2,issue,<web::ISSUE>,npus,$99.00,npcdn,$99.00']").attr('href', 'http://www.live.com/');
});
Run Code Online (Sandbox Code Playgroud)

我正在尝试从这里得到这个想法 如何使用jQuery更改超链接的href, 但它不适合我任何帮助表示赞赏.

jquery

1
推荐指数
1
解决办法
1743
查看次数

使用php/javascript查找并替换网页中的所有链接

我需要在一些HTML代码的一部分中找到链接,并用两个不同的绝对或基本域替换所有链接,然后是页面上的链接...

我找到了很多想法并尝试了很多不同的解决方案.在这一方面运气不好......请帮助我!谢谢!!

这是我的代码:

<?php
$url = "http://www.oxfordreference.com/views/SEARCH_RESULTS.html?&q=android";
$raw = file_get_contents($url);
$newlines = array("\t","\n","\r","\x20\x20","\0","\x0B");
$content = str_replace($newlines, "", html_entity_decode($raw));

$start = strpos($content,'<table class="short_results_summary_table">');
$end = strpos($content,'</table>',$start) + 8;
$table = substr($content,$start,$end-$start);

echo "{$table}";

$dom = new DOMDocument();
$dom->loadHTML($table);

$dom->strictErrorChecking = FALSE;

// Get all the links
$links = $dom->getElementsByTagName("a");
foreach($links as $link) {
  $href = $link->getAttribute("href");
  echo "{$href}";

  if (strpos("http://oxfordreference.com", $href) == -1) {
  if (strpos("/views/", $href) == -1) {
     $ref = "http://oxfordreference.com/views/"+$href;
  }
  else 
      $ref = "http://oxfordreference.com"+$href;
    $link->setAttribute("href", $ref);
    echo …
Run Code Online (Sandbox Code Playgroud)

php replace href preg-replace

1
推荐指数
1
解决办法
4389
查看次数

如何通过Javascript Jquery更改<a>的"href"?

假设我有这个:

<a id="main_link" href="http://feedproxy.google.com/~r/AmazonWire/~5/FN5UZlXKwdY/SalmanRushdiePodcast.mp3">
Run Code Online (Sandbox Code Playgroud)

如何使用Jquery将"href"更改为其他内容?

javascript jquery

0
推荐指数
1
解决办法
352
查看次数

从javascript制作超链接

我想在HTML页面中使用超链接字符串,我想在我的js文件中声明源链接(URL).请告诉我如何将我的js中的URL称为html.

谢谢

html javascript

0
推荐指数
1
解决办法
2万
查看次数

标签 统计

jquery ×4

javascript ×3

href ×1

html ×1

php ×1

preg-replace ×1

replace ×1