Hi guys I have been trying javascript language on macbook sometimes some codes don’t work. such as substituting names for some id elements. when I click the button click for greeting nothing comes up! I have checked if I used the right language so there are no syntax errors
This for example doesn’t work on my mac:
Enter your name:
Enter your name :
<input type="text" id="namebox" size="12" value="">
<div id='outputDiv'>
</div>
<input type="button"
value="click for greeting" onclick="fun()" />
</body>
Try this? SO is a better place for these type of questions… Some mistakes:
- The onclick is not clearly defined. I prefer brackets to code. It will tell you things like these.
- Escape characters were not used in message
- outputDiv was nowhere defined
Also,
can be used as it is as you are anyhow changing the innerHTML. It will take the tags and parse it internally