How to pass variable to href in javascript?

前端 未结 5 1697
没有蜡笔的小新
没有蜡笔的小新 2021-01-04 09:24

How to pass this variable value here? Below code is not working. And all other discussions on Stackoverflow are unclear.



        
5条回答
  •  天命终不由人
    2021-01-04 09:29

    Try this:

    var dist = document.getElementById('value').value;
    if (dist != "") {
     window.location.href="district.php?dist="+dist;
    }
    

提交回复
热议问题