How to pass variable to href in javascript?

You have to fetch field value using .value as you are passing whole object to the URL as document.getElementbyId('value') returns whole field object.

var dist = document.getElementById('value').value;

So your function should be like this

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

You have fetch value of the field, Currently you are using DOM object

Use

 var dist = document.getElementById('value').value;

OR

Use

 if (dist.value!=""){
     window.location.href="district.php?dist="+dist.value;

instead of

if (dist!=""){
     window.location.href="district.php?dist="+dist;