[Show all top banners]

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 11918 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 60 days
Recommended Popular Threads Controvertial Threads
What are your first memories of when Nepal Television Began?
निगुरो थाहा छ ??
Basnet or Basnyat ??
Sajha has turned into MAGATs nest
TPS Re-registration case still pending ..
मन भित्र को पत्रै पत्र!
काेराेना सङ्क्रमणबाट बच्न Immunity बढाउन के के खाने ?How to increase immunity against COVID - 19?
TPS Work Permit/How long your took?
Breathe in. Breathe out.
Guess how many vaccines a one year old baby is given
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
चितवनको होस्टलमा १३ वर्षीया शालिन पोखरेल झुण्डिएको अवस्था - बलात्कार पछि हत्याको शंका - होस्टेलहरु असुरक्षित
शीर्षक जे पनि हुन सक्छ।
Travelling to Nepal - TPS AP- PASSPORT
Nepali doctors future black or white usa ?
Doctors dying suddenly or unexpectedly since the rollout of COVID-19 vaccines
Morning dharahara
Another Song Playing In My Mind
TPS Renewal Reregistration
nrn citizenship
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