Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 76267

create the variable link as a hyperlink javascript

$
0
0

create a hyperlink with the variable link

<html>
<body>
<center><h1> retrive data</h1></center>
<h1 id="head1"> </h1>
<input type="text" placeholder="enter your unique id" id="pass"/>
 <input type = "button" value = "submit" id="but" onclick="myfunction();"/>


<script>
   var pass;

function myfunction()
{
   pass = document.getElementById("pass").value;
  document.writeln(pass);
  document.writeln("<br>");
  document.writeln("<br>");
  document.writeln("<br>");
  document.writeln("<br>");
  var passwordToLookFor = pass;
var ref = firebase.database().ref("users");
var query = ref.orderByChild("password").equalTo(passwordToLookFor);
query.once("value").then(function(snapshot) {
  snapshot.forEach(function(child) { // loop over the results
    console.log(child.key);
    console.log(child.val().user_name);

    var link = child.val().user_name;
    document.writeln(link);
    });
});
}
</script>
</body></html>

i want to create the value of link as a hyperlink i want the hyperlink to be created once when the function is called


Viewing all articles
Browse latest Browse all 76267

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>