보호되어 있는 글입니다.
내용을 보시려면 비밀번호를 입력하세요.



<script type="text/javascript">

     function fnSearchText()
     {
       var url = "XXXX.aspx?code=" + document.getElementById("<%= txtSearch.ClientID %>").value; 

       return false;
     }
</script>

<body>

    <asp:TextBox ID="txtSearch" runat="server" UseEnterAction="true" />
    <asp:Button ID="btnSearch" runat="server" Text="검색" OnClientClick="return fnSearchText();" OnClick="btnSearch_Click" />

</body>

 

=====================================================================================

 


[코드비하인드 페이지 부분] --> 여기서는 "btnSearch"에 주는 별다른 이벤트는 없으므로 패스



    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
                                                 
        }
        catch (Exception ex)
        {
            this.Error(ex);
        }
    }



 


 

Posted by holland14
:



<script type="text/javascript" language="javascript"> 

 // 주민번호 포커스 이동
    function fnCheckLength()
    {
        if(document.getElementById("<%= txtJumin1.ClientID %>").value.length == 6)
        {
            document.getElementById("<%= txtJumin2.ClientID %>").focus();
        }
    }

</script>



<body>

<asp:TextBox ID="txtJuMin1" MaxLength="6" TextType="Number" runat="server" onKeyUp="fnCheckLength();" ></asp:TextBox>
                -
<asp:TextBox ID="txtJumin2" MaxLength=7" TextMode="Password" TextType="Number" runat="server"></asp:TextBox>

</body>




Posted by holland14
:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <pre>
    <script type="text/javascript">
        var s = " Abc Def Fed Cba ";
        document.writeln(s.length); // 길이
        document.writeln(s.toUpperCase()); // 대문자
        document.writeln(s.toLowerCase()); // 소문자
        document.writeln(s.bold()); // 볼드
        document.writeln(s.italics()); // 이탤릭
        document.writeln(s.charAt(1)); // 1번째 인덱스 : A, C#의 IndexOf()명령어의 역할이다.
        document.writeln(s.substr(1, 3)); // 1번째부터 3자 : C#의 Substring()과 같다.
        document.writeln(s.lastIndexOf("b")); // 뒤에서 b검색 : 14 : C#의 LastIndexOf()와 같다.
        document.writeln(s.replace("Abc", "에이비씨")); // 치환
        var arr = s.split(' '); // 공백으로 분리해서 배열에 저장
        for (var i = 0; i < arr.length; i++) {
            document.writeln(arr[i]);
        }
       
        //[!] 퀴즈 : 아래 dir변수에서 파일명과 확장자를 추출해서 출력하시오.
        var dir = "C:\\Temp\\RedPlus.gif";

        var fullname = dir.substr(dir.lastIndexOf('\\') + 1);
        var name = fullname.substr(0, fullname.lastIndexOf("."));
        var ext = fullname.substr(fullname.lastIndexOf(".") + 1);
        document.writeln("전체파일명 : " + fullname);
        document.writeln("이름 : " + name);
        document.writeln("확장자 : " + ext);
       
    </script>
    </pre>
   
</head>
<body>

</body>
</html>

Posted by holland14
:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>날짜관련내장객체</title>

    <script src="date.js" type="text/javascript"></script>
    <script src="time.js" type="text/javascript"></script>
    <script type="text/javascript">
       
        // 현재 시간을 출력
        var today = new Date();
       
        // 출력
        document.write(today.getFullYear() + "<br />");
        document.write((today.getMonth() + 1) + "<br />");
        document.write(today.getDate() + "<br />");
        document.write(today.getDay() + "<br />"); // 0요일(일) ~ 6요일(토)
        document.write(today.getHours() + "<br />");
        document.write(today.getMinutes() + "<br />");
        document.write(today.getSeconds() + "<br />");
        document.write(today.getMilliseconds() + "<br />");
       
       
        // 자바스크립트 확장
        // date.js 검색/다운로드 및 사용 ==> '날짜'관련(DateTime) 명령어
        var il = Date.getDaysInMonth(2008, 2 - 1); //
        document.write(il + "<br />");

       
        // 시간차 : TimeSpan ==> time.js 검색/ 다운로드 및 사용 ==> '시간차' 관련 명령어
        var now = Date.today();
        var birth = Date.parse("1982-02-05");
        var span = new TimeSpan(now - birth);
        document.write(span.getDays() + "일 살았습니다.");
    </script>
   
</head>
<body>

</body>
</html>

Posted by holland14
:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
    <title></title>
    <script type="text/javascript">
        function Go() { location.href = "http://www.naver.com/"; }
    </script>
</head>
<body onload="alert('어서오세요~');" onunload="alert('벌써 가시게???');">
    <table border="1" width="100%">
        <tr>
            <td onclick="window.alert('클릭됨');">1클릭</td>
            <td onmouseover="this.style.backgroundColor='yellow';"
                onmouseout="this.style.backgroundColor='';">2마우스오버/마우스아웃</td>
            <td ondblclick="this.style.fontWeight='bold';">3두번클릭하면볼드체</td>
        </tr>
        <tr>
            <td onmousedown="Go();">4마우스다운(마우스클릭)</td>
            <td onmousemove="alert('꽝');">5마우스무브</td>
            <td onmouseup="window.open('http://www.naver.com', '', '');">6마우스업(마우스 눌렀다 뗄 때)</td>
        </tr>
        <tr>
            <td>
                <input type="text" onkeyup="alert(this.value);" maxlength="1" />
            </td>
            <td>
                <input type="text" onkeypress="alert(this.value);" maxlength="1" />
            </td>
            <td>
                <input type="text" onkeydown="alert(this.value);" maxlength="1" />
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" value="포커스"
                    onfocus="this.style.border='1px solid red';"
                    onblur="this.style.border='1px dotted gray';" />
            </td>
            <td>
                <input type="text" value="1234" onchange="alert('쉬는시간~');" />
            </td>
            <td></td>
        </tr> 
    </table>
   
   
   
   
    <script>
        function GoGo(url) {
            location.href = url;
        }
    </script>
    <select onchange="GoGo(this.value);">
        <option>- 즐겨찾기 -</option>
        <option value="http://www.dotnetkorea.com/">닷넷코리아</option>
        <option value="http://www.VisualAcademy.com/">비주얼아카데미</option>
    </select>
   
    <input type="text" onselect="alert(this.value);" value="1234" />

</body>
</html>

Posted by holland14
:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function ChangeStyle() {
            var div1 = document.getElementById("myLayer");
            div1.style.backgroundColor = "Yellow";
            div1.style.border = "1px solid red";
            div1.style.fontSize = "30pt";
        }
       
        function GoGo(flag) {
            var div1 = document.getElementById("myLayer");
            if (flag == -1) {
                div1.style.left = (parseInt(div1.style.left) - 10) + "px";
            }
            else {
                div1.style.left = (parseInt(div1.style.left.replace("px","")) + 10) + "px";
            }
        }
        // 함수를 만드는 또 다른 모양?
        var $ = document.getElementById; // 축약표시, AJAX, jQuery, prototype에서  많이 쓴다.
        ShowLayer = function() {
            var objLayer = document.getElementById("myLayer");
            // 보이면 숨기고, 안 보이면 보여라... toggle
            if (document.getElementById("myLayer").style.visibility == "visible") {
                $("myLayer").style.visibility = "hidden";
                objLayer.style.display = "none" // 영역자체를 없앰
            }
            else {
                $("myLayer").style.visibility = "visible";
                objLayer.style.display = "block"; // 영역보이기
            }
        };
   
    </script>
</head>
<body>

    <div id="myLayer" style="position:absolute;top:100px;border:1px solid black;left:100px;width:200px;height:50px;visibility:visible;">
    안녕하세요.
    </div>
    <input type="button" value="레이어 스타일 변경" onclick="ChangeStyle();" />
    <input type="button" value="왼쪽으로" onclick="GoGo(-1);" />
    <input type="button" value="오른쪽으로" onclick="GoGo(1);" />
    <a href="#" onclick="ShowLayer();">보이기/숨기기(토글)</a>
   
    <hr />
    <script>
        function ChangeSize(num) {
            var content = document.getElementById("txtContent");
            content.style.height =
            (parseInt(content.style.height.replace("px", "")) + num) + "px";
        }
    </script>
    <a href="#" onclick="ChangeSize(10);">[+ 증가]</a>
    <a href="#" onclick="ChangeSize(-10);">[- 감소]</a><br />
    <textarea id="txtContent" cols="40" rows="4" style="height:100px;"></textarea>

</body>
</html>

Posted by holland14
:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function CheckSelect() {
            if (document.getElementById("lstFavorite").selectedIndex == 0) {
                alert("관심사항을 선택하시오.");
                document.getElementById("lstFavorite").focus();
            }
            else {
                window.alert("당신의 관심사항 : " + document.getElementById("lstFavorite").value);
            }
        }   
    </script>
</head>
<body>
    관심사항<br />
    <select id="lstFavorite">
        <option value="">- 선택 -</option>
        <option value="C#">C#</option>
        <option value="ASP.NET">ASP.NET</option>
        <option value="Sliverlight">Silverlight</option>
    </select>

    <input type="button" value="확인" onclick="CheckSelect();" />
</body>
</html>

Posted by holland14
:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script type="text/javascript">
        function CheckAgree() {
            // 체크박스가 체크되었는지 확인
            if (document.getElementById("chkAgree").checked) {
                return true; // Summit 진행
            }
            else {
                alert("동의하셔야합니다.");
                document.getElementById("chkAgree").focus(); //
                return false; // onsubmit 이벤트 중지
            }

        }

        function SetDis() {
            document.getElementById("btnSubmit").disabled =
                    !document.getElementById("chkAgree").checked;
        }
    </script>
</head>
<body>
    <form id="Frm" name="frm" action="LoginProcess.aspx" method="post" onsubmit="return CheckAgree();">
        약관에 동의하시겠습니까?
        <input type="checkbox" id="chkAgree" onclick="SetDis();" /> 동의함
        <input type="submit" id="btnSubmit" value="회원가입페이지로 이동" />
    </form>
   
    <script>
        // 기본값으로 버튼 비활성화
        document.getElementById("btnSubmit").disabled = true; // 비활성화
    </script>

</body>
</html>



==============================================================================================


==> LoginProcess.aspx


<%@ Page Language="C#" %>

<%
    Response.Write(String.Format("아이디 : {0}<br />암호 : {1}<br />"
        , Request["txtUID"], Request["txtPwd"]));
 %>
 <input type="button" value="뒤로" onclick="history.go(-1);" />

Posted by holland14
:

==> 폼.htm


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>입력 값에 대한 유효성 검사</title>
    <script type="text/javascript">
        function CheckForm() {
            // 아이디 텍스트박스 객체 가져오기
            var txtUID = window.document.LoginForm.txtUID; // 고전방식
            // 체크
            if (txtUID.value == "") {
                window.alert("아이디를 입력하세요.");
                txtUID.focus(); // 해당 컨트롤에 포커스
                return false; // 현재 함수 멈춤
            }

            // 암호 텍스트박스 체크 : 길이
            var txtPwd = document.getElementById("txtPwd"); // 추천방식
            if (txtPwd.value.length < 3 || txtPwd.value.length > 12) {
                alert("암호를 3자 이상 12자 이하로 입력하시오.");
                txtPwd.focus();
                txtPwd.select(); // 선택:블록씌우기
                return false;
            }
            window.document.LoginForm.action = "LoginProcess.aspx"; // 동적변경
            window.document.LoginForm.submit(); // 폼 내용 전송
        }
    </script>
</head>
<body>
    <form id="LoginForm" name="LoginForm" action="LoginProcess.aspx" method="post">
        <table border="1" width="400">
            <tr>
                <td>아이디 : </td>
                <td><input type="text" id="txtUID" name="txtUID" /></td>
            </tr>
            <tr>
                <td>암호 : </td>
                <td><input type="text" id="txtPwd" name="txtPwd" /></td>
            </tr>
            <tr>
                <td colspan="2"><input type="button" value="로그인" onclick="CheckForm();" /></td>
            </tr>

        </table>
    </form>

</body>
</html>


==============================================================================================


==> LoginProcess.aspx


<%@ Page Language="C#" %>

<%
    Response.Write(String.Format("아이디 : {0}<br /> 암호 : {1}<br />"
        , Request["txtUID"], Request["txtPwd"]));
 %>
 <input type="button" value="뒤로" onclick="history.go(-1);" />

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

29. 드롭다운리스트체크(selectedIndex 사용)  (0) 2009.08.11
28. 폼(form)객체 - 2  (0) 2009.08.11
26. 히스토리(history) 객체  (0) 2009.08.11
25. 로케이션객체  (0) 2009.08.10
24. 도큐먼트객체  (0) 2009.08.10
Posted by holland14
: