0

正直なところ、JavaScriptはまったく知りません。私は他の人を見て物事を理解することで得てきましたが、今回はそうではありません!送信を中心にフォームの1つをポップアップ表示したいと思います。これまでにフォームデータをポップアップして保持するようになりましたが、中央に配置できないようです。これがImが使用しているコードの一部です:

また、誰かがこれを私に説明できれば、それは素晴らしいことです。私のフォームアクションは、document.getElementByID('Name")。vauleと電子メールなどで少しおかしなように見えますが、フォームフィールドIDはアクションと一致しませんが、それでも機能します。その1つまたは理由についての手がかりはありません。実際にはまだ機能します。実行中のフォームについては、http://www.computerbytez.com/develop.htmlを参照してください。

形:

<form action="https://computerbytez.com/InstantChat/Standard/logmein.html?Name=' + document.getElementById('Name').value + '&amp;Email=' + document.getElementById('Name').value, '', 'toolbar=no, status=no, menubar=no, titlebar=no, location=no, scrollbars=no, resizable=no, height=500, width=400'" id="lmiform">
            <div class="form-field">
        <label class="cm-required   " for="elm_7">Name</label> <input class="input-text" id="elm_7" name="name" size="50" style="width: 100%; max-width: 372px;" type="text"/></div>
<div class="buttons-container">
        <span class="button-submit button-wrap-left"><span class="button-submit button-wrap-right"><input type="submit" value="Connect To Technician" /></span></span></div>

フォームJavaScript:

$(document).ready(function() {
    $('#lmiform').submit(function() {
 window.open('', 'formpopup', 'width=620,height=480,scrollbars=no,resizable=no,top=200,left=200');
        this.target = 'formpopup';
    });
});

私もこれ(リンクのポップアップセンター)をいじっていて、運が悪かったので2つを組み合わせようとしていました:

<script>
function PopupCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
} 
</script>

<a href="javascript:void(0);" onclick="PopupCenter('example.html', 'myPop1',620,470);"><img alt="" class="LMIpic" src="live_help_online.gif" /> </a>

どんな助けでも大歓迎です。ありがとう

4

1 に答える 1

4

あなたのサイトにアクセスしましたが、画像をクリックするとポップアップが中央に表示され、問題なく表示されます。コードは正常に見えます。ブラウザのキャッシュをクリアしてみてください。

編集:

    $(document).ready(function() {
        $('#lmiform').submit(function() {
            var left = (screen.width/2)-(620/2);
            var top = (screen.height/2)-(480/2);
            window.open('', 'formpopup', 'width=620,height=480,scrollbars=no,resizable=no,top='+top+',left='+left);
            this.target = 'formpopup';
        });
    });
于 2012-11-13T06:15:49.513 に答える