Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9046077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T11:32:55+00:00 2026-06-16T11:32:55+00:00

i have a javascript prompt like the following and i would like to bring

  • 0

i have a javascript prompt like the following and i would like to bring the prompt center of the screen. How to do this in using javascript?

function showUpdate() {     
    var x;    
    var name=prompt("Please enter your name","");

    if ( name != null ) {
      x="Hello " + name + "! How are you today?";
      alert("Input : " + name );          
    }

}

And this is how i call this :

<a onclick = "showUpdate() " style="vertical-align: middle;" class="parent" href=""><span>5. Missed P/U Comments</span></a>

it works find excepts the prompt goes to the left corner in IE and center in Firefox
but i need to the same solution to work in both the browsers.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T11:32:57+00:00Added an answer on June 16, 2026 at 11:32 am

    The prompt (and alert) popups are implemented differently depending on the browser you’re using. This is because the popups are browser functionalities, they aren’t JavaScript objects or anything like that. (Just like the console is different for each browser, it depends on the implementation.)

    If you really want your prompts to be positioned / styled consistently, you’re going to have to build your own prompt.

    The easy way out would be to use a library like jQueryUI.

    On the other hand, you can just build it yourself:

    document.getElementById('showPromptButton').addEventListener('click', showSprompt);
    document.getElementById('promptButton').addEventListener('click', submitPrompt);
    var prompt = document.getElementById('myPrompt');
    var promptAnswer = document.getElementById('promptAnswer');
    
    function showSprompt() {
        promptAnswer.value = ''; // Reset the prompt's answer
        document.getElementById('promptQuestion').innerText = "What's your question?"; // set the prompt's question
        prompt.style.display = 'block'; // Show the prompt
    }
    
    function submitPrompt() {
        var answer = promptAnswer.value; // Get the answer
        prompt.style.display = 'none';   // Hide the prompt
        console.log(answer);
    }
    #myPrompt{
      display:none;
      /* Style your prompt here. */
    }
    <input id="showPromptButton" type="button" value="Show Prompt" />
    <div id="myPrompt" class="proptDiv">
      <span id="promptQuestion"></span>
      <input id="promptAnswer" type="text" />
      <input id="promptButton" type="button" value="Submit" />
    </div>
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a paragraph, which I would like to edit using javascript prompt function.
When we use Javascript prompt Box something like this var ur_name = prompt(Enter Name);
i have javascript jquery that looks like this: var userInput = prompt(Liquid Handler #:,
I have javascript code some thing like this -- var count=3; var pl=new Array(count);
I would like to have a javascript prompt pop up that has a selection
I'm interested in using a JavaScript Prompt to have the user enter data. Any
I have Javascript function defined in the main index.html file. One part of this
I have JavaScript form validation functions like so: function validate_name(field) { if (field ==
im trying to achieve the following, in php i have a form like this:
I have a VB.NET function which looks like this: <WebMethod()> _ Public Shared Function

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.