0
자바 스크립트 코드를 진행하지 마십시오 :빈 자바 스크립트 오류 메시지가 표시 필드와
function notEmpty(elem, helperMsg)
{
if(elem.value.length == 0)
{
alert(helperMsg);
elem.focus();
return false;
}
return true;
}
HTML :
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" />
<input type="hidden" name="on0" value="Name :" />Name :
<input type="text" id="req1" name="os0" maxlength="200" style="width:150px;"/>
<input type="submit" id="buynow" value="Proceed To Checkout" onclick="notEmpty(document.getElementById('req1'), 'Please Enter a Value')" style="width:150px; margin:15px 0px 17px 0px;" />
</form>
위
내 코드입니다. 을 클릭하면 필드가 비어 있으면 원하는대로 오류가 발생하지만 경고 대화 상자에서 확인 버튼을 클릭하면 양식의 동작으로 리디렉션됩니다.누군가가 기입하지 않으면 동일한 위치에 머물러 있기를 원합니다. 제발 도와주세요!