I've compiled a JS function using snippets from other chunks of code and some reverse engineering. It works exactly as I want it to in Firefox, but does absolutely nothing in Chrome. I've linted it and validated it, and it's come back fine, say for some formatting.
Is there a tool that allows selective validation by emulating browsers?
The culprit - dropdown iframe changer: http://injurypreventioncentre.ca/stories
The js:
var xmlhttp;
function loadXMLDoc(url, cfunc) {
if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp = new XMLHttpRequest();
} else { // code for IE6, IE5
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange = cfunc;
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
function story() {
"use strict";
loadXMLDoc("shareyourstory/story.txt", function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
});
}
function January() {
"use strict";
loadXMLDoc("shareyourstory/january.txt", function() {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
document.getElementById("myDiv").innerHTML = xmlhttp.responseText;
}
});
}
Each month is a function.
And the HTML calling it:
<select>
<option value="Please select month" onclick="story()" selected>Please select month</option>
<option value="January" onclick="January()">January</option>
</select>