Community Forums 

Main Content

onclick javascript alert

    Dec 18 2010 11:48:25

    #1

    pcguy

    Join date : 2008-09-18      Posts : 130

    I have a code that is activated via a lytebox and it works well except my onlclick alert, can someone take a look at my code and advise where I have gone wrong please

    <a href="lytebox4/large/jewelry.png" rel="gallery.1" Title="Jewelry Theme <a href='http://ww11.aitsafe.com/cf/add.cfm?userid=D638270&product=Jewelry+Theme&price=10.00&scode=t11&nocart=1&return=mysite.com.au/page1.htm'&onclick=alert('Item has been added to your cart\n\nPlease continue to shop or\nclick View Cart to Pay & Checkout');'>Buy</a> $10.00" rev="theme=blue&resizeDuration=5&outerBorder=5"><img src="lytebox4/thumbs/jewelry.png"></a>



    Dec 18 2010 18:33:57

    #2

    Geoff

    Join date : 2008-09-18      Posts : 415

    The attribute "onclick" is not part of the link URL but an attribute of the <a> element. In addition, the lightbox widget that I use, advises that to include a link in the caption, you need to convert that link's quotes and <> symbols into their html entity equivalents. Try replacing your title attribute with the following -

    title="Jewelry Theme &lt;a href=&quot;http://ww11.aitsafe.com/cf/add.cfm?userid=D638270&amp;product=Jewelry+Theme&amp;price=10.00&amp;scode=t11&nocart=1&amp;return=mysite.com.au/page1.htm&quot; onclick=&quot;alert(&apos;Item has been added to your cart\n\nPlease continue to shop or\nclick View Cart to Pay & Checkout&apos;);&quot;&gt;Buy&lt;/a&gt; $10.00"



    Dec 18 2010 22:08:59

    #3

    pcguy

    Join date : 2008-09-18      Posts : 130

    Thankyou Geoff that did the trick