如何使用URL参数更改页面上的链接href?

时间:2017-04-08 14:51:58

标签: javascript jquery html hyperlink

我想使用网址参数更改链接的href值。

示例:

默认 <a id="dlink" href="link-1">LINK</a>

但是,当用户使用此类https://url.com/?dlink=link-2

它交换了链接

新链接 <a id="dlink" href="link-2">LINK</a>

2 个答案:

答案 0 :(得分:0)

首先,您需要从网址获取价值。如果你没有使用某些javascript框架,你可以使用jquery为它创建一个函数。

请检查Get url parameter jquery Or How to Get Query String Values In js

之后,获取元素&#34; a&#34;按ID并在那里设置值。

$("#dlink").attr("href", hrefFromParam);

答案 1 :(得分:-1)

请参阅此功能以获取网址参数:Get url parameter jquery Or How to Get Query String Values In js

使用jQuery,您可以设置Using TensorFlow backend. I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcublas.so.7.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcudnn.so.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcufft.so.7.5 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcuda.so.1 locally I tensorflow/stream_executor/dso_loader.cc:135] successfully opened CUDA library libcurand.so.7.5 locally Found 3517 images belonging to 50 classes. <keras.preprocessing.image.DirectoryIterator object at 0x7fd1d4515c10> Found 2451 images belonging to 50 classes. Epoch 1/50 W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE3 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.1 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use SSE4.2 instructions, but these are available on your machine and could speed up CPU computations. W tensorflow/core/platform/cpu_feature_guard.cc:45] The TensorFlow library wasn't compiled to use AVX instructions, but these are available on your machine and could speed up CPU computations. I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:910] successful NUMA node read from SysFS had negative value (-1), but there must be at least one NUMA node, so returning NUMA node zero I tensorflow/core/common_runtime/gpu/gpu_device.cc:885] Found device 0 with properties: name: GRID K520 major: 3 minor: 0 memoryClockRate (GHz) 0.797 pciBusID 0000:00:03.0 Total memory: 3.94GiB Free memory: 3.91GiB I tensorflow/core/common_runtime/gpu/gpu_device.cc:906] DMA: 0 I tensorflow/core/common_runtime/gpu/gpu_device.cc:916] 0: Y I tensorflow/core/common_runtime/gpu/gpu_device.cc:975] Creating TensorFlow device (/gpu:0) -> (device: 0, name: GRID K520, pci bus id: 0000:00:03.0) 8098/13076 [=================>............] - ETA: 564s - loss: 15.6869 - categorical_accuracy: 0.0267

href属性
<a>