2013년 11월 17일 일요일

html 정중앙 한가운데 위치시키기

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!-- 중요 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- 중요 -->
<title>중앙</title>
<style>
body {
 background-image: url(apple.png);
 background-color: black;
 background-position: 50%;
 margin: 0;
 width: 100%;
 height: 100%;
}
</style>
</head>
<body>
<table style="height:100%;width:100%">
<tr>
<td align=center valign=middle height="100%" width="100%"> <!-- 따옴표 필수 -->
<table>
<tr>
<td>
중앙
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
중앙
중앙

로그인에 마우스 클릭하면 아이디 비밀번호 없어졌다가 다시 나타나기

Insert title here
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<script>
function idFocus(){
 if(document.getElementById('id').value == '아이디')
  document.getElementById('id').value = '';
}
function idBlur(){
 if(document.getElementById('id').value == '')
  document.getElementById('id').value = '아이디';
}
function pwFocus(){
 if(document.getElementById('password').value == '비밀번호') {
  var original = document.getElementById('password');
  var copy = original.cloneNode(false);
  copy.type = 'password';
  copy.value = '';
  original.parentNode.replaceChild(copy, original);
  copy.focus();
  copy.select();
 }
}
function pwBlur(){
 if(document.getElementById('password').value == '') {
  var original = document.getElementById('password');
  var copy = original.cloneNode(false);
  copy.type = 'text';
  copy.value = '비밀번호';
  original.parentNode.replaceChild(copy, original);
 }
}
</script>
</head>
<body>
<table>
<tr>
<td>
<form method=post>
<input type=text value="아이디" name=id id=id onfocus=idFocus() onblur=idBlur()>
<input type=text value="비밀번호" name=password id=password onfocus=pwFocus() onblur=pwBlur()>
<input type=submit value="로그인">
</form>
</td>
</tr>
</table>
</body>
</html>

2013년 11월 5일 화요일

윈도우8.1용 에어로 스타트버튼 startisback

추천하는 이유는 윈도우8 모양에 에어로를 추가할 수도 있다는 점입니다.
제작자 홈페이지 : http://www.startisback.com/
윈도우8용 2.1.2 바로 다운로드 : http://www.startisback.com/StartIsBack_setup.exe
윈도우8.1용 1.0.4 바로 다운로드 : http://www.startisback.com/StartIsBackPlus_setup.exe

2013년 10월 28일 월요일

자바스크립트에서 태그 스타일 바꾸기

<script>
document.getElementById('tagId').setAttribute('style', 'width:500px'); // style='width:500px'
document.getElementById('tagId').removeAttribute('style'); // style==null
</script>
.
.
.
<input type="text" id="tagId" />



 

2013년 10월 27일 일요일

브라우저 종류 구별하기 java jsp

검색해보면

<!--[if IE]>
<![endif]-->

뭐 이런거 도 나오지만 될 때는 되는데 잘 안 됩니다.

그냥 userAgent 뽑아서 확인하는 게 최곱니다.



1. JavaScript 에서 뽑아서 확인하는 방법입니다.

<script>
var ua = window.navigator.userAgent;
document.write(ua);
</script>


 
2. JSP 에서 뽑아서 확인하는 방법입니다.
 
<%
String ua = request.getHeager("User-Agent");
out.print(ua);
%>


 
뽑아서 보면 대충 이렇게 나옵니다.
 
1. Internet Explorer 11
Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko  
 
1-1. Internet Explorer 10
Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)
 
2. Safari
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2

3. Chrome
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36
 
4. Opera
Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.101 Safari/537.36 OPR/17.0.1241.53 

4-1. Opera 구버전
Opera/9.80 (Windows NT 6.1; WOW64; U; ko) Presto/2.10.229 Version/11.62
 
5. Firefox
Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Firefox/24.0
 
여기서 각각 특징있는 단어를 뽑아서 브라우저를 구별하면 됩니다.
한가지 주의사항이 있는데, IE10까지는 MSIE라는 단어로 구별해왔습니다만 IE11에는 자세히 보면 MSIE라는 단어가 없습니다.
그래서 IE11은 Trident 라는 단어로 구별해야합니다.
Trident라는 단어는 IE6~IE7 에는 없고 IE8~IE11까지 있습니다.
 
오페라도 Opera와 OPR 두 가지로 구별해야겠습니다.


 
1. JavaScript 에서 구별하는 방법입니다.
 
<script>
var b = "";
var ua = window.navigator.userAgent;
if(ua.indexOf('MSIE') > 0 || ua.indexOf('Trident') > 0)
 b = "IE";
else if(ua.indexOf('Opera') > 0 || ua.indexOf('OPR') > 0)
 b = "Opera";
else if(ua.indexOf('Firefix') > 0)
 b = "Firefox";
else if(ua.indexOf('Safari') > 0) {
 if(ua.indexOf('Chrome') > 0)
  b = "Chrome";
 else
  b = "Safari";
}
document.write(ua);
document.write(b);
</script>


 
2. JSP 에서 구별하는 방법입니다.
 
<%
String browser = "";
String userAgent = request.getHeader("User-Agent");
if (userAgent.indexOf("Trident") > 0 || userAgent.indexOf("MSIE") > 0) {
 browser = "IE";
} else if (userAgent.indexOf("Opera") > 0) {
 browser = "Opera";
} else if (userAgent.indexOf("Firefox") > 0) {
 browser = "Firefox";
} else if (userAgent.indexOf("Safari") > 0) {
 if (userAgent.indexOf("Chrome") > 0) {
  browser = "Chrome";
 } else {
  browser = "Safari";
 }
}
out.print(userAgent);
out.print(browser);
%>
 

mysql 이클립스 한글 깨질때 eclipse jsp php

검색해보면 여러가지 나옵니다.

아무리 해도 안 될 때가 있습니다.

긴말하지 않겠습니다.

한번 해보세요.


2013년 10월 21일 월요일

Apink + Girls day = Agirls ??? 뭐야

우려했던 일이 벌어지고 말았다...

핑클의 아류인 에이핑크가 나오고 소녀시대의 아류인 걸스데이가 나온 것 까지는 그러려니 했다...

그런데 설마설마 하던 일이 벌어지고 말았으니

으아아아아아아아아아

바로 Agirls 미쳐..

이거 언젠가는 대박난다 미치게따 진짜