It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

help needed input box

help needed input box

Postby jamie07 on Sun Apr 22, 2007 2:07 pm

hi just got a quick question. im learning html and javascript at the moment so please help if u can.

i have a javascript input box asking for a name.
<script type="text/javascript">
function promptWindow()
{
var myText = "Your name is " + window.prompt("Your Name:", "name ");
document.getElementById("myBody").appendChild(document.createTextNode(myText));
}
</script>

once this name is entered and the user presses OK, this name is displayed at the very bottom of the page as : Your name is (name entered)

I have actually created a button and by clicking it, I would like it to give me the name recently entered into that input box. How would I go about doing this?

Many thanks for your help.
jamie07
 
Posts: 3
Joined: Sun Apr 22, 2007 1:59 pm

Postby LucasZ21 on Mon Apr 23, 2007 3:11 pm

I think you would have to use the "OnClick" property. I'll see if I can find some code to help you out....
Image
User avatar
LucasZ21
100+ Club
 
Posts: 195
Joined: Mon Feb 26, 2007 2:31 am
Location: Mansfield, OH

Postby LucasZ21 on Mon Apr 23, 2007 4:56 pm

Code: Select all
<INPUT Type="Button" onclick="promtWindow()">


Maybe
Image
User avatar
LucasZ21
100+ Club
 
Posts: 195
Joined: Mon Feb 26, 2007 2:31 am
Location: Mansfield, OH


Who is online

Users browsing this forum: No registered users and 10 guests