Dynamically changing images

Page: 1

Author Post
Member
Registered: Nov 2008
Posts: 28
On the asp web page is a single small image. There are options (selection boxes) for the user to change the image. When the image changes I store the link to the image in a hidden field.

Now what I want to be able to do is click on the small image and have a full-sized image displayed with FloatBox. So I put attach a onclick event to the small image:

Image code:
<img src="<% =ShowThisOne %>" name="THEPICT" height="214" width="320" align="BOTTOM" border="1" naturalsizeflag="3" onclick="ShowFloatBox()">


And this onclick calls a javascript function:

function ShowFloatBox()
{
TheHref=document.THEFORM.newimage.value;
TheRev="";
TheTitle="";
parent.fb.loadAnchor(TheHref,TheRev,TheTitle);
}


The error is get is that parent.fb is underfined.

I am obviously doing some very basic incorrectly. Any help would be greatly appreciated.
Administrator
Registered: Aug 2008
Posts: 3382
It sounds to me like floatbox simply is not loaded on the page, either because the floatbox.js and floatbox.css include lines are not present in the <head> section, the floatbox files are not at the location referenced by those include lines, permissions are blocking the loading of those files, or you've got an iframe hierarchy and have not included floatbox on each document.

By the way, you don't need to pass empty rev and title parameters to loadAnchor(). You can simplify things by ditching the ShowFloatBox function and just setting onclick="parent.fb.loadAnchor(document.THEFORM.newimage.value);".
Member
Registered: Nov 2008
Posts: 28
First, thank you for the prompt reply.

I have these 2 line just before the ending </head> tag:

<link type="text/css" rel="stylesheet" href="/floatbox/floatbox.css" />
<script type="text/javascript" src="/floatbox/floatbox.js"></script>

The folder "floatbox" is at the same level as the asp file calling to load it so I think they are at the correct location for proper referencing.

I don't use iframes on this page.

That leaves, I think, only your comment about "permissions". What might these be?

The file where you can see this problem is just a work file at the following location: http://aztecwoodworks.com/joe/order_form_lb.asp.

What am I missing here?
Member
Registered: Nov 2008
Posts: 28
Oopps ....

You were absolutely correct. This cod was incorrect:

<link type="text/css" rel="stylesheet" href="/floatbox/floatbox.css" />
<script type="text/javascript" src="/floatbox/floatbox.js"></script>

I needed to remove th einitial "/" from each line:
<link type="text/css" rel="stylesheet" href="floatbox/floatbox.css" />
<script type="text/javascript" src="floatbox/floatbox.js"></script>

Now it works fine.

Sorry for being a nusiance.

Page: 1