2013-11-22 3 views
-1

http://oxidepkz.net63.net/vote.php 전체 php 파일의 모습입니다. 그래서 mysql 데이터베이스에 들어가기로 한 사용자 이름이 있습니다. 사용자 이름은 텍스트 상자입니다, 내가 필요한 모든 URL을 사용자가 실제 PHP 페이지가 아니라 버튼 클릭에서 생각합니다. 코드가 changeAction 기능을 수행 할 때URL에 사용자 이름을 넣지 않는 JavaScript

내가 보는 것과
<script> 
function next() { 
if(document.vote.username.value.length == 0) { 
    alert("The username field cannot be left empty."); 
} else if(document.vote.username.value.length > 30) { 
    alert("You've reached the maximum amount of characters."); 
} else { 
    document.vote.username.disabled = true; 
    document.getElementById('button').style.display = "block"; 
    document.getElementById('nextbutton').style.display = "none"; 
} 
} 
function changeAction(url) { 
if(url.indexOf("rspscoding.org") != -1) { 
    var username = document.vote.username.value; 
    document.vote.action = ""+url+"&username="+username+""; 
} else { 
    document.vote.action = url; 
} 
    } 
</script> 
<title>Vote</title> 
</head> 
<body> 
<center><br> 
<br><br> 
<div class="vote"><br><br> 
<form name="vote" class="short style" method="post" target="_blank"> 
    <input name="username" type="text" size="30" maxlength="30"   placeholder="Username"><button id="nextbutton" type="button"  onClick="next();">Next</button> 
    <div style="display: none;" id="button" class="button"><button type="submit" onClick="changeAction('http://www.rune-server.org/toplist.php?do=vote&sid=8289&name=');")>Rune-Server</button><button type="submit" onClick="changeAction('http://www.runelocus.com/toplist/index.php?action=vote&id=30838&id2=');")>RuneLocus</button></div> 
</form><br> 
+0

"http://oxidepkz.net63.net/vote.php"로 이동하십시오. –

+0

도움이되지 않는 내용에 대해서는 의견을 말하지 마십시오. 전체 투표 페이지를 보려면 해당 링크를 클릭하고 "아니오"를 클릭하십시오. . " – Oxide

+0

귀하의 문제에 대한 코드에 액세스하려면 임의의/스케치 사이트를 방문하는 사람들에게 알리지 마십시오. 관련성이있는 경우 여기에 게시하십시오. –

답변

0

는,이 URL에 rspscoding.org를 확인 : 다음은 스크립트 코드의 조각이다. 그러나 두 단추로 전달하는 URL에는 rspscoding.org에 대한 참조가 없습니다. 따라서 else 문이 실행 중이며 사용자 이름을 전달하지 않아 문제가 발생합니다.
if 문을 제거하거나 URL 위치 검사기를 다른 URL로 변경해보십시오. 그것이 작동하지 않는다면, 나는 무엇이 될지 모른다. 행운을 빕니다!

+0

전체 if 문을 꺼내십시오. – Oxide

+0

특별한 이유로 if 문을 사용하지 않는 한 그렇게 생각할 것입니다. 그렇다면 rspscoding.org를 실제로 함수에 전달 된 URL에있는 다른 URL로 변경하십시오. 그렇지 않으면 예, if 문 전체를 제거하고 if 블록 안에 코드 만 넣으면됩니다. – Atutouato

+0

당신은 페이지가있는 URL을 의미합니까 ?? 또는 클릭 버튼이 URL을 지시하면? – Oxide

관련 문제