Whing Dela Cruz
asked on
How to obtain a message from a textbox?
Hi experts, I have a button name "click me" I want to show the value of my textbox when I click this button. The value of my textbox is "Hello world" I want this to appear on the messagebox. Sorry, but i am a new beginner of HTML5. Tnx!
<html>
<body>
<form
action="">
First name :<input type="text"
name="iMsg"
value="Hello world">
</form>
<button
> Click Me
</button>
</body>
</html>
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@Michel: Thanks. You were right that getElementByName does not exists.
ASKER
Hi experts, this is my code but it doesn't work please correct.
<script>
function myFunction()
{
var x = document.getElementsByName("animal")[0].value;
var y = document.getElementsByName("animal")[1].value;
alert('x + \n y');
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Duy Pham, its now working...
ASKER
Open in new window