'ello all.
I have the following bit of code that is included into a full valid XHTML page via MooTools load()
<?php
require_once('../conf.php');
if(!$player)
die('Please login');
?>
Welcome to the elevator. Sometimes the elevator gets full and you have to wait, so change floors quickly!
<br />
<br />
<strong id="floor_elevator">You are currently on floor <?php echo $player->getFloor(); ?></strong>
<br />
<br />
<ul>
<li onclick="javascript:changeFloor(1);" class="hover">1<sup>st</sup> Floor</li>
<li onclick="javascript:changeFloor(2);" class="hover">2<sup>nd</sup> Floor</li>
</ul>
<script type="text/javascript">
function changeFloor(newFloor){
if(!newFloor){
alert('Invalid floor.');
return false;
}
var req = new Request.HTML({url:'pages/elevator-ajax.php', onSuccess(els, tree, html){
$('floor_elevator').innerHTML = html;
}}).send('floor=' + newFloor);
}
</script>
The problem is that when I click one of the LI elements above, I get a function changeFloor is undefined error.
Anyone know why?
TIA!