Home >Backend Development >PHP Tutorial >onclick跳转问题

onclick跳转问题

WBOY
WBOYOriginal
2016-06-23 13:25:261085browse



  怎么能onclick之后获取 "t" 的值  在跳到query


回复讨论(解决方案)

document.getElementById("t").value  得到t  值,然后赋值给query

document.getElementById("t").value  得到t  值,然后赋值给query


我也是这么想的呢  但是就是行不通
{literal}
<script> <br />function load(){ <br />var id=document.getElementById("t").value; <br />alert(url=‘city.php?module=query&t='+t; ); <br />} <br /></script>
{/literal}
这应该对啊

function load(){    var id=document.getElementById("t").value;    window.location.href = url=‘city.php?module=query&t='+t;}

{literal}
<script> <br />function load(){ <br /> var id=document.getElementById("t").value; <br />alert(url= ‘city.php?module=query&t='+ t; );//这个t变量根本没有定义。你定义的是id... <br />} <br /></script>
{/literal}

{literal}<script language="javascript">function load(){var id=document.getElementById("t").value;alert(url='city.php?module=query&t='+id);location.href=url;}</script>{/literal}

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