[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 12684 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 7 days
Recommended Popular Threads Controvertial Threads
TPS Re-registration case still pending ..
and it begins - on Day 1 Trump will begin operations to deport millions of undocumented immigrants
Travel Document for TPS (approved)
All the Qatar ailines from Nepal canceled to USA
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