PDA

View Full Version : Possible problem with Google.js



MillerD08
06-02-2008, 08:39 PM
I hope I'm posting in the right area of the forum (:confused:). Anyways, I'm having a small issue with a tiny bit of script that I just put into my site.


I downloaded Google.js, and put the following code into the "head" section of my script.



<script src="google.js">

//Google Search Terms Highlighter- Cal Henderson (http://www.iamcal.com)
//Script featured/ available at Dynamic Drive (http://www.dynamicdrive.com)

</script>


The problem is that now for some reason the page is lagging pretty bad. On top of that I'm getting an error, "The script on this page is taking too long to respond". I do have flash installed, but I didn't have any issues until I installed the Google.js scripting. Any ideas on why Google.js would cause lagging or script errors?

I did get the script from DynamicDrive. Here is the link http://www.dynamicdrive.com/dynamicindex10/googlehighlighter.htm


All help is much appreciated.:)

Diana

kuau
06-02-2008, 10:18 PM
For it to work the way you have it defined in the <head> section, the google.js script has to be in the same directory as the file calling it. Are you sure it isn't in maybe /js/google.js or some other folder?

Just wondering.

MillerD08
06-02-2008, 10:24 PM
It's where it should be. I don't keep everything in folders because it confuses me. Is it best that I put it in a folder by itself?

kuau
06-02-2008, 10:29 PM
Wait till you get a lot of files in the root -- THAT will confuse you!

One thing I noticed is that this is how the guy spelled Google:


function highlight_goolge(term, container, color){

but it was done consistently so should still work.

Also, the filename is google.js, NOT Google.js.

Other than that, I know zip about javascript. John will help you.... earth to John...

MillerD08
06-02-2008, 10:35 PM
Wait till you get a lot of files in the root -- THAT will confuse you!

One thing I noticed is that this is how the guy spelled Google:


function highlight_goolge(term, container, color){

but it was done consistently so should still work. Other than that, I know zip about javascript. John will help you.... earth to John...


You are so much help. I appreciate it. The script works like a charm. I did a search and pulled up my site. The script highlights the keywords as it should..it's the lagging, which causes Mozilla to stop responding temporarily. The error I'm getting I'm pretty sure is due to Mozilla not responding - it may have little to do with the script itself. Er. Um. Maybe lol :)


Diana

kuau
06-02-2008, 10:44 PM
IMHO putting all your javascript (and css, php, image) files in a separate folder is a good idea in general, but it doesn't usually affect the functioning. It is just good housekeeping. It makes it easier for you to find things, and therefore saves time and frustration, and is a kind thing to do for any programmers who may inherit your files at some point down the road.

Glad you got it working. Ciao, e :)