图像 onclick() 函数显示带有表单详细信息的 dailog 窗口

image onclick() function to display dailog window with form details

本文关键字:详细信息 表单 dailog 窗口 onclick 函数 显示 图像      更新时间:2023-09-26

Hers是我为功能编写的代码,当单击图像时,dailog窗口应该加载表单输入元素。请查看下面的代码,让我知道我哪里出错了。

法典:-

            <dialog id="login" style="border-color: blue; border: 1px solid">
                <form name="reg">
                First Name : <input type="text" name="fname" required>
                Last Name: <input type="text" name="lname" required>
                Email <input type="email" name="mail" required>
                Password: <input type="password" name="pass" required>
                Confirm Password : <input type="password" name="confpass" required>
                <button type="submit"></button>
                <button type="reset"></button>
                </form>
            </dialog>
        <script>
            function registration(){
                var dailog = document.getElementById('login');
                dailog.open();
            }
        </script>

根据MDN的说法,有.show().showModal()的方法 - 没有.open()方法。

更改

dailog.open();

dailog.open = true;

显示

是属性,而不是函数