Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
68
rated 0 times [  75] [ 7]  / answers: 1 / hits: 82827  / 12 Years ago, fri, july 6, 2012, 12:00:00

I have a button on my page. When clicked a popup box should appear allowing the user to enter text. When OK/Submit is pressed, my jscript will then perform some functions using that inputted data. Very straightforward, but I just can't figure out how to do this.



Thanks!


More From » jquery

 Answers
150

in it's simplest form, you could use prompt(question, default):
(taken from w3schools: http://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt)



function myFunction(){
var x;
var name=prompt(Please enter your name,Harry Potter);
if (name!=null){
x=Hello + name + ! How are you today?;
alert(x);
}
}


anything else would require lots of javascript & CSS to create layers with buttons and click events on those buttons


[#84419] Thursday, July 5, 2012, 12 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
sonja

Total Points: 541
Total Questions: 113
Total Answers: 114

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
sonja questions
Mon, Nov 30, 20, 00:00, 4 Years ago
Sun, Oct 11, 20, 00:00, 4 Years ago
Thu, May 21, 20, 00:00, 4 Years ago
Sun, Nov 10, 19, 00:00, 5 Years ago
Mon, Aug 26, 19, 00:00, 5 Years ago
;