显示隐藏表单,或打开模式对话框

发布于 2024-12-12 01:24:16 字数 317 浏览 3 评论 0原文

在 HTML 页面中显示简单表单(其中包含调用 Web 方法的保存按钮)的最佳方法是什么?我正在考虑以下选项之一:

  1. 切换隐藏的
    ,其中包含与所示 .aspx 具有相同行为的表单
  2. 显示 模态对话框,使用 JavaScript 加载单独的 .aspx 来显示表单。

哪个更好,在什么情况下更好?

What is the best method to show a simple form in a HTML page, which includes a save button that calls a web method? I'm considering one of these options:

  1. Toggle a hidden <div> which includes a form with the same behaviour of the shown .aspx
  2. Display a modal dialog using JavaScript that loads a separate .aspx to show the form.

Which is better, and under which circumstances?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七秒鱼° 2024-12-19 01:24:16

如果弹出内容相对较小,那么最好将其包含在主页的隐藏 div 中。当您想要显示它时,这将为您提供即时性能。不这样做的原因是:

  1. 弹出内容很大,因此会显着减慢主页的加载速度。
  2. 您可能会使用许多不同的弹出窗口,因此将它们全部预加载到主页中会显着减慢主页的加载速度。
  3. 您在许多不同的页面中使用相同的弹出窗口,但它实际上并不经常弹出,因此更容易共享通用代码,并通过仅根据需要加载来减少总体带宽消耗。

If the popup content is relatively small, then it will be best to just include it right in your main page in a hidden div. This will give you instant performance when you want to display it. The reasons not to do it this way are:

  1. The popup content is large and thus would slow down the loading of the main page measurably.
  2. There are lots of different popups that you may use so preloading them all with the main page would slow down the loading of the main page measurably.
  3. You use the same popup in lots of different pages and it's not actually popped up very often so it's easier to share common code and reduce overall bandwidth consumption by loading it only upon demand.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文