대문: 두 판 사이의 차이
보이기
편집 요약 없음 |
편집 요약 없음 |
||
| 1번째 줄: | 1번째 줄: | ||
<html> | <html> | ||
<form id=" | <form id="radioSearch" action="/wiki/index.php/Special:Search" method="get"> | ||
<div> | |||
<label><input type="radio" name="scope" value="all" checked> 전체</label> | <!-- 검색 범위 선택 --> | ||
<label><input type="radio" name="scope" value="site"> 유적</label> | <div style="margin-bottom:6px;"> | ||
<label><input type="radio" name="scope" value="concept"> 개념</label> | <label> | ||
<input type="radio" name="scope" value="all" checked> | |||
전체 | |||
</label> | |||
<label style="margin-left:12px;"> | |||
<input type="radio" name="scope" value="site"> | |||
유적 | |||
</label> | |||
<label style="margin-left:12px;"> | |||
<input type="radio" name="scope" value="concept"> | |||
개념 | |||
</label> | |||
</div> | </div> | ||
<input type="search" name="search" id=" | <!-- 검색어 입력 --> | ||
<input | |||
type="search" | |||
name="search" | |||
id="query" | |||
placeholder="검색어 입력" | |||
style="width:360px; padding:6px;" | |||
/> | |||
<button type="submit">검색</button> | |||
</form> | </form> | ||
<script> | <script> | ||
document.getElementById('radioSearch').onsubmit = function () { | |||
const q = document.getElementById(' | const q = document.getElementById('query'); | ||
const scope = document.querySelector('input[name="scope"]:checked').value; | const scope = document.querySelector('input[name="scope"]:checked').value; | ||
if (scope === 'site') { | |||
if (scope === 'site') | q.value += ' incategory:유적'; | ||
if (scope === 'concept') | } else if (scope === 'concept') { | ||
q.value += ' incategory:개념'; | |||
} | |||
}; | |||
} | |||
</script> | </script> | ||
</html> | </html> | ||


