<br><br>
<button type="button" onclick="MyFunction(x, 'harry')"> Click here </button>
<script>
var occupation = new string;
var name = new string;
var x=document.getElementById("occu");
function MyFunction(Occupation, Name)
{
window.alert("Welcome to you, " + Name + " the " + Occupation);
}
</script>
</body>
</html>
What's supposed to happen is that the user enters something in the dialog box, (lets say wizard) and then when the other button is clicked, the alert will show "Welcome to you, harry the wizard". I can't find why it won't work.
Also, if I directly add this line:
var x="wizard" it still won't work.