JS循环和ONCLINK事件调用

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>search</title>
</head>
<body>
<input onfocus="MyFocus()" onblur="MyBlur()" id = 'search' type="text" value="Please you key wold!!!">
<input onclick="test()" type="button" value="button1"/>
<script type="text/javascript">
function MyFocus(){
var obj = document.getElementById('search');
obj.value = '';
}
function MyBlur(){
var obj = document.getElementById('search');
if(obj.value.trim().length < 1){
obj.value='Please you key world' ;
}
}
function test(){
var a= '1111111921301212324' ;
for (var item in a ){
console.log(a[item]);
}
var a= '22222222222222222921301212324' ;
for (var i=0 ;i< a.length;i++){
console.log(a[i]);
}
}
</script>
</body>
</html>
posted @ 2016-05-30 11:17  FreeMan1  阅读(866)  评论(0编辑  收藏  举报