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
Solved

firefox breaks with javascript code - URGENT - NEED HELP SOON

Posted on 2011-03-21
5
327 Views
Last Modified: 2012-05-11
The following script breaks in Firefox ... exactly at this point.
<" + "/script>"); //--> 

Open in new window


I know there is a problem with the wrong spaces around HTML comments.  But I just sent this page to a client and if they use Firefox I'm screwed.  I'll keep looking for solution - but hoped an expert could quickly explain it to me.


<!-- START PHP2 CODE for Top of Category Pages --> 
			
<script language='JavaScript' type='text/javascript'>
<!--
   if (!document.phpAds_used) document.phpAds_used = ',';
   phpAds_random = new String (Math.random()); phpAds_random = phpAds_random.substring(2,11);
   
   document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
   document.write ("http://www.domain.com/banner/adjs.php?n=" + phpAds_random);
   document.write ("&amp;what=zone:1");
   document.write ("&amp;exclude=" + document.phpAds_used);
   if (document.referer)
      document.write ("&amp;referer=" + escape(document.referer));
   document.write ("'><" + "/script>");
//-->
</script>
			<noscript>
			<a href='http://www.domain.com/banner/adclick.php?n=a83d5880' target='_blank'><img src='http://www.domain.com/banner/adview.php?what=zone:1&amp;n=a83d5880' border='0' alt='' /></a>
			</noscript>

Open in new window

0
Comment
Question by:aprillougheed
  • 4
5 Comments
 

Author Comment

by:aprillougheed
ID: 35183759
I'm researching and saw some posts about doctype being an issue.  Here is the file's doctype
Please note this is a link directory program.  The code in questions is a php banner rotating script.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

Open in new window


0
 
LVL 7

Accepted Solution

by:
nbove earned 500 total points
ID: 35183865
The string concatenation in the last line of the function is not needed.  Try changing it to:
document.write ("'></script>");

Also, please post the resulting script that gets rendered to the browser as a result of your document.write statements
0
 

Author Comment

by:aprillougheed
ID: 35185754
Hi.  Thanks for your response to my urgent request.  Unfortunately - all heck broke loose and now I have to make an emergency trip out of town to help my Mom..  Forgive my rushed comments below.

I worked on this issue for hours today. I installed this link directory script over TEN years ago.  When I started looking through the code today - it's a huge mess.  

There are a bunch of HTML comment tags that FIrefox doesn't like.
Sometime in the last few years I changed the document type and ... well, it's all a mess.  I'm looking at weeks to get it fixed.

I tried the code you suggested, but that didn't seem to fix the problem.  You are obviously really smart about these things - because I do not even know what concatenation is or what you mean by "post the resulting script".

Do you mean the source code from the page?

I'm a little paranoid about posting links to my actual site.  Indeed, I just found some hacked code today that was displaying very nasty images.  I don't know why anyone would want to hack me.  Or how it happened. So I usually make it a rule not to post code of my actual site.  I'm too inexperienced to know what I might post that would expose a security vunerability.

Am I worrying needlessly?

NOTE:  I'm toying with giving up on this old script.  It's from Gossamer Threads.  I would consider going back to Gossamer Threads and paying them to fix the script - but I'd like to get it working on Firefox and see if I can sell some advertising before I sink more money into into.  I guess I'd like to think I could fix it - I hate to go running to them everytime there is an issue.  I've already poured over every single file in the cgi-bin directory.  There are a lot of them.  And I know the interface pretty well.

I've even already purchased another script http://www.phplinkdirectory.com/ - but that will be another nightmare trying to transfer 10,000 links from my old MySql.  

What do you think?  Start over completely with a different script - or keep trying to fix this one?

Sorry this message isn't very well thought-through.  Appreciate any help you can provide.

0
 

Author Comment

by:aprillougheed
ID: 35186509
I have it working.  Guess it was all a problem with HTML comments.  I found one buried in the template global for the links.

I still have a lot of work to do to make the site standards compliant.  But it's working now.

Appreciate your help.

0
 

Author Closing Comment

by:aprillougheed
ID: 35186512
Solution was OK - but I had not given enough info to explain the problem.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

SSL stands for “Secure Sockets Layer” and an SSL certificate is a critical component to keeping your website safe, secured, and compliant. Any ecommerce website must have an SSL certificate to ensure the safe handling of sensitive information like…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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…
Shows how to create a shortcut to site-search Experts Exchange using Google in the Chrome browser. This eliminates the need to type out site:experts-exchange.com whenever you want to search the site. Launch the Search Engine Menu: In chrome, via you…

856 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