I have a visualforce page that starts like this:
<apex:page controller="FilastController" standardstylesheets="false" showheader="false" docType="html-5.0" sidebar="false">
<html>
<head>
<apex:includeScript value="{!$Resource.Javascript}" loadOnReady="true"/>
</head>
I have text/javascript static resource called JavaScript that starts like this:
window.onload = function () {
//Create elements for schedule inputs dynamically
var frequencies = ["Daily","Weekly","Monthly"]
for (var i = 0; i < frequencies.length; i++) {
input = document.createElement('input');
input.type = "radio";
input.id = frequencies[i];
input.title = frequencies[i];
input.name = "item10";
document.getElementById('frequency_inputs').appendChild(input);
li = document.createElement('li');
li.id = "lid"+frequencies[i];
document.getElementById('frequency_list').appendChild(li);
label = document.createElement('label');
label.htmlFor = frequencies[i];
label.innerHTML = frequencies[i];
document.getElementById("lid"+frequencies[i]).appendChild(label);
}
When I put the JavaScript directly in the visualforce page between script tags it works; however, when I try to include it as a static resource it does not.
I was thinking my problem had to do with the onload function so I played around with the loadOnReady apex parameter, but haven't had any luck.