关于href传参的,要传递的值是某个input的value,比如说
href比如为,吧input的 value放到href中,如何实现
你的这个超链接总有一个click事件吧,在那个事件里面写JS传递。
<input type="hidden" id="hidden1" name="yhbh" value="123"><a onclick="goto()">goto</a>
function goto(){ alert($("#hidden1").val())}
<!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>
头好大呀!!
HTML怎么学习?HTML怎么入门?HTML在哪学?HTML怎么学才快?不用担心,这里为大家提供了HTML速学教程(入门课程),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号