테스트 사이트 - 개발 중인 베타 버전입니다

폼 태그 관련(고정주소+입력한값 으로 페이지 이동) 채택완료

HunyStyle 3년 전 조회 2,599

 

 

 

인풋창

 

 

결과창

(name=main)

프레임셋으로 나눠서

 

폼 태그로요,

인풋에 예를 들어 333 이라고 입력하고 서브밋하면

abc.com/333 이라는 페이지가 

 

인풋에 예를 들어 555 이라고 입력하고 서브밋하면

abc.com/555 이라는 페이지가 

 

오른쪽 프레임에 뜨게 하고싶거든요~

 

abc.com 이라는도메인은 고정시키고, 도메인+입력한값으로 페이지 이동 시키고 싶어요~

 

</p>

<p><base target="main"></p>

<p><form action="<a href="https://abc.com/"" target="_blank" rel="noopener noreferrer">https://abc.com/"</a> method="get">

  <input type="text" name="name">

  <input type="submit" id="enter" value="GO">

</form></p>

<p>

 

이렇게 하는게 맞나요??? 

 

 

 

 

 

 

댓글을 작성하려면 로그인이 필요합니다.

답변 1개

채택된 답변
+20 포인트
3년 전
<form action="https://abc.com/" method="get" target="main">

 

이요~

로그인 후 평가할 수 있습니다

답변에 대한 댓글 3개

H
HunyStyle
3년 전
우선 답변 감사드립니다 ^^

저렇게 하고

<form action="https://abc.com" method="get" target="body">
<input type="text" name="name" style="width: 100px;"><br>
<input type="submit" value="GO" style="width: 100px;">
</form>

aaa라는 값을 입력후, 버튼클릭하면
https://abc.com/aaa 페이지가 떠야하는데, https://abc.com/ 만 뜨네요 ㅜ
어디가 잘못된걸까요? ㅎㅎ
폭주죽
3년 전
https://abc.com?name=aaa
라고 뜨는게 정상인데 abc.com 에서 get 파라미터로 url 변경해주는 처리가 되어있어야
원하시는 결과가 나올거같아요 ㅎㅎ
H
HunyStyle
3년 전
eyekiss 님께서 알려주셨어요 ^^

답변 감사합니다~~ ^^



https://sir.kr/qa/446459

[code]
<form name="goform" action="https://abc.com" method="get" target="body" onsubmit="form_submit()">
<input type="text" name="name" style="width: 100px;"><br>
<input type="submit" value="GO" style="width: 100px;">
</form>
function form_submit() {
document.goform.action = "https://abc.com/"+document.goform.name.value;
document.goform.submit();
}
[/code]

댓글을 작성하려면 로그인이 필요합니다.

답변을 작성하려면 로그인이 필요합니다.

로그인