with() 문 안에서 함수()와 함께 사용되는 나머지 웹 페이지에서 자바 스크립트 함수를 볼 수 있습니다. 나는 아래의 함수 코드를 참조 용으로 두었다.javascript 함수에서 with()의 목적
function calculate()
{
with (document.loan)
{
var loan = parseFloat(loan_amount.value);
//function implementation goes here
}
}
양식은 대출 이름이있는 페이지에서 이와 같이 정의됩니다.
<form name="loan" id="loan-form">
<input type="text" id="loan_amount"/>
// remaining form elements here
</form>
"with"구문은 무엇이며 어떤 범위입니까?
중복 가능성을 쓸 수 있습니다 (http://stackoverflow.com/questions/61552/is-there-legal-use-for-statement with javascript-with-statement) –
유용한 정보 : https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/with –
이 질문은 : http://stackoverflow.com/q/61552/1846192 및이 답변 : http://stackoverflow.com/a/18528 3/1846192는 귀하에게 관심을 가질 것입니다. –