samedi 7 octobre 2017

This isnt working, javascript user input and location

On my free time, i'm trying to code my own projects with javascript, reading and coding, if user write 1 and users ip is IP: 195.148.172.155 and city region is: Vaasa, Ostrobothnia then it should hide everything and show those which are blurred behind ( Food list) // for location it uses ipdata.co // if user write something else and not 1 and ip, location is wrong, it should write what ever user has written in front of "Your text: " i'm in stage of coding and learning, i would appreciate your suggestion, english is not my mother language :D

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
    <title></title>
     <script type="text/javascript" src="http://ift.tt/1PWaGdU  2.2.3.js"></script>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <div id="ip"></div>
    <script src="http://ift.tt/1DsvUFR"></script>
<div id="city"></div>
<pre id="response"></pre>
</head>
<style>
.class {
position: absolute;
-webkit-filter: blur(13px);
-moz-filter: blur(13px);
-o-filter: blur(13px);
-ms-filter: blur(13px);
filter: blur(13px);
}
span {
position: absolute;
width:100%;
text-align: center;
color:blue;
font-size:50px;
font-weight:bold;
}
</style>
<body >
 <div class="class" id="demo">   

<h2>Food list</h2>

<ul>
<li>Rice</li>
<li>Macaroni</li>
<li>pasta</li>
</ul>  
</div>   

<span><form>        
<input placeholder="Kirjoita Id" type="text" id="userInput"> <input   type="button"
value="paina tasta"
onclick="unesi(); return false;">
</form> 
<p>Your text : <b id="ispis"></b></p>
</span>
<script>
$.get("https://ipdata.co", function(response) {
$("#ip").html("IP: " + response.ip);
$("#city").html(response.city + ", " + response.region);
<!-- $("#response").html(JSON.stringify(response, null, 4)); -->
}, "jsonp");
function unesi(){
var userInput, voteable;
userInput = document.getElementById('userInput').value;

if (userinput =="1"){
document.getElementById(demo).style.display = "none";


} else {
document.getElementById('ispis').innerHTML= userInput;

}

document.getElementById('ispis').innerHTML= userInput;
}   

</script>

</body></html>

Aucun commentaire:

Enregistrer un commentaire