PDA

View Full Version : downloading .js files and correctly linking to them



webdizzy77
02-03-2012, 05:53 PM
1) Script Title:

AnyLink JS Drop Down Menu v2.3

2) Script URL (on DD):

http://www.dynamicdrive.com/dynamicindex1/dropmenuindex.htm

3) Describe problem:

Hello. this is a VERY amateur problem. normally when I use the scripts there is just a script to copy and paste and to customize. However i have found that all of the drop down menu scripts have external files to download and link to. So, I thought that's fine. However I have tried so many different scripts with external files instead of just putting the script directly into my code and can never get it to work correctly. I would honestly much rather just put the code into my code without external files but cannot find a good code that does that.

I do realize i could easily do it with CSS but don't want to because I need the javascript to override other elements on my page with out using absolute positioning (but that's a whole other issue...)

Anyways, this AnyLink JS Drop Down Menu v2.3 script for example, has 3 external files:
anylinkmenu.js
menucontents.js
anylinkmenu.css
And I think you link to them in the head:

<link rel="stylesheet" type="text/css" href="anylinkmenu.css" />

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

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

however i have realized that only in scripts with external files, i cannot get to work on my page. I have of course tried uuploading the files to my go daddy site under html. Also I have tried changing the src="" to the whole link like www.page.com/file.js instead of just file.js

I know it has to be that i am not linking to external files correctly but i dont know... all the scripts have external files, instead of just copy and paste into your head and body and then customize..

jscheuer1
02-03-2012, 06:53 PM
I have of course tried uuploading the files to my go daddy site under html

But they're not html. They need to be uploaded as the files that they are, .js or .css respectively.

With something like AnyLink JS Drop Down Menu v2.3 it might be best to get a local version working first. Using a text only editor like NotePad, make up an html file using the step by step instructions. Use this blank page to start:


<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- Put the head stuff here -->
</head>
<body>
<!-- Put the body stuff here -->
</body>
</html>

Put the head stuff in the head and the body stuff in the body. Don't try to modify anything yet. Put it in a folder by itself. Call it test.html. Then download the .js and .css files and put them in the same folder. Then view the html file in the browser, not in some editor.

If that works out, then you can modify the menucontents.js file, again - use a text only editor.

webdizzy77
02-03-2012, 07:08 PM
When I say I uploaded them under html, i did not mean i change the file extension to .html I ment that is the main folder on godaddy,where all the files lay. i kep the file extensions as .css or .js.

webdizzy77
02-03-2012, 07:19 PM
I will do a test file soon and post the link, thanks for the help.