다음 소스가 작동안되는 원인은 무엇일까요? > 그누4 질문답변

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

다음 소스가 작동안되는 원인은 무엇일까요? 정보

다음 소스가 작동안되는 원인은 무엇일까요?

본문

제가 프로그램 짤때 자주 쓰는 방식인데 이게 작동이 안되네요 ㅡㅡ;;
원인이 무엇일까요??


<div id="nodata">
  <div id="message" style="width:500px;height:300px;"><?//자바스크립트 처리를 위하여 크기는 따로 스타일로 지정?>
    <h3>일부 환경변수를 정상적으로 전달받지 못했습니다.</h3><hr><p>
    
    <form action="./openid_confirm_ok.php" name="openid_confirm_ok" method="post">
    <font color="#ffffff">
    이름: <input type="text" name="name" value="<?=$member[mb_name]?>" <?if($member[mb_name]){echo "readonly  style='background-color:#cccccc;'";}?>><br>
    별명: <input type="text" name="nick" value="<?=$member[mb_nick]?>" <?if($member[mb_nick]){echo "readonly  style='background-color:#cccccc;'";}?>><span id='msg_mb_nick'></span> <br>
    이메일: <input type="text" name="email" value="<?=$member[mb_email]?>" <?if($member[mb_email]){echo "readonly  style='background-color:#cccccc;'";}?>>&nbsp;&nbsp;&nbsp;
    </font>
    <p><hr>
    입력 받은 데이터는 활동을 위한 최소한의 데이터입니다.<p>
    <button style="width:100px" onclick="return check();">확인</button>
    <button style="width:100px" onclick="location.href = '<?=$g4[path]?>/bbs/logout.php';">취소</button>
    </form>
    
    <div style="widht:100%;text-align:right;"><br><a href="http://sir.co.kr" target="_blank">SIR</a> OpenID Project Group.&nbsp;&nbsp;</div><?//변경가능.?>
  </div>
</div>

<script type="text/javascript">
// 공란 체크
function check(){
    if(document.getElementById('name').value == "")
    {
      alert('이름을 입력하여 주세요.');
      document.getElementById('name').focus();
      return false;
      }
    if(document.getElementById('nick').value == "")
    {
      alert('별명을 입력하여 주세요.');
      document.getElementById('nick').focus();
      return false;
      }
    if(document.getElementById('email').value == "")
    {
      alert('이메일을 입력하여 주세요.');
      document.getElementById('email').focus();
      return false;
      }
      
    return;
}
</script>

댓글 전체

document.getElementById => document.getElementByName
엘러먼트 속성지정문제 같군요
getElementById 는 id를 getElementByName 은 name 을 참조
<input type="text" name="email <=<input type="text" id="email
id명 name명 대소문자 구분합니다.
자바스크립트내에서 openid_confirm_ok.submit 하셔야지요..
먼저 내용검사후 리턴만하고 그 다음 온크릭은 실행하지 않습니다.
<button style="width:100px" onclick="location.href = '<?=$g4[path]?>/bbs/logout.php';">취소</button>
이것도 아니군요...
원인 파악 됬습니다..
버튼에서는 서버미트 속성이 없어서 안되는것이였습니다.
    <form action="./openid_confirm_ok.php" method="post">
    <font color="#ffffff">
    이름: <input type="text" name="name" value="<?=$member[mb_name]?>" <?if($member[mb_name]){echo "readonly  style='background-color:#cccccc;'";}?>><br>
    별명: <input type="text" name="nick" value="<?=$member[mb_nick]?>" <?if($member[mb_nick]){echo "readonly  style='background-color:#cccccc;'";}?>><span id='msg_mb_nick'></span> <br>
    이메일: <input type="text" name="email" value="<?=$member[mb_email]?>" <?if($member[mb_email]){echo "readonly  style='background-color:#cccccc;'";}?>>&nbsp;&nbsp;&nbsp;
    </font>
    <p><hr>
    입력 받은 데이터는 활동을 위한 최소한의 데이터입니다.<p>
    <input type="submit" style="width:100px" onclick="return check();" value="확인">
    <button style="width:100px" onclick="location.href = '<?=$g4[path]?>/bbs/logout.php';">취소</button>
    </form>
   
    <div style="widht:100%;text-align:right;"><br><a href="http://sir.co.kr" target="_blank">SIR</a> OpenID Project Group.&nbsp;&nbsp;</div><?//변경가능.?>
  </div>
</div>

<script type="text/javascript">
// 공란 체크
function check(){
    if(document.getElementById('name').value == "")
    {
      alert('이름을 입력하여 주세요.');
      document.getElementById('name').focus();
      return false;
      }
    if(document.getElementById('nick').value == "")
    {
      alert('별명을 입력하여 주세요.');
      document.getElementById('nick').focus();
      return false;
      }
    if(document.getElementById('email').value == "")
    {
      alert('이메일을 입력하여 주세요.');
      document.getElementById('email').focus();
      return false;
      }
}
</script>
처럼 수정하니 정상작동을 확인 했습니다.
전체 66,554 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1402호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT