0
這僅僅是一個部分代碼:如何更改IMG與文本的innerHTML
<div id="login">
<form id="form" method="post" action="<?php echo htmlspecialchars($_SERVER['PHP_SELF']) ?>">
<h1 id="heade">Register!</h1>
<input type="text" id="username" name="username" placeholder="username (6-55char)" class="reqi">
<input type="password" id="password" name="password" placeholder="password (6-55char)" class="reqi">
<input type="password" id="passwordconfirmation" name="passwordconfirmation" placeholder="confirm password" class="reqi">
<input type="text" id="email" name="email" placeholder="e-mail adress" class="reqi">
<p id="req">Enter the Captcha code:</p>
<h1 id="captcha"><img src="http://i.imgur.com/QgoRq4h.gif" alt="loading"></h1>
<input type="text" id="code" name="code"><br>
<div id="buttons">
<input type="submit" id="submit">
<button type="button" onclick="login()">Back to Log In</button>
</div>
<p><?php echo $txt; ?></p>
</form>
</div>
<script>
var captcha =<?php echo $_SESSION['final']; ?>;
setTimeout(function() {
document.getElementById("captcha").innerHTML = captcha;
}, 3000);
function login() {
window.location = "main.php";
}
</script>
等待3秒鐘,頁面不將圖像從'ID =「驗證碼的H1變更後「與可變的驗證碼,它不是空的(我檢查)。我需要一個JavaScript解決方案,因爲我還不知道jQuery。先謝謝你!