View Full Version : Referencing JS on remote

08-12-2007, 08:03 PM
1) Script Title: DHTML Widget window

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex8/dhtmlwindow/index.htm

3) Describe problem: How can this script be referenced so that it may appear on multiple pages without adding the code to each page

Should the js or the html be referenced?

I have tried adding
<script src="url of js...">
to additional pages without success

Assistance appreciated

08-13-2007, 07:00 AM
You would change the references to the .css and .js file so they're full URLs:

<link rel="stylesheet" href="http://www.mysite.com/windowfiles/dhtmlwindow.css" type="text/css" />

<script type="text/javascript" src="http://www.mysite.com/windowfiles/dhtmlwindow.js">

* DHTML Window Widget- &#169; Dynamic Drive (www.dynamicdrive.com)
* This notice must stay intact for legal use.
* Visit http://www.dynamicdrive.com/ for full source code


The code in the BODY of your page needs to be manually added to each page depending on what type of DHTML window you're opening etc.

08-13-2007, 02:05 PM
I was hoping to avoid having to add the full code to each page, but rather have remotely reference the script perhaps from different servers


Remote scripting JS should be possible.


08-13-2007, 04:15 PM
I think I got this, easier that I thought

Thanks a lot

How could the window be modified to include some image or text links that change the contents?

Another way of asking to move
<a href="#" onclick="widget.moveTo('middle', 'middle'); return false">Center Window 3 here</a></li>
from appearing on the html page to somewhere on the window.


08-13-2007, 08:39 PM
If you mean how to add links within the DHTML window that manipulates itself, such as move it, that's possible. Once you've initially opened a DHTML window, ie:

var googlewin=dhtmlwindow.open("googlebox", "iframe", "http://google.com", "Google Web site", "width=700px,height=450px,resize=1,scrolling=1,center=1", "recal")

Inside the DHTML window, you can, for example, create a link that moves it by using the code parent.googlewin to reference itself from the main page:

<a href="#" onclick="parent.googlewin.moveTo('middle', 'middle'); return false">Center Window 3 here</a>

Try searching the forums for this, as there has been a few past discussions on this.