View Full Version : Help with a script

04-07-2006, 04:26 AM
Please help =) I have tried a bunch of different things but I get these errors:
When I load the page I get:
Line 22, Char 40, Error: Unterminiated String Constant, Code: 0
And when I click on a graphic I get:
Line 27, Char 1, Error: Object expected, Code: 0

The script is attached. And help would be much appreciated =)

Thank you =)

Light and Love to you all

-Patrick Arden McNally

04-11-2006, 12:55 PM
try to format your code ...and when using quotes<" \"#\" ">u must learn to escape them,The formated code below works without any errors , just copy and past to test.

I'm out.

<script language="javascript">
function populateBox2(title, desc, pic1, pic2, pic3, pic4, pic5, pic1_name, pic2_name, pic3_name, pic4_name, pic5_name)
text1 = "<h2>title</h2>desc<br><a href=\"#\" onClick='populateBox1(pic1)'>pic1_name</a> ";
text1 += "<a href=\"#\" onClick='populateBox1(pic2)'>pic2_name</a> <a href=\"#\" ";
text1 += "onClick='populateBox1(pic3)'>pic3_name</a> <a href=\"#\" onClick='populateBox1(pic4)'>pic4_name</a>";
text1 += "<a href=\"#\" onClick='populateBox1(pic5)'>pic5_name</a> ";

document.getElementById("box2").innerHTML = text1;

function populateBox1(picName)
document.box1.src = "images/" + picName;
<td><img src="images/i3.jpg" id="box1" width="300" height="150"></td>
<td><div id="box2">&nbsp;</div></td>
<br />
<td align="center">
<a href="#" onClick="populateBox2('Number 3', 'paintballs', 'orange', 'indigo', 'mauve', 'love', 'oh yeah',
'i4.jpg', 'i10.jpg', 'i7.jpg', 'i11.jpg','i2.jpg'); return false">
<img src="images/i4.jpg">
<br />
Number 3 - $6.99</a>
<td align="center">
<a href="#" onClick="populateBox2('Number 24', 'oh yeah baby4', 'orange', 'indigo', 'mauve', 'love', 'oh yeah',
'i5.jpg', 'i7.jpg', 'i8.jpg', 'i9.jpg', 'i10.jpg'); return false">
<img src="images/i5.jpg">
<br />
Number 24 - $7.44</a>
<td align="center">
<a href="#" onClick="populateBox2('Number 1', 'loving you baby, every day, every night, oh yeah', 'red', 'blue',
'loving green', 'sea green', 'aqua marine', 'i6.jpg', 'i3.jpg', 'i4.jpg',
'i5.jpg', 'i11.jpg'); return false">
<img src="images/i6.jpg">
<br />
Number 1 - $7.43</a></td>