How to pass variable to href in javascript?

前端 未结 5 1680
没有蜡笔的小新
没有蜡笔的小新 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:54

    You have to make some correction in your function..

    function check()
        {
            var dist = document.getElementById('value').value;  //for input text value
           if (dist!==""){  //  for comparision
               window.location.href="district.php?dist="+dist;
           }
           else
               alert('Oops.!!');
        }
    

提交回复
热议问题