<!DOCTYPE html>
<html>
<head>
my javascript
<title>JavaScript Example</title>
<script type="text/javascript">
function substitute()
var myValue = docutment.getElementById('myTextBox').value;
if (myValue.length== 0) {
alert('Please enter a real values in the text box!');
}
var myTitle = document.getElementById('title');
myTitle.innerHTML = myValue;
};
</script>
</head>
my html i just want to enter the text and then clicked on a button then my function will show an alert box
<body onload="alert('Hello World!')">
<h1 id="title">JavaScript Example</h1>
<input type="text" id="myTextBox"/>
<input type="submit" value="Click Me" onclick="substitute()" />
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire