很多時候,我們需要在javascript腳本里面對form表單的屬性進行設值。例如:
document.getElementByid('form').action = 'target.jsp';
document.getElementByid('form').method = 'post';
document.getElementByid('form').submit();
上面的情況我們可以這樣寫:
with(document.getElementByid('form')){
action = 'target.jsp';
method='post';
submit();
}