location.search
으로 쿼리 문자열에 액세스 할 수 있습니다. 그럼 당신이 직접 양식의 작업에 다음과 같은 무언가를 추가 할 수 있어야한다 : 그건 그렇고
// Get a reference to the form however, such as document.getElementById
var form = ...;
// Get the query string, stripping off the question mark (not strictly necessary
// as it gets added back on below but makes manipulation much easier)
var query = location.search.substring(1);
// Highly recommended that you validate parameters for sanity before blindly appending
// Now append them
var existingAction = form.getAttribute("action");
form.setAttribute("action", existingAction + '?' + query);
를, 내가 직접 양식의 작업의 쿼리 문자열을 수정하면 될 수 있다는 것을 발견했습니다 히트 앤 miss - 나는 특히 당신이 결과를 게시한다면 IE는 어떤 쿼리를 없애 버릴 것이라고 생각한다. (이것은 얼마 전이었고 정확히 을 기억할 수는 없지만 좋은 아이디어는 아닙니다.).
따라서 은 숨겨진 입력 인 <form>
의 하위 요소를 동적으로 생성하여 쿼리에서 원하는 이름 - 값 쌍을 인코딩하려는 경우이 작업을 수행하려고합니다.
는 http://stackoverflow.com/questions/827368/use-the-get-paramater-of-the-url-in-javascript를 참조 – Sampson
나는이 폐쇄해야한다고 생각하지 않습니다. 연결된 질문에서 쿼리 문자열을 가져 오는 방법을 보여 주지만 '