블로그 이미지
암초보

calendar

1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31

Notice

Tag

05-19 03:15
2009. 9. 29. 15:09 프로그래밍/HTML&CSS

<table border="1" style="width:200px;"><tr><td>
ABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD
</td></tr></table><p>

<table border="1" style="width:200px;"><tr><td style="word-break:break-all;">
ABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCDABCD
</td></tr></table><p>

<table border="1" style="width:200px;"><tr><td>
홍길동 홍길동 홍길동 홍길동 홍길동 홍길동 홍길동 
</td></tr></table><p>

<table border="1"  style="width:200px;"><tr><td style="word-break:keep-all;">
홍길동 홍길동 홍길동 홍길동 홍길동 홍길동 홍길동
</td></tr></table>

<table border="1" style="width:200px;"><tr><td>
홍길동 홍길동 홍길동 홍길동 홍길동 홍길동 홍길동
</td></tr></table><p>

<table border="1"  style="width:200px;"><tr><td style="white-space:nowrap;">
홍길동 홍길동 홍길동 홍길동 홍길동 홍길동 홍길동
</td></tr></table>

결과 :

posted by 암초보
2009. 9. 28. 20:27 프로그래밍/JavaScript
// 자바스크립트 긁기

javascript:function r(d){d.oncontextmenu=null;d.onselectstart=null;d.ondragstart=null;d.onkeydown=null;d.onmousedown=null; d.body.oncontextmenu=null;d.body.onselectstart=null;d.body.ondragstart=null;d.body.onkeydown=null; d.body.onmousedown=null;};function unify(w){r(w.document);if(w.frames.length>0){for(var i=0;i<w.frames.length;i++){try{unify(w.frames[i].window);}catch(e){}};};};unify(self);alert("ok");


posted by 암초보
2009. 9. 28. 20:23 프로그래밍/JavaScript

var str = "';

str.replace(/(^\s*)|(\s*$)/g,"");//공백제거됨

 

 /* =================================================================
  앞/뒤 공백 제거
 ================================================================= */

 String.prototype.trim = function() {
  return this.replace(/\s/g, "");
 }

 

 /* =================================================================
  앞 공백 제거
 ================================================================= */

 String.prototype.ltrim = function() {

  var i, j = 0;
  var objstr

  for (i = 0; i < this.length; i++) {

   if (this.charAt(i) == ' ') j = j + 1;
   else break;
  }

  return this.substr(j, this.length - j + 1) 
 }

 /* =================================================================
  뒤 공백 제거
 ================================================================= */

 String.prototype.rtrim = function() {

  var i, j = 0;

  for (i = this.length - 1; i >= 0; i--) {

   if (this.charAt(i) == ' ') j = j + 1;
   else break;
  }

  return this.substr(0, this.length - j);
 }

'프로그래밍 > JavaScript' 카테고리의 다른 글

날짜 계산관련 스크립트  (0) 2009.09.30
유용한팁.  (0) 2009.09.28
window.open() 함수 사용시 주소표시줄 설정.  (0) 2009.08.29
LiteBox2  (0) 2009.08.23
getElementById 할 때..  (0) 2009.07.20
posted by 암초보
2009. 9. 17. 18:04 프로그래밍/Ajax

1) 스크립트 코드

 

<script type="text/javascript">

             var xmlHttp;

            

             //서버 연동을 위한 객체를 만드는 함수

             function createHttp(){

                           if(window.ActiveXObject){

                                        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");                                      

                           }else{

                                        xmlHttp=new XMLHttpRequest();

                           }

             }

             function startRequest(){

                           createHttp(); // 통신을 위한 객체 생성

                          

                           // 서버가 응답하면 수행할 callback함수를 등록한다.

                           xmlHttp.onreadystatechange=callback;

                          

                           // Get방식일 경우, 다음과 같이 요청.

                           var str=document.f1.login.value;

                           // 한글 처리를 위해 사용

                           var url="/ajax1/login?login="+escape(encodeURIComponent(str));

                           xmlHttp.open("GET",url,true);

                           xmlHttp.send(null);

             }

             // 서버가 응답하면 수행할 함수

             function callback(){

                           // readystate 요청 상태 - 4 : complete

                           if(xmlHttp.readyState==4){

                                        // 서버로부터 응답 상태 - 200 : ok 

                                        if(xmlHttp.status==200){

                                                     // responseText - 서버에서 응답한 데이터가 저장

                                                     alert(xmlHttp.responseText);

                                                     document.f1.login.value="";

                                                     document.f1.login.focus();                                                                            

                                        }

                           }

             }

</script>

 

----------------------------------------------------------------------------------------------------------

 

2) 서블릿 코드

 

public void doGet(HttpServletRequest request, HttpServletResponse response)

                                        throws ServletException, IOException {

 

                           response.setContentType("text/html;charset=euc-kr"); // response 한글처리

                          

                           /**

                            * 헤더에 노캐쉬를 지정하는 이유는 캐쉬된 문서를 사용하지 않고,

                            * 요청 때마다 업데이트 되도록 지정하기 위해서이다.

                            */

                           response.setHeader("Cache-Control", "no-cache");

                           PrintWriter out = response.getWriter();

                          

                           String param=request.getParameter("login");

                           param=URLDecoder.decode(param,"UTF-8"); // 파라미터값 한글처리

                          

                           if(param!=null && param!=""){

                                        if(param.equals("자바")){

                                                                  out.print("login success~~~~^^");

                                        }else{

                                        out.print("login fail~~~~T.T");

                                        }

                           }else{

                                        out.println("null.....");

                           }

                           out.flush();

                           out.close();

             }

'프로그래밍 > Ajax' 카테고리의 다른 글

IE에서의 문제  (0) 2011.08.24
IE에서 innerHTML시 에러  (0) 2011.05.26
ajax로 textarea 의 값 변경시 문제점  (0) 2010.03.11
posted by 암초보
2009. 9. 1. 13:24 프로그래밍/HTML&CSS

<input type=text name="massage" autocomplete="off">
posted by 암초보
2009. 8. 29. 13:49 프로그래밍/JavaScript
window.open(URL, 창이름, 설정값)

설정값에 location=no 추가하면 된다.

(새창을 열때, 주소표시줄로 포커스가 이동하는 문제 해결)

'프로그래밍 > JavaScript' 카테고리의 다른 글

유용한팁.  (0) 2009.09.28
자바스크립트 trim()  (0) 2009.09.28
LiteBox2  (0) 2009.08.23
getElementById 할 때..  (0) 2009.07.20
eval()함수  (1) 2009.07.01
posted by 암초보
2009. 8. 24. 09:29 프로그래밍/HTML&CSS

<NOBR STYLE="width:80;overflow:hidden;text-overflow:ellipsis">가나다라마바사아자차카타파하</NOBR>

NOBR : 독립적으로사용하는 줄바꿈태그금지, 문자열이긴경우 width 무시하고 계속 셀이 커짐.
width : 80px  - 80px으로 설정
overflow : hidden - 80px이 넘으면 보이지 않음
text-overflow : ellipsis - 문자열이 80px를 넘는 문자열인 경우 자동으로 "..." 붙임
posted by 암초보
2009. 8. 23. 16:08 프로그래밍/JavaScript

'프로그래밍 > JavaScript' 카테고리의 다른 글

유용한팁.  (0) 2009.09.28
자바스크립트 trim()  (0) 2009.09.28
window.open() 함수 사용시 주소표시줄 설정.  (0) 2009.08.29
getElementById 할 때..  (0) 2009.07.20
eval()함수  (1) 2009.07.01
posted by 암초보
2009. 8. 5. 19:39 프로그래밍/Servlet&JSP
자바스크립트든 어디든, 인코딩 시켜준 타입으로 디코딩 해주면..
한글 안깨짐..

URLDecoder.decode(query, "utf-8);

'프로그래밍 > Servlet&JSP' 카테고리의 다른 글

<c:forEach>에서 인덱스 사용법  (0) 2013.11.27
fmt:parseDate 와 fmt:formatDate  (0) 2013.05.20
JSP 쿠키 생성, 삭제  (0) 2009.08.04
posted by 암초보
2009. 8. 4. 09:02 프로그래밍/Servlet&JSP

저장

 

 Cookie cook1 = new Cookie("name", "kalzas");  //쿠키객체생성

 cook1.setPath="/";  //쿠키가 적용될 웹서버의 url 경로

 cook1.setMaxAge(60*60*24*365); //쿠키가 유지되는 시간(1년) -1일경우 페이지 닫으면 삭제

 cook1.setDomain = "url"; //응답해 줄 도메인 명

 response.addCookie(cook1);  //쿠키를 클라이언트에 세팅

  

 -가져오기

 

 try(

   Cookie[] cookies = request.getCookies();

   for(int i = 0; i < cookies.length; i++){

     out.println(cookies[i].getName() + "은" + cookies[i].getValue() + "입니다.);

   }

 }catch (Exception e){

   out.println(e);

 }

 

 -삭제하기

 

 try{

   Cookie[] cookies = request.getCookies();

   for(int i=0; i< cookies.length; i++){

     cookies[i].setMaxAge(0);

     cookies[i].setPath("/");              // 처음 설정한 Path 로 해줘야 쿠키가 삭제된다!

     response.addCookie(cookies[i]);

   }

   out.println("쿠키가 삭제되었습니다.");

 }catch(Exception e){

   out.println(e);

 }

 

특정 도메인과 연결된 경우에는 그 도메인의 요청에 의해서만 삭제해야 한다.

 

try{

   Cookie[] cookies = request.getCookies();

    for(int i=0; i< cookies.length; i++){

        Cookie cook = cookies[i];

        if(cook.getName().equals("ucc_login")) {

           cook.setPath = "/";

           cook.setDomain = "url"; 

           cook.setMaxAge(0);

           response.addCookie(cook);
        }

     }

} catch(Exception e) {

   out.println(e);

 }

'프로그래밍 > Servlet&JSP' 카테고리의 다른 글

<c:forEach>에서 인덱스 사용법  (0) 2013.11.27
fmt:parseDate 와 fmt:formatDate  (0) 2013.05.20
URLDecoder  (0) 2009.08.05
posted by 암초보