Skip to content

Instantly share code, notes, and snippets.

@chintamanand
Created June 28, 2017 04:51
Show Gist options
  • Save chintamanand/8c51a9ce74efcb7f1c4134ce3601581b to your computer and use it in GitHub Desktop.
Save chintamanand/8c51a9ce74efcb7f1c4134ce3601581b to your computer and use it in GitHub Desktop.
AREACODEOFNUMBER // source https://jsbin.com/didokes
<!DOCTYPE html>
<html>
<head><title>AREACODEOFNUMBER</title></head>
<body>
<input type="text" id="demo1"></input>
<br>
<button type="button" onclick="function1()">clickhere</button>
</br>
<br>
<p>area code is shown here:-</p>
<input type="text" id="demo2" readonly="true"> </input>
</br>
<br>
<p>phonenumber is shown here:- </p>
<input type="text" id="demo3" readonly="true"></input>
</br>
<script>
function function1()
{
var str1=document.getElementById("demo1").value;
var res1=str1.substr(1,3);
var res2=document.getElementById("demo2")
res2.value=res1;
var str5=document.getElementById("demo1").value;
var res3=str5.substr(5,10);
var res4=document.getElementById("demo3")
res4.value=res3;
}
</script>
<script id="jsbin-source-html" type="text/html"><!DOCTYPE html>
<html>
<head><title>AREACODEOFNUMBER</title></head>
<body>
<input type="text" id="demo1"></input>
<br>
<button type="button" onclick="function1()">clickhere</button>
</br>
<br>
<p>area code is shown here:-</p>
<input type="text" id="demo2" readonly="true"> </input>
</br>
<br>
<p>phonenumber is shown here:- </p>
<input type="text" id="demo3" readonly="true"></input>
</br>
<script>
function function1()
{
var str1=document.getElementById("demo1").value;
var res1=str1.substr(1,3);
var res2=document.getElementById("demo2")
res2.value=res1;
var str5=document.getElementById("demo1").value;
var res3=str5.substr(5,10);
var res4=document.getElementById("demo3")
res4.value=res3;
}
<\/script>
</body>
</html>
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment