I have noticed that it doesn't, but I am not completely sure. I think that once it loads, the code that is stored in memory is the one that will run - changing what is displayed won't affect what will eventually run.
So, is the code I am eventually sending to someone going to be the one that is going to run? Or could they possibly change it somehow?
I have googled this question a few times and can't find a clear answer somewhere.
Here is the "code" I used.
<!DOCTYPE html>
<html>
<head>
<script>
function foo() {
alert("Foo: The button was clicked!");
}
</script>
</head>
<body>
<input type="button" onclick="foo()" value="OK!">
</body>
</html>