Javascript/submit

解説 フォームsubmitイベント
sample1

名前(必須)

コメント(必須)

sample1Code
function s1Func(){
  var s1Flg = 0;
  if(document.s1Form.s1Input.value == ""){
    s1Flg = 1;
    document.getElementById('s1p01').style.display = "block";
  }else{
    document.getElementById('s1p01').style.display = "none";
  }
  if(document.s1Form.s1TextArea.value == ""){
    s1Flg = 1;
    document.getElementById('s1p02').style.display = "block";
  }else{
    document.getElementById('s1p02').style.display = "none";
  }
  if(s1Flg == 1){
    window.alert('必須項目は全て入力して下さい。');
    return false;
  }else{
    return true;
  }
}