Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Can't get the following javascript to work for me


sc2saturn

Recommended Posts

Posted

The error I am getting is

Parse error: parse error, unexpected T_STRING in /home/habitga/public_html/includes/languages/english/testpage3.php on line 112

 

The Javascript file I am using is for a picture gallery and the file is being called as an include. The contents of the .js file is here...

<!-- Begin

<!-- NOTE: If you use a ' add a slash before it like this \' -->

document.write('<TABLE cellpadding="0" cellspacing="0" border="0"><tr><td width="10">');
document.write('<img src="picts/spacer.gif" height="10" width="20"><br>');
document.write('</td><td><br>');


document.write('</td><td width="5"> <br></td><td>');
document.write('<TABLE cellpadding="2" cellspacing="0" border="1" bordercolor="#FFFFFF" style="border-collapse: collapse"><tr><td>');
document.write('<a href="gallery-2.htm">1</a><br>');
document.write('</td></tr></table>');


document.write('</td><td width="5"> <br></td><td>');
document.write('<TABLE cellpadding="2" cellspacing="0" border="1" bordercolor="#FFFFFF" style="border-collapse: collapse"><tr><td>');
document.write('<a href="gallery-3.htm">2</a><br>');
document.write('</td></tr></table>');

<!-- NOTE: COPY AND PASTE THE NEXT 4 LINES ABOVE OR BELOW TO ADD A LINK -->

document.write('</td><td width="5"> <br></td><td>');
document.write('<TABLE cellpadding="2" cellspacing="0" border="1" bordercolor="#FFFFFF" style="border-collapse: collapse"><tr><td>');
document.write('<a href="javascript:popUpSlideshow(\'slideshow.htm\')">Slideshow</a><br>');
document.write('</td></tr></table>');


document.write('</td><td width="5"> <br></td><td>');
document.write('<TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#FFFFFF" style="border-collapse: collapse"><tr><td>');
document.write('<a href="javascript:void(0);" onClick="fullScreen(\'gallery.htm\');"><img src="picts/screen_full.gif" border="0"></a><br>');
document.write('</td></tr></table>');


document.write('</td><td width="5"> <br></td><td>');
document.write('<TABLE cellpadding="0" cellspacing="0" border="1" bordercolor="#FFFFFF" style="border-collapse: collapse"><tr><td>');
document.write('<a href="javascript:window.close();"><img src="picts/screen_close.gif" border="0"></a><br>');
document.write('</td></tr></table>');



document.write('</td></tr></table>');

//  End -->

 

The code used to call the java file and create the gallery is as follows...

<script language="JavaScript" src="gallery_nav.js"></script>

... and the actual pop up code is here...

<!-- PICTURE TABLE 1 --> 

<TABLE cellpadding="0" cellspacing="0" border="0"><tr> 

<td valign="center" align="center" onmouseover="this.className='rolloveron'" onmouseout="this.className='rollover'"  class="rollover"> 

<a href="javascript:popUp('gallery/Fgallery2-1.jpg')"><img src="gallery/gallery2-1.jpg" border="0" hspace="1" vspace="1" width="130" height="90"></a><br> 

</td></tr></table> 

<!-- PICTURE TABLE 1 -->

It currently works like a charm on a static page. The idea is a simple thumbnail image that when clicked opens a large version in a pop up window. The problem it seems is the parsing is getting hung up on the first ' in the "this.className='rolloveron'" statement.

 

Please any help you can provide on how to get the thing to parse past this point correctly would be appreciated. (Or if you have another idea of how I can create this same effect... please suggest this as well)

Posted

Well it was an easy fix...

 

Had to change the code to add a \ for every ' in the code and it worked like a charm... I am so stupid.

 

<td valign="center" align="center" onmouseover="this.className='rolloveron'" onmouseout="this.className='rollover'"  class="rollover">

Changed to...

<td valign="center" align="center" onmouseover="this.className=\'rolloveron\'" onmouseout="this.className=\'rollover\'"  class="rollover">

 

I just gave one example... but I had to go through the entire code and fix them all.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...