私がやろうとしていること
を使用し<form>
て住所を調査し、最終的に Google マップに表示しています。
ユーザーによる最初の入力の後、search.php
住所パラメーターが構成要素 (つまり、郵便番号、市区町村) に分けられているページを参照します<input type="text" readonly>
。住所が表示されるGoogleマップもあり、表示された住所が正しいかどうかをユーザーに尋ねます。Yes
またはのいずれかを選択できNo
ます。
アドレスが間違っていると判断された場合は、No
ボタンをクリックして、さまざまな<input type="text">
変更を可能にします (属性を削除しreadonly
ます)。
をクリックするとNo
、と ボタンを<div>
介して送信ボタンを含む にアクセスし、単一の新しいボタンに変換されます。document.getElementById.innerHTML
Yes
No
<input type="submit" value="Look it up">
私の問題!
この新しいLook it up
ボタンは送信ボタンとして機能しません!! クリックしても何も起こりません。
助けてください?
コード:
私のリセット機能:
function reset_search() {
document.getElementById('number').removeAttribute("readonly");
document.getElementById('street').removeAttribute("readonly");
document.getElementById('apt').removeAttribute("readonly");
document.getElementById('postal').removeAttribute("readonly");
document.getElementById('city').removeAttribute("readonly");
document.getElementById('lookup').setAttribute('action', './search.php');
var new_submit = 'Please correct the mistakes above and click on the button below to launch another search<br><input type="submit" name="submit" value="Look it up">';
document.getElementById('submit_button').innerHTML=new_submit;
}
私のフォーム:
<form method="post" id="lookup" name="lookup" action="./display.php">
.........
<tr>
<td valign="top" align="center" colspan="4">
<div id="submit_button">
According to the map below, is the address correct?<br>
<input type="submit" value="Yes" /> <input type="button" value="No" onclick="reset_search()" />
</div>
</td>
</tr>
</form>