2014년/JavaScript & JSP

[Java Script] input.Select

BroBroBro 2013. 2. 25. 22:14

<!DOCTYPE HTML>

<html>
<script>
document.addEventListener("DOMContentLoaded", function(){
var btn = document.querySelector('input[type="button"]');
btn.addEventListener("click", text_select, false);
},false);  

function text_select(event){
var input=document.querySelector('input[type="text"]');
input.select();
}
</script>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<form>
<input type="text" name ="tag" value="선택되어질 text" readonly="readonly" size="50"/>
<input type ="button" value="선택"/>
</form>
</body>
</html>

input.Select() 란 함수 ~! text속성일경우 선택을 하는 함수다 
선택이란 복사할수있는 상태를 말한다.~!

It is my first Html5& JavaScript sources ~! good job