[Javascript] Passing a function call in a document.write stat ement

Stern,Matthew matthew.stern at bestsoftware.com
Thu Jul 11 17:08:50 CDT 2002


That did the trick! Thank you very much, Tom.--Matt

-----Original Message-----
From: TomMallard [mailto:mallard at serv.net]
Sent: Thursday, July 11, 2002 2:46 PM
To: javascript at LaTech.edu
Subject: RE: [Javascript] Passing a function call in a document.write
statement


Try something along this idea...

answerHTML =+ 'onclick=\"menuBarFunctions.OpenAppFile
(\'../../Client/Setup.exe\')\">';

tom mallard
seattle

-----Original Message-----
From: javascript-admin at LaTech.edu [mailto:javascript-admin at LaTech.edu]On
Behalf Of Stern,Matthew
Sent: Thursday, July 11, 2002 2:34 PM
To: 'javascript at LaTech.edu'
Subject: [Javascript] Passing a function call in a document.write
statement


I'm using document.write to generate responses to a survey that users
complete on an HTML page. This response includes a link to a program that
the users run to installation software they need. To run the software
without showing the Save/Open dialog box, I created the following function:

function OpenAppFile(FileName)
{
	var FileName;
	var obj = new ActiveXObject("Shell.Application");
	obj.ShellExecute(FileName);
}

So, I'm trying to write the document.write command to include a call to this
function. This is what I've come up with so far:

answerHTML = answerHTML + "<li>Run the Client Installation wizard. ";
answerHTML = answerHTML + "<a href=# ";
answerHTML = answerHTML + "onclick=&quot;menuBarFunctions.OpenAppFile
('../../Client/Setup.exe')&quot;>";
answerHTML = answerHTML + "Click here&gt;&gt;</a></li>";
answerHTML = answerHTML + endAnswerHTML;
return answerHTML;

Where:

* menuBarFunctions refers to the frame where the function is located. (I put
var menuBarFunctions = window.top.fraBody.fraMenuBar; in the head of the
document where the text is to be written.

* answerHTML is the variable used for building the text to be written with
document.write.

When I click the link, I get no response.

I've tried different things, such as making onclick the target of href,
putting the function in the head of the document where the text is written,
and playing with the quotation marks in the onclick statement, but I'm not
having much luck. Anyone have any suggestion? Thank you for your help.

Matthew Stern
Principal Technical Writer
Best Software
matthew.stern at bestsoftware.com
http://www.matthewarnoldstern.com

The opinions expressed here are solely my own.

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript



More information about the Javascript mailing list