내 계획은 link.html 페이지 (exp : radio.html의 옵션 2 확인)에서버튼을 클릭하면 radio.html 페이지로 이동하여 옵션을 선택합니다 2 라디오.
radio.html 페이지의 버튼을 클릭하여 라디오를 확인할 수 있습니다.
그러나 link.html의 버튼을 클릭하면 radio.html 페이지를 열 때 라디오를 확인할 수 없습니다.
라디오를 확인하려면 windows.open
이라는 아이디어를 얻은 다음 window.onload
& document.getElementById
을 사용하여 라디오를 확인하십시오.
하지만 실패했습니다. 내 생각이 틀린거야?
도와주세요, TQVM.입력 유형 라디오가 작동하지 않는 경우 새 창에서 확인 됨
<html>
<body>
<input type="radio" name="option" id="opt1"> \t \t
<label for="opt1">Option 1</label> \t
<input type="radio" name="option" id="opt2"> \t \t \t \t
<label for="opt1">Option 2</label>
<input type="radio" name="option" id="opt3"> \t \t \t \t
<label for="opt1">Option 3</label>
<input type="radio" name="option" id="opt4"> \t \t \t \t
<label for="opt1">Option 4</label>
<br>
<br>
<button onclick="check1()">Check Option 1</button>
<br>
<button onclick="check2()">Check Option 2</button>
<br>
<button onclick="check3()">Check Option 3</button>
<br>
<button onclick="check4()">Check Option 4</button>
<br>
<script>
function check1() {
document.getElementById("opt1").checked = true;
}
function check2() {
document.getElementById("opt2").checked = true;
}
function check3() {
document.getElementById("opt3").checked = true;
}
function check4() {
document.getElementById("opt4").checked = true;
}
</script>
</body>
</html>
가 link.html 코드 : 여기
는 radio.html 코드
<html>
<body>
<button onclick="opencheck2()">Check Option 2 in radio.html</button>
<br>
<button onclick="opencheck3()">Check Option 3 in radio.html</button>
<br>
<script>
function opencheck2() {
\t var mywindow = window.open("radio.html","_self");
\t mywindow.onload = function(){
\t \t document.getElementById("opt2").checked = true; \t \t \t
\t }
}
function opencheck3() {
\t var mywindow = window.open("radio.html","_self");
\t mywindow.onload = function(){
\t \t document.getElementById("opt3").checked = true; \t \t \t
\t }
}
</script>
</body>
</html>
당신이'mywindow.document.getElementById'를 사용하여 시도 유무 : 버튼이 지금 가진 여러 기능보다는 쳤다 할 수있는 체크 박스를 나타내는 숫자를 통과 어디도 하나 개의 함수로 감소했습니다? 나는 단지 문서가 현재 윈도우의 문서를 참조한다고 말합니다. – BenShelton
나는 이미'mywindow.document.getElementById ("opt3")를 넣어 보았습니다. checked = true; \t''mywindow.onload = function()'에 있지만 여전히 얻을 수는 없습니다. – Chong