[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 12669 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
ChatSansar.com Naya Nepal Chat
TPS Re-registration case still pending ..
Toilet paper or water?
Anybody gotten the TPS EAD extension alert notice (i797) thing? online or via post?
ढ्याउ गर्दा दसैँको खसी गनाउच
Sajha Poll: Who is your favorite Nepali actress?
Problems of Nepalese students in US
nrn citizenship
TPS EAD auto extended to June 2025 or just TPS?
whats wrong living with your parents ?
Mamta kafle bhatt is still missing
Ajay Kumar Dev sentenced to 378 yrs
Why Americans reverse park?
Now Trump is a convicted criminal .
TPS advance parole Travel document i-131, Class of Admission ?
Tourist Visa - Seeking Suggestions and Guidance
Nepali Passport Renewal
मन भित्र को पत्रै पत्र!
Biden said he will issue new Employment visa for someone with college degree and job offers
To Sajha admin
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