안녕하세요. 나는 JS에 상당히 익숙하다. (배경은 C++, 어셈블리 언어와 COBOL, 그리고 가벼운 .NET과 같은 엔터프라이즈 언어이다.) 그래서 두 개의 텍스트 상자 중 하나에서 변수 정보를 보내는 방법에 관한 조언을 얻을 수 있는지 궁금하다. 몇 가지 자바 스크립트를 누른 다음 JS는 몇 가지 기본적인 검사 등. 여기에 내가하려고하는 것에 대한 의사 코드가 있습니다 :두 텍스트 상자 중 하나에서 변수 데이터를 자바 스크립트로 보냅니다.
<form = webForm>
<p>
_____________
textboxPeople| searchIcon //a text box to search an online phonebook at my company.
------------- //It has a little "magnifying glass" icon to search
//(onClick), but I would also like them to be able to
//search by hitting the "enter" key on their keyboards.
</p>
<p>
_____________
texboxIntranet| searchIcon //Same as above search textbox, but this one is used if
------------- //the user wishes to search my corporate intranet site.
</form>
그래서 내가 사용하고자하는 앞면 기본형이 끝납니다. 이제 onClick 또는 onEnter를 사용하여 양식에서 사용 된 텍스트 상자의 내용과 "People"또는 "Intranet"과 같은 식별자를 사용하여 백엔드의 일부 기본 JS에 사용되는 상자에 따라 :
begin JavaScript:
if(identifier = 'People')
fire peopleSearch();
else
if(identifier = 'Intranet')
fire intranetSearch();
function peopleSearch()
{
http://phonebook.corporate.com/query=submittedValue //This will take the person
//that the user submitted in the form and
//place it at the end of a URL, after which
//it will open said complete URL in the
//same window.
}
function intranetSearch()
{
http://intranet.corporate.com/query=submittedValue //This will function in the
//same way as the people search function.
}
end JavaScript
어떤 생각이나 제안이라도 대단히 감사하겠습니다. 미리 감사드립니다.
* 백엔드 *의 자바 스크립트? 서버 에서처럼? 어떤 프레임 워크를 사용하고 있습니까? 불가능하지는 않지만 특이합니다. – Pointy