336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
안녕하세요.
selectbox에 있는 값을 가져오거나 선택한 것을 가져오는 소스코드입니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 |
<script>
window.onload = function(){
//차례대로
//선택한순서
//옵션(select박스 안쪽에 있는 값을 가져오기 위함입니다.
//값을 가져옵니다.
var x = document.getElementById("mySelect").selectedIndex;
var y = document.getElementById("mySelect").options;
var z = document.getElementById("mySelect").value;
//순서대로 값을 띄워줍니다.
alert("Index: " + y[x].index + " is " + y[x].text+" is " + z);
}
</script>
<select id="mySelect">
<option value="Banana1!">Banana</option>
<option value="값">값 선택</option>
</select>
|
cs |
감사합니다.
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
안녕하세요.
이번에는 url 주소창 값을 통해서 필요한 처리를 하는 방법을 알려드릴께요.
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
32
33
34 |
<script>
window.onload = function(){
//해당 일치하는 부분을 호출해 옵니다. 필요한 부분을 가져다가 쓰시면됩니다
//ex)
if(location.href == "http://jdkblog.tistory.com"){
alert('해당 페이지로 이동합니다');
location.href = location.href;
}
//-javascript-
//location.href -> http://localhost:8088/login/login.do?key=value
//location.protocol -> http:
//location.host -> localhost:8088
//location.pathname -> /login/login.do
//location.search -> ?key=value
//-jquery-
//jQuery(location).attr('href') -> http://localhost:8088/login/login.do?key=value
//jQuery(location).attr('protocol') -> http:
//jQuery(location).attr('host') -> localhost:8088
//jQuery(location).attr('pathname') -> /login/login.do
//jQuery(location).attr('search')-> ?key=
}
</script>
|
cs |
감사합니다.
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
안녕하세요.
이번엔 브라우저를 어떤 것을 사용하는지 알려주는 소스입니다.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 |
<script>
window.onload = function (){
alert(getBrowser());
}
function getBrowser(){
var agt = navigator.userAgent.toLowerCase(); //브라우저 정보 획득
if (agt.indexOf("chrome") != -1) return 'Chrome';
if (agt.indexOf("opera") != -1) return 'Opera';
if (agt.indexOf("staroffice") != -1) return 'Star Office';
if (agt.indexOf("webtv") != -1) return 'WebTV';
if (agt.indexOf("beonex") != -1) return 'Beonex';
if (agt.indexOf("chimera") != -1) return 'Chimera';
if (agt.indexOf("netpositive") != -1) return 'NetPositive';
if (agt.indexOf("phoenix") != -1) return 'Phoenix';
if (agt.indexOf("firefox") != -1) return 'Firefox';
if (agt.indexOf("safari") != -1) return 'Safari';
if (agt.indexOf("skipstone") != -1) return 'SkipStone';
if (agt.indexOf("msie") != -1) return 'Internet Explorer';
if (agt.indexOf("netscape") != -1) return 'Netscape';
if (agt.indexOf("mozilla/5.0") != -1) return 'Mozilla';
}
</script>
|
cs |
감사합니다.