Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Nov 2004
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help with a script

    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
    Attached Files Attached Files

  • #2
    New to the CF scene
    Join Date
    Apr 2006
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

    <html>
    <head>
    <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;
    }
    </script>
    </head>
    <body>
    <table>
    <tr>
    <td><img src="images/i3.jpg" id="box1" width="300" height="150"></td>
    <td><div id="box2">&nbsp;</div></td>
    </tr>
    </table>
    <br />
    <table>
    <tr>
    <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>
    <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>
    <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>
    <td>&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>
    Last edited by mlanka; 04-11-2006 at 11:58 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •