Solved

Two Javascript interfering with each other

Posted on 2011-09-09
3
219 Views
Last Modified: 2012-06-21
I have 2 jscripts that work fine independently, but when I put them on the same page, somehow they interfere with each other and one does not work (the other one does). Attached are the 2 javascript files. One called livesearch.js is a script that narrows the search results based off what the user types (this is for the search box). The other script is a drop down menu for choosing the language  (dropdowntabs.js). The livesearch.js script is the one that does not work with the other. On IE you can see the javascript error when you type into the search box at this url:

http://www.perfumeemporium.com/index_test.cfm

You can also just go here to see how the search box is suppose to work when you type something into it, go here and type viva or any 4 or more letter word:

http://www.perfumeemporium.com

I did not write any of these scripts and am not that knowledgeable on jscripts. Thank you for your help in advance.
dropdowntabs.js
livesearch.js
0
Comment
Question by:seeraig
3 Comments
 

Expert Comment

by:G_Teley
Comment Utility
Just a little hint: Put a semicolon after function call in the onkeypress="liveSearchStart()" part.
That would become:
<input id="livesearch" class="NFText" type="text" tabindex="1" maxlength="64" size="21" onblur="setTimeout('closeResults()',2000);" name="productsearch" onkeypress="liveSearchStart();" value="">


0
 
LVL 19

Accepted Solution

by:
Bardobrave earned 500 total points
Comment Utility
You haven't closed the <script> tag for dropdowntabs.js, this is why the second file is not working.

0
 

Author Closing Comment

by:seeraig
Comment Utility
geez, can't believe it was that simple. thanks. While I have you here, there is one other issue with the search results script. I also added a script that shows an image when you mouse over one of the search results. You can see it working here (just type viva and mouseover any result):

http://www.perfumeemporium.com/womens_perfume_index.cfm

But on the homepage, I know there is some problem with the z-index and the search result image going underneath the layer with the 3 large rotating gift set images. Can't figure it out though. You can go to the homepage (www.perfumeemporium.com) and type calvin klein, then scroll down to the last couple results and mouseover the fragrance and you will see the image, but on the results above that the image is going underneath the rotating gift set layer.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now