JavaScript mostly works in IDs. top gives you the main window.
Add ID attributes to frame and image tags
<frame id="upperFrame" name="upperFrame" >
You can also access frame by index
top.frames[0].document. ,,,
Read www.w3schools.com stuff. Also frameset has been done away with in HTML5 so consider learning about iframes
Assign IDs to the frame and image as well, make ID same as name and try something like this
top.frames["upperFrame"].document.getElementById["imageIdNotName"].src = 'new value';