Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Two Javascript interfering with each other

Posted on 2011-09-09
3
Medium Priority
?
233 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 

Expert Comment

by:G_Teley
ID: 36509419
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 2000 total points
ID: 36509440
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
ID: 36509557
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

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

636 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