Jump to content

don't work funktion :blush:


pink1
 Share

Recommended Posts

<html><head><title>Name Grabber</title><script>function copyName(){//Name Grabber//Andy Harris//demonstrates form-based I/Ovar user Name =document.myForm.txtName.value;var greeting="Hi There,"var last Namei =document.myForm.txtName1.value;var city =document.myForm.txtName2.value;var =document.myForm.txtName3.value;(greeting+last Name+city+Gender)+=userName ;greeting +="!";document.myForm.txtGreeting.value=greeting;}//end copyName</script></head><body><center><h1>Name Grabber<br></h1><form name= myForm><table border=1><tr><td>Fiers Name</td><td><input type ="text" name= "txtName"></td> </tr> <tr><td>Last Name:</td><td><input type ="text" name= "txtName1"></td> </tr> <td>city:</td><td><input type ="text" name= "txtName2"></td> </tr> <td>Gender:</td><td><input type ="radio" name= "txtName3"value="M">M <input type ="radio" name= "txtName4"value="F">F</td></tr> <tr> <td colspan =2><center> <input type="button" value="click me" onClick="copyName()"> </center></td> </tr> <td colspan =2><center> <input type= "text" name= "txtGreeting"> </center></td> </tr> </table> </form> </center>

Link to comment
Share on other sites

This line is not correct:(greeting+last Name+city+Gender)+=userName ;it should be the other way around:userName+=(greeting+lastName+city+Gender) ;assuming you want to append all of that to the userName variable.Also, check your spelling.var user Name =document.myForm.txtName.value;var last Namei =document.myForm.txtName1.value;A space is not allowed inside variable names. You also need a variable name here:var =document.myForm.txtName3.value;var is not a valid name, it is a reserved word.

Link to comment
Share on other sites

This line is not correct:(greeting+last Name+city+Gender)+=userName ;it should be the other way around:userName+=(greeting+lastName+city+Gender) ;assuming you want to append all of that to the userName variable.Also, check your spelling.var user Name =document.myForm.txtName.value;var last Namei =document.myForm.txtName1.value;A space is not allowed inside variable names. You also need a variable name here:var =document.myForm.txtName3.value;var is not a valid name, it is a reserved word.
I have make than what you say but don't work again :)function copyName(){//Name Grabber//Andy Harris//demonstrates form-based I/Ovar userName=document.myForm.txtName.value;var greeting="Hi There,"var lastName=document.myForm.txtName1.value;var greeting=document.myForm.txtName2.value;var Gender=document.myForm.txtName3.value;userName+=(greeting+lastName+city+Gender) ;document.myForm.txtGreeting.value=greeting;
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...