I am wondering why, after I added the following code into my page, it seems to destroy the credibility of my function definitions.

```
<script type="text/javascript">

if (window.addEventListener) 
{ // Mozilla, Netscape, Firefox
window.addEventListener('load', WindowLoad, false);
} 

else if (window.attachEvent) 
{ // IE
window.attachEvent('onload', WindowLoad);
}

function WindowLoad(event) {
var str = "test";

var combo = "<select id=\"users\">";
str = $("div.edit").text();

var ar = str.split("*");

for (i=0; i <= ar.length - 1; i++)
{
    if (ar[i] != "")
        combo = combo + "<option value=\"" + ar[i] + "\">" + ar[i] +"</option>";
    else 
        combo = combo + "<option value=\"\"></option>";
}
combo = combo + "</select>";
$("div.edit").html(combo);
}
</script>

```

The buttons worked before

Here is the entire page:

```
<font size="14"><b>Admin</b>      </font><a href="/worksched/table.php">Return to table</a><button onClick="logout();">Log Out</button>
<br><br><br><br>
Set values for name on left.
<br><br>
<table style="width:100%">
<tr>
<th>Name</th>
<th>Monday</th>
<th>Tuesday</th>
<th>Wednesday</th>
<th>Thursday</th>
<th>Friday</th>
<th>Saturday</th>
<th>Sunday</th>
</tr>
<td><div id="edit" class="edit"><? echo $strout ?></div></td>
<td><input id="monday"></td>
<td><input id="tuesday"></td>
<td><input id="wednesday"></td>
<td><input id="thursday"></td>
<td><input id="friday"></td>
<td><input id="saturday"></td>
<td><input id="sunday"></td>
</table><br>
<button onClick="saveval();">Save Values</button>
<button onClick="remuser();">Remove this user</button>
<div id="none"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>

<script type="text/javascript">

if (window.addEventListener) 
{ // Mozilla, Netscape, Firefox
    window.addEventListener('load', WindowLoad, false);
} 

else if (window.attachEvent) 
{ // IE
    window.attachEvent('onload', WindowLoad);
}

function WindowLoad(event) {
    var str = "test";

    var combo = "<select id=\"users\">";
    str = $("div.edit").text();

    var ar = str.split("*");

    for (i=0; i <= ar.length - 1; i++)
    {
        if (ar[i] != "")
            combo = combo + "<option value=\"" + ar[i] + "\">" + ar[i] +"</option>";
        else 
            combo = combo + "<option value=\"\"></option>";
    }
    combo = combo + "</select>";
    $("div.edit").html(combo);
}
</script>

<script type="text/javascript">
function logout()
{
    var message="logout";

    $.post("/worksched/admin.php", { 
    msg: message
    })
    .done(function(data){
        $('#none').html(data);
    });
    window.location.href="/worksched/login.php";
        //var ar = document.documentElement.innerHTML;
    //ar = ar + "fdasssssssssssf";
    //document.write(ar);
}

function remuser()
{
    var itemID = document.getElementByID("")
    var strUser = itemID.options[itemID.selectedIndex].text;
    $.post("/worksched/admin.php", {
        msg: "delete"
        code: struser
    })
    .done(function(data){
        $('#none').html(data);
    });
    alert("User with name: (" + strUser + ") Has been removed from the database");

}
</script>

```

After I added the window event listener for page load, my buttons started showing up as "Uncaught ReferenceError: saveval is not defined
 at HTMLButtonElement.onclick (admin.php:25)"
If I try to put it all in one block, the page load code does not execute.