인터넷익스플로어(IE)와 파이어폭스(FF)에 모두 사용가능한 방법을 적용하려면 아래와 같은 방법을 사용해야 됩니다.
<script language="javascript">
function Test()
{
alert (document.getElementById("test1").value);
alert (document.getElementsByName("test2")[0].value);
alert (document.getElementById("test3").options[document.getElementById("test3").selectedIndex].value);
}
</script>
<input type="text" id="test1" value="test1">
<input type="text" name="test2" value="test2">
<select id="test3">
<option value="A1">A1</option>
<option value="A2">A2</option>
<option value="A3">A3</option>
<option value="A4">A4</option>
<option value="A5">A5</option>
</select>
<input type="button" value="확인" onclick="Test();">
반응형
'홈페이지 제작 > JavaScript' 카테고리의 다른 글
자바스크립트를 이용하여 <BR> 자동 입력하기 (0) | 2011.07.20 |
---|---|
자바스크립트 Style 객체 모음 (0) | 2009.03.20 |
글자수를 바이트(Byte)로 계산하여 알려주는 소스 (0) | 2009.02.17 |
iframe의 세로크기(height)를 내용길이에 맞게 자동설정하기 (0) | 2009.02.03 |
마우스 오버시 레이어 팝업으로 설명글 보여주기 (0) | 2008.09.22 |