The onclick works when its not in the same html file as Kill_Count, but when they're together, only the Kill_Count file executes, the button still shows up, but when you click it, nothing happens...
Button.html:
<html>
<head>
<script src="window.js"></script>
<script src="Kill_Count.js"></script>
</head>
<body>
<button type="button" id="Vegan Site">Vegan Site</button>
<table>
<tr>
<td width="424.2">
Some stuff about Animals.
</td>
<td>
<table cellpadding="0" cellspacing="0">
<tr>
<td>Chickens</td>
<td align="right">
<span id="Kill_Count"></span>
</td>
</tr>
<tr>
<td>Pigs</td>
<td align="right">
<span id="Kill_Count2"></span>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
window.js:
window.onload = function () {
function myFunction() {
window.open("http://www.abolitionistapproach.com/");
}
var Process = document.getElementById('Vegan Site');
Process.onclick = myFunction;
}
Kill_Count.js
function Kill_Count(id)
{
var animal = "Chickens";
var totalDeaths = 49877536490;
var deathsPerSecond = totalDeaths/365/24/60/60/4;
var deaths = 0;
var timer = 1;
setInterval(function() {
deaths = deathsPerSecond*timer;
result = deaths.toFixed();
document.getElementById(id).innerHTML = result;
timer++;
}, 250);
}
function Kill_Count2(id)
{
var animal = "Pigs";
var totalDeaths = 1375940758;
var deathsPerSecond = totalDeaths/365/24/60/60/4;
var deaths = 0;
var timer = 1;
setInterval(function() {
deaths = deathsPerSecond*timer;
result = deaths.toFixed();
document.getElementById(id).innerHTML = result;
timer++;
}, 250);
}
window.onload = Kill_Count('Kill_Count');
window.onload = Kill_Count2('Kill_Count2');