Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invoking javascript from a separate .js file

Status
Not open for further replies.

bcurb

Technical User
Aug 29, 2001
1
US
I'm becoming newly acquainted with SilverStream 3.5, and am trying to embed a javascript calendar 'date chooser' popup control into my SilverStream page. I've been able to use this control successfully with previous html/javascript implementations. It consists of an initial html page that is opened in a new popup window, which invokes commands on a javascript source file (calendar.js) to construct a frameset for the window. Here's the relevant code in the originating page:

<SCRIPT LANGUAGE=&quot;JavaScript&quot; SRC=&quot;calendar.js&quot;></SCRIPT>
...
<A HREF=&quot;javascript:doNothing()&quot; onClick=&quot;setDateField(document.myForm.myDateField);top.newWin =window.open('calendar.html','cal','dependent=yes,width=210,height=230,screenX=200,screenY=300,titlebar=yes')&quot;>
<IMG SRC=&quot;calendar.gif&quot; BORDER=0>
</A>


Then, here's the relevant code within 'calendar.html' that is opened in a separate window:

<P><SCRIPT LANGUAGE=&quot;JavaScript&quot;>
<P>
<P>
<P> // USE THE JAVASCRIPT-GENERATED DOCUMENTS (calDocTop, calDocBottom) IN THE
FRAMESET
<P> calDocFrameset =
<P> &quot;<FRAMESET ROWS='70,*' FRAMEBORDER='0'>\n&quot; +
<P> &quot; <FRAME NAME='topCalFrame' SRC='javascript:parent.opener.calDocTop' SCROLLING
='no'>\n&quot; +
<P> &quot; <FRAME NAME='bottomCalFrame' SRC='javascript:parent.opener.calDocBottom' SCROLLING='no'>\n&quot; +
<P> &quot;</FRAMESET>\n&quot;;
<P>
<P> document.write(calDocFrameset);
<P>
<P></SCRIPT>


I'm not sure how to quickly implement this code within SilverStream's framework. I can get the window with the calendar.html to open in a popup window using agScriptHelper.openWindow(..). However, the window is having trouble accessing/invoking commands on the javascript source.

Given that SilverStream is representing javascript in java methods, how can I set up the calendar.js javascript source to be accessible from my calendar.html code?

Thanks for taking a look at this.

 
You need to import the JavaScript into the Objectstore and then refrence like:

<SCRIPT LANGUAGE=&quot;JavaScript&quot; SRC=&quot;./../Objectstore/General/mystuff.js&quot;></SCRIPT>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top