Solved

firefox breaks with javascript code - URGENT - NEED HELP SOON

Posted on 2011-03-21
5
321 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

I recently found myself in a Corporate Situation where the client had requested blocking access to any and all websites except his own Domain? Easy? I am sure this would be your answer but their requirement was, this has to be done without using…
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
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…

743 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

11 Experts available now in Live!

Get 1:1 Help Now