Pages

Wednesday, December 08, 2010

Drop-down Document Viewer II

Sri Lanka Guardian |
Huamn Rights.asia |
ABC News |
BBC UK News



------------------------

Description: Version II of the original drop down document viewer, this script uses text links to allow your visitors to select/ view external documents from your site. Specify whether the selected page is loaded in an inline frame or new window.

Demo: In demo, selected pages are configured to load in an inline frame (for IE4+ and NS6+). Note that in NS4-, the pages are simply launched in a new window, since the browser does not support <iframe>.

Step 1: Simply add the following to the BODY section of your page

---------------------------------------------------------------------

<!--CHANGE LINKS BELOW TO YOUR OWN-->
<a href="javascript:jumpto('http://www.srikankaguardian.org')">Sri Lanka Guardian</a> |
<a href="javascript:jumpto('http://www.humanrights.asia')">Human Rights</a> |
<a href="javascript:jumpto('http://www.abcnews.com')">ABC News</a> |
<a href="javascript:jumpto('http://news.bbc.co.uk')">BBC UK News</a>

<script language="javascript">
<!--

//Drop-down Document Viewer II- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

//Specify display mode (0 or 1)
//0 causes document to be displayed in an inline frame, while 1 in a new browser window
var displaymode=0
//if displaymode=0, configure inline frame attributes (ie: dimensions, intial document shown
var iframecode='<iframe id="external" style="width:95%;height:400px" src="http://www.yahoo.com"></iframe>'

/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function jumpto(inputurl){
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=inputurl
else if (document.all&&displaymode==0)
document.all.external.src=inputurl
else{
if (!window.win2||win2.closed)
win2=window.open(inputurl)
//else if win2 already exists
else{
win2.location=inputurl
win2.focus()
}
}
}
//-->
</script>

---------------------------------------------------------
As shown  inside the code above, links for the script should be set up using the syntax:

<a href="javascript:jumpto('http://www.srilankaguardian.org')">Sri Lanka Guardian</a> 

No comments:

Post a Comment