アップデート:
答えはここにあります:
================================================== ====
画面の中央にあるポップアップにフォームを送信しようとしています。グーグルで見つけたいくつかのjsスニペットを「フランケンシュタイン」しました。
私は html/css は理解できますが、javascript は理解できません。
<html>
<head>
<script type="text/javascript">
function directions(sacred) {
var x = screen.width / 2 - 700 / 2;
var y = screen.height / 2 - 450 / 2;
window.open(sacred.action, 'Directions', 'height=485,width=700,left=' + x + ',top=' + y);
}
</script>
</head>
<body>
<form action="http://maps.google.com/maps" method="get" target="Directions"
onsubmit="Directions=directions(sacred)">
<p>
<input class="directions-input" id="saddr" name="saddr" type="text" placeholder="enter zip-code"
value="enter zip-code" onfocus="this.value = this.value=='enter zip-code'?'':this.value;"
onblur="this.value = this.value==''?'enter zip-code':this.value;" />
<input type="submit" class="directions-submit" />
<input type="hidden" name="daddr" value="210+East+Northampton+Street,+Bath,+PA"
/>
<input type="hidden" name="hl" value="en" />
</p>
</form>
</body>
</html>
フォームは新しいタブに送信され、関数または window.open は実行されません。
事前に誰にでも感謝します。
PS私はちょうどこのスタックオーバーフローのコツをつかんでいます。