www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  WebPublisher PRO    Making an image an expand link
Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Posted
Hello,

We have an image database, and I'd like the image to be a hot expand record link, as well as a "click here to expand record" statement. Any way to do that?
 
Posts: 1 | Location: Nantucket, MA | Registered: Fri March 19 2004Reply With QuoteEdit or Delete MessageReport This Post
Posted Hide Post
Yes. I wrote a javascript method to expand a record from anywhere.

Step 1.
Put ExpandRecord() in head tag or externally referenced javascript file.

/*
ExpandRecord() emulates the WebPublisher expand link
Peter Tyrrell, Andornot Consulting
*/

function ExpandRecord(recordnum, newWindow)
{
	var params = dbtw_params;
	var snipA = "";
	var snipZ = "";
	var myUrl = window.location.href.replace(window.location.search, "");
	
	if (recordnum == 1)
	{
		snipA = params.indexOf("RN=") + 3;
		snipZ = params.indexOf("&", snipA);
		params = params.substring(0, snipA) + (recordnum) + params.substring(snipZ, params.length);
		myUrl += "?AC=PREV_RECORD" + params;
	}
	else
	{
		snipA = params.indexOf("RN=") + 3;
		snipZ = params.indexOf("&", snipA);
		params = params.substring(0, snipA) + (recordnum-2) + params.substring(snipZ, params.length);	
		myUrl += "?AC=NEXT_RECORD" + params;
	}
	
	if (newWindow && newWindow == true)
	{
	    window.open(myUrl);
	}
	else
	{
	    window.location.href = myUrl;
	}
}


Step 2.
In your form call ExpandRecord() from the image onclick or wrap the image in a link tag and call it from there. Supply the form's [RECORD NUMBER] variable as the first parameter. The second parameter is optional, and opens the expanded record in a new window when set to true.

<img src="/myimage.gif" onclick="ExpandRecord([RECORD NUMBER])" style="cursor:pointer;" alt="my image" />


Peter Tyrrell, MLIS
Senior Consultant
Andornot Consulting Inc.
http://www.andornot.com/about/developerblog
 
Posts: 179 | Location: Vancouver, BC, Canada | Registered: Thu September 20 2001Reply With QuoteEdit or Delete MessageReport This Post
 Previous Topic | Next Topic powered by eve community  
 

www.Inmagic.com    Inmagic Forums    Inmagic Forums  Hop To Forum Categories  WebPublisher PRO    Making an image an expand link