Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Simple Modal Dialog

Simple Modal Dialog

Scheduled Pinned Locked Moved JavaScript
javahtmlsalestools
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    Bram van Kampen
    wrote on last edited by
    #1

    Hi, I need a Modal Dialog for a customer to submit their account code and password. I have put the following Java Script together:-

    <!--
    function LoginToAccount() {
    window.open("LogIn/LoginForm.html", "","width=350,height=150")
    }
    //-->

    It works of sorts, the form appears on the screen, but:- - it appears at the Top Left Corner rather than Centre Screen - It contains the Source Bar, and all the windows furniture. - The Dialog is not Modal. Is there a way to remedie this, or am I totally on the wrong path. Kind Regards, :):)

    Bram van Kampen

    Richard DeemingR 1 Reply Last reply
    0
    • B Bram van Kampen

      Hi, I need a Modal Dialog for a customer to submit their account code and password. I have put the following Java Script together:-

      <!--
      function LoginToAccount() {
      window.open("LogIn/LoginForm.html", "","width=350,height=150")
      }
      //-->

      It works of sorts, the form appears on the screen, but:- - it appears at the Top Left Corner rather than Centre Screen - It contains the Source Bar, and all the windows furniture. - The Dialog is not Modal. Is there a way to remedie this, or am I totally on the wrong path. Kind Regards, :):)

      Bram van Kampen

      Richard DeemingR Offline
      Richard DeemingR Offline
      Richard Deeming
      wrote on last edited by
      #2

      There used to be a showModalDialog method that would work for this, but it's no longer supported in anything other than Internet Explorer and Safari:

      Window.showModalDialog() - Web APIs | MDN[^]:

      This method was removed in Chrome 43, and Firefox 56.

      There's the <dialog> element, which is meant to be the replacement for this method. But it's not supported in IE, Edge, or Safari, and needs to be explicitly enabled in Firefox. There's a polyfill available, but I can't see any obvious mention of which browsers it supports. <dialog>: The Dialog element - HTML: HyperText Markup Language | MDN[^] GitHub - GoogleChrome/dialog-polyfill: Polyfill for the HTML dialog element[^] There are other script options available - for example, Bootstrap's Modal[^] or jQuery UI's Dialog[^].


      "These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer

      "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups