다음 소스가 작동안되는 원인은 무엇일까요? 정보
다음 소스가 작동안되는 원인은 무엇일까요?
본문
제가 프로그램 짤때 자주 쓰는 방식인데 이게 작동이 안되네요 ㅡㅡ;;
원인이 무엇일까요??
원인이 무엇일까요??
<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;'";}?>>
</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. </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명 대소문자 구분합니다.
엘러먼트 속성지정문제 같군요
getElementById 는 id를 getElementByName 은 name 을 참조
<input type="text" name="email <=<input type="text" id="email
id명 name명 대소문자 구분합니다.

그부분은 정상작동합니다.. ㅠ.ㅠ;
form action="./openid_confirm_ok.php"
이부분이 작동안되사 말이죠^^
form action="./openid_confirm_ok.php"
이부분이 작동안되사 말이죠^^
자바스크립트내에서 openid_confirm_ok.submit 하셔야지요..
먼저 내용검사후 리턴만하고 그 다음 온크릭은 실행하지 않습니다.
<button style="width:100px" onclick="location.href = '<?=$g4[path]?>/bbs/logout.php';">취소</button>
먼저 내용검사후 리턴만하고 그 다음 온크릭은 실행하지 않습니다.
<button style="width:100px" onclick="location.href = '<?=$g4[path]?>/bbs/logout.php';">취소</button>

해당부분이 문제는 아니지만 가장 먼저 답변을 주셨기에 체택해드리겠습니다.~
^ ^ 감사 getElementById , getElementByName 이 문제도 됩니다
작동은 하지만 여러 사양에 따라
작동은 하지만 여러 사양에 따라
//return;
openid_confirm_ok.submit();
}
</script>
openid_confirm_ok.submit();
}
</script>

이것도 아니군요...
원인 파악 됬습니다..
버튼에서는 서버미트 속성이 없어서 안되는것이였습니다.
<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;'";}?>>
</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. </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>
처럼 수정하니 정상작동을 확인 했습니다.
원인 파악 됬습니다..
버튼에서는 서버미트 속성이 없어서 안되는것이였습니다.
<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;'";}?>>
</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. </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>
처럼 수정하니 정상작동을 확인 했습니다.