marsal
Replies to this thread:

More by marsal
What people are reading
Subscribers
:: Subscribe
Back to: Kurakani General Refresh page to view new replies
 prompt method's alignment to center in javascript!
[VIEWED 12705 TIMES]
SAVE! for ease of future access.
Posted on 11-10-08 9:39 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

How is variable lastname and variable name is equal here??? ANy way i use window.prompt() and my prompt comes in the center of the page. But I will try with just promt now and see where it comes.
 
Posted on 11-10-08 11:00 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

window.prompt() would be the first answer for your query. I am not sure whether it is possible the only prompt() to bring in the center (probably this is not possible).

Otherwise why don't you go for fancy tooltip like divs to apear wherever you want and there you can have text box to enter the name? You can find some from google.



 
Posted on 11-11-08 8:01 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

Hey LD, I dont know too much of UI side but i'm not sure if window.prompt will do the trick, coz both prompt and window.prompt takes the same argument, i'm not even sure if they are different. You might have to use window.open and use html tags to generate something like prompt. window.open allows you align that window. May be something like this

<body>
<script type ="text/javascript">
 
 
  var prmpt=window.open("","test","height=100,width=400,left=150,top=80");
   prmpt.document.write("<body bgcolor=#CCCCCC>");
   prmpt.document.write("Please enter your name<br>");
   prmpt.document.write("<input type='text' id='lastName'>");
   prmpt.document.write("<input id='val' type=button value='Okay' onclick='opener.test()'>");
   prmpt.document.write("</body>");

  
  function test()
 {
  
   var lastnameField=prmpt.document.getElementById('lastName');
   alert("Last name is "+  lastnameField.value);
   prmpt.close();
  
  }
 
   </script>
</body>

This is the o/p, tested it on IE.

 

 

There could be better ideas from UI genious. This is all i could think of now.


 
Posted on 11-11-08 10:26 PM     Reply [Subscribe]
Login in to Rate this Post:     0       ?    
 

techGuy's idea is good one for the solution. Otherwise i am really not sure why the window.prompt() does not work in firefox. I had tested it in Firefox 3.0.

Otherwise once again techGuy's idea is good one if you can implement in your case.

 


Please Log in! to be able to reply! If you don't have a login, please register here.

YOU CAN ALSO



IN ORDER TO POST!




Within last 365 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
TPS Re-registration
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
ChatSansar.com Naya Nepal Chat
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
NRN card pros and cons?
Toilet paper or water?
TPS EAD auto extended to June 2025 or just TPS?
Biden out, Trump next president, so what’s gonna happen to TPS, termination?
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
मन भित्र को पत्रै पत्र!
Will MAGA really start shooting people?
Democrats are so sure Trump will win
I hope all the fake Nepali refugee get deported
From Trump “I will revoke TPS, and deport them back to their country.”
Tourist Visa - Seeking Suggestions and Guidance
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
Top 10 Anti-vaxxers Who Got Owned by COVID
Nas and The Bokas: Coming to a Night Club near you
NOTE: The opinions here represent the opinions of the individual posters, and not of Sajha.com. It is not possible for sajha.com to monitor all the postings, since sajha.com merely seeks to provide a cyber location for discussing ideas and concerns related to Nepal and the Nepalis. Please send an email to admin@sajha.com using a valid email address if you want any posting to be considered for deletion. Your request will be handled on a one to one basis. Sajha.com is a service please don't abuse it. - Thanks.

Sajha.com Privacy Policy

Like us in Facebook!

↑ Back to Top
free counters