...

View Full Version : Function to return to original frame.



sooline
12-14-2005, 07:28 PM
I have an XML documented which was converted to HTML. When a user
clicks on an animation or jpeg link, the single frame view is split into two frames: Text on the left frame and the animation or figure displayed in the right frame. I think need to include a variation of the script:

onClick="MM_goToURL('parent','frameset.htm');return document.MM_returnValue"

The right frame should probably have a close script like:

<FORM>
<INPUT TYPE="BUTTON" VALUE="Go Back"
ONCLICK="history.go(-1)">
</form>

I need to call a function which would also have a close "x" in the upper right hand corner of the frame. Unfortunately, I have close to 60 steps, which all require a split display and the functionality to return to the main frame. Rather than create 60 frame.htm files, I need help tweaking the script to reuse the same right frame every time I open an animation. Below is the On_Double_Click script that I have now to hyperlink to the figures and animation.

function onDoubleClick() {

var rng = ActiveDocument.Range;
var currentNode = rng.ContainerNode;

// check if
if (!currentNode)
return;

rng.SelectNodeContents(currentNode);

if (currentNode.nodeName == "ulink")
onDoubleClickULink(rng);

}

// Launch default application depending on filename specified
function onDoubleClickULink(select)
{

// local vars
var sFilename = "";
WSHShell = new ActiveXObject("WScript.Shell");

// make sure there is a URL attribute and read its value
if (select.ContainerNode.hasAttribute("URL"))
sFilename = select.ContainerAttribute("URL");
else
{
// Do we want to tell the user it doesnt have a URL attribute
// or do we simply want to return ? For now we'll just return
// Application.Alert("No URL attribute specified on current ULink element.");
return;
}

// Verify if the document exists or not
oFSO = new ActiveXObject("Scripting.FileSystemObject")
if (!oFSO.FileExists(sFilename))
{
// Do we want to tell the user that the file doesnt exists or
// do we just return ? For now we'll tell the user AND return
Application.Alert("The file path is invalid.");
return;
}

// Run command to open URL...
WSHShell.Run("rundll32 url.dll,FileProtocolHandler " + sFilename, 1, false);

// Cleanup...
WSHShell = null;

}

onDoubleClick()

I would appreciate any guidance or script on whether or not an onClick or onFocus script would be the best approach. Thanks in advance. sooline



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum