Home >Web Front-end >HTML Tutorial >Super simple question, novice asking for help_html/css_WEB-ITnose

Super simple question, novice asking for help_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:25:41916browse

Regarding href parameter passing, the value to be passed is the value of a certain input, for example, dafac676f815ef013fc1a05407d9db23
href, for example, is 490f65d28ab4df3b00f2fc84e0d396385db79b134e9f6b82c0b36e0489ee08ed, put the input value in href, how to achieve it


Reply to discussion (solution)

Yours Hyperlinks always have a click event, and write JS to pass it in that event.

<input type="hidden" id="hidden1" name="yhbh" value="123"><a onclick="goto()">goto</a> 


JS function
function goto(){  alert($("#hidden1").val())}


Result


Maybe you will $("#hidden1").val( ) followed by the URL you want to redirect

<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"><title>test</title><script type="text/javascript" src="js/app.js"></script></head><style type="text/css"></style><body><input type="text" value="test" class="txt" /><a href="http://www.test.com" title="" class="link">click</a><script type="text/javascript">$(function(){	    var val = $(".txt").val(),href = $(".link").attr("href");	    $(".link").attr("href",href +"?aa="+ val);})</script></body></html>

9279c3d0e2ee1ba7f3d8ed2430115225
e9d6c433524b8ecbe4c81862ff9d3024
f07a04e048e54101da6a39b569d731d9
f5a47148e367a6035fd7a2faa965022e

What a big head! !

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn