Hi,
Please excuse any ignorance I might be displaying, as I'm new to Javascript.
I've been trying to get the code example working that's displayed on this tutorial site here:
http://www.javascriptkit.com/javatutors/form5.shtml
After copying/pasting this into a blank HTML page, the page displays correctly but none of the actions are happening as they do on the link above. I thought it might be an issue with the Wordpress underpinnings of my hosting site but I've just copy/pasted the same snippet of code into a blank Apache2 page on my OS X Mountain Lion system at home and I'm getting the exact same results - i.e., nothing.
Here's the exact code that I've copied/pasted:
Code:
<script>
function emailcheck(){
var string1=document.example.email.value
if (string1.indexOf("@")==-1){
.alert("Please input a valid email address!")
.document.example.email.focus()
.}
}
</script>
<form name="example"><input type="text" size="20" name="email" onblur="emailcheck()">
<strong>Feedback please:</strong>
<textarea name="S1" rows="2" cols="20"></textarea>
<input type="submit" name="B1" value="Submit">
</form>
My HTML file contains ONLY the above content. I haven't been through the entire tutorial web-site content so I'm wondering if there's some critical element that I'm missing somewhere?
Can anyone help me understand why I'm not seeing the behavior that the above tutorial explains that I should be seeing? I'm getting the same non-results from Chrome (Windows), Firefox (Windows & OS X) & Safari (OS X).
- CDM