[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 11953 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 200 days
Recommended Popular Threads Controvertial Threads
शीर्षक जे पनि हुन सक्छ।
NRN card pros and cons?
What are your first memories of when Nepal Television Began?
TPS Re-registration
TPS Re-registration case still pending ..
Democrats are so sure Trump will win
Basnet or Basnyat ??
nrn citizenship
Sajha has turned into MAGATs nest
Nas and The Bokas: Coming to a Night Club near you
ChatSansar.com Naya Nepal Chat
डीभी परेन भने खुसि हुनु होस् ! अमेरिकामाधेरै का श्रीमती अर्कैसँग पोइला गएका छन् !
3 most corrupt politicians in the world
अमेरिकामा बस्ने प्राय जस्तो नेपालीहरु सबै मध्यम बर्गीय अथवा माथि (higher than middle class)
if you are in USA illegally and ask for asylum it is legal
Travelling to Nepal - TPS AP- PASSPORT
Top 10 Anti-vaxxers Who Got Owned by COVID
आज बाट तिहारको सेल सकियो
निगुरो थाहा छ ??
ढ्याउ गर्दा दसैँको खसी गनाउच
Nas and The Bokas: Coming to a Night Club near you
Mr. Dipak Gyawali-ji Talk is Cheap. US sends $ 200 million to Nepal every year.
TPS Update : Jajarkot earthquake
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