View Full Version : top floating layer

01-09-2006, 09:52 PM

how can save it to a .js file and using in the webpage??

thanks a lot

01-09-2006, 10:20 PM

how can save it to a .js file and using in the webpage??

thanks a lot

Just follow his instructions. The first portion goes in the head section of your page. The second portion goes at the bottom of the page, just above the </body> tag. Then, modify this last piece as described, replacing
with whatever HTML you would like to see floating on your page.

Make certain that you try this on a page with more than a page worth of text or you won't see it scroll. Also, change the halign and valign settings at the top of the script to either left and top or right and top.

01-09-2006, 10:24 PM
sorry,i know how to use,but i want to save it as a .js file for different pages,not for single page

01-10-2006, 07:53 AM
Since this effect relies upon three separate scripts, each one must be saved to an external .js file and then each one called from the appropriate spot on the page(s) where you want to make use of them. That spot is the spot where they would have been if written out on (each of) the page(s).

Here are my general guidelines on external scripts, not all of which may apply in this particular case:

Use a text editor to save the script, call it 'file_name.js' where 'file_name' can be any valid file name of your choosing. Substitute the name of your external .js file for some.js in the below:

<script src="some.js" type="text/javascript"></script>

Common problems arise when:

1 ) The script file is not in the directory specified. In the above example it must be in the same directory as the page(s) that use it. Below, it can be in the scripts directory off of the root of a domain:

<script src="http://www.somedomain.com/scripts/some.js" type="text/javascript"></script>

2 ) Opening, closing and/or 'hiding' tags are left in the external file. This means that you must strip:
</script>and any of their many variations from the beginning and end of the external file.

3 ) The external call (<script src="some.js" type="text/javascript"></script>) is not inserted into the page at the correct spot. The external call must be inserted at the same place on the page where the script was/would have been.

4 ) Paths to other files (if) used by the script are no longer valid due to its location. This is only a problem if the external script is kept in a different directory than the page it was working on when it was an internal script. To correct this, use absolute paths inside the script. Absolute path examples:



5 ) Inappropriately combining two or more scripts into one external file. Usually external scripts can be combined if one knows enough about scripting to do so properly. Even then it is possible to overlook something.

A rule of thumb when testing is, if it won't work on the page, it won't work as an external file either.

One other thing, if this is a DD script or any script that requires the credit remain for legal use, include the credit in the on page call, ex:

<script src="some.js" type="text/javascript">
* IFrame SSI script II- Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use

Make sure to retain all the 'decorations', as these include begin and end javascript comment delimiters without which the script won't function.

01-10-2006, 12:39 PM
that mean copy all code to the .js file and del <script></script<..and //..>??
because i copy all code to the .js ,it's can't work

01-10-2006, 05:49 PM
that mean copy all code to the .js file and del <script></script<..and //..>??
because i copy all code to the .js ,it's can't work

How many .js files did you make? What does the code look like on the page where you are using the external files? Was it working on the page before you made it external?


01-11-2006, 12:29 PM
there are different link in each page.Thus,i want to use an external .js file, easy to edit.
the webpage is just design now.If it's impossible to make an external .js flie, i will copy the js code to the html. Thank you very much jscheuer1
I am just a starter and wasting your time, sorry