Hello,
The reason it prints out undefined is because you try to print whatever the randomBanner() method returns which is nothing or undefined.
You need to change your HTML slightly to this:
HTML Code:
<head>
<script type="text/javascript" src="rotator.js"></script>
</head>
<body>
<div id="banners">
<script type="text/javascript">randomBanner();</script>
</div>
</body>
See how the document.write has been removed since we don't need to print the output of the method because the method will change the innerHTML of that div anyway.
// Json