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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can i link this to a Javascript File?

Status
Not open for further replies.

johnmak

Programmer
Apr 7, 2003
51
GB
Please goto
If you view the code i would like to put all that Javascript into an external file so it will read better in the search engines..

I have no previous experience of this language so any help would be appreciated.

Thanks.
 
I don't undestand your question. You already have alink to a javascript file in that page:
Code:
<script language=&quot;JavaScript1.2&quot; src=&quot;images/mm_menu.js&quot;></script>

So you can just copy all the javascript code into a file just like in mm_menu.js, say you name it &quot;util.js&quot;. Then delete the entire <script>...</script> element from the page and replace it with

Code:
<script language=&quot;JavaScript1.2&quot; src=&quot;images/util.js&quot;></script>


-pete
 
hmm search engines?...JS?
...who wants to &quot;search & read&quot; JS wihtout any HTML presenting it?
anyhow I am confused but 100% behind palbano on this one!
[neutral]
All the best!

> need more info?
:: don't click HERE ::
 
Hi there guys thanks for your replys.

Sorry i was very tired when i posted last night.

What i meant to say was how do you link to a Javascript file, so that the search engines wouldnt have to wade through the Javascript before getting to the real information i want the engines to pick up through in the HTML.

Anyway palbano you answered my question correctly and if you view my site i have cut the 50 or so lines of Javascript in every HTML page. I cut and pasted into a new file like you suggested and it works great.

Sorry for the confusion and thanks again guys.
 
damn. I tested on IE6 and NN.

What do u mean fall apart?What do you think the problem can be?
 
I am at home, running pc, but at work on osx it just completely falls apart. Table cells, navigation, etc. Is a complete mess.

Will do a screen shot monday and let you have a look if you dont look at it on a mac by then.

 
your JS &quot;file.js&quot; can NOT have
--------
<script>
</script>
--------
tags if you attach it to HTML as shown above:
<script language=&quot;JavaScript1.2&quot; src=&quot;JS/util.js&quot;></script>

All the best!


> need more info?
:: don't click HERE ::
 
Off topic, but something that I once did to mess up people trying to steal my js was to actually keep the <script> tags in and then use PHP to include the file :-D. It worked, but remember that you would have to use a server side language to include the page. The method you're using right now would no longer work. Don't know if that idea interests anyone, but I know lots of people like protecting their code.....

Rick

-----------------------------------------------------------
RISTMO Designs
Arab Church
Reference Guides
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top