Topic: JavaScript in Caption

I would like to add an Amazon Checkout Button to the caption in SimpleViewer v2 (Standard or Pro).  The Amazon code is below; I tried placing or splitting up the code every way i can think of, but I couldn't get it to work.


<script type="text/javascript" src="https://static-na.payments-amazon.com/cba/js/us/sandbox/PaymentWidgets.js"></script>
<script>
RenderCBAButton = function(ordervalue) {
document.getElementById('cbaxmlButton').innerHTML = '';
var standard1 = new CBA.Widgets.StandardCheckoutWidget({
merchantId: "A1Q4W09PRHCI8U",
buttonSettings: {size:'medium',color:'orange',background:'white'},
orderInput: {
format: "XML",
value: ordervalue}
}).render("cbaxmlButton");
}
</script>


<table><tr>
<td>
<div id="cbaxmlButton">
<SCRIPT LANGUAGE="JAVASCRIPT" TYPE="TEXT/JAVASCRIPT">
<!--
RenderCBAButton("type:cba-signed-order/sha1-hmac/1;order:PD94bWwgdmVyc2lvbj0nMS4wJyBlbmNvZGluZz0nVVRGLTgnPz48T3JkZXIgeG1sbnM9J2h0dHA6Ly9wYXltZW50cy5hbWF6b24uY29tL2NoZWNrb3V0LzIwMDgtMTEtMzAvJz48Q2FydD48SXRlbXM+PEl0ZW0+PE1lcmNoYW50SWQ+QTFRNFcwOVBSSENJOFU8L01lcmNoYW50SWQ+PFRpdGxlPnRlc3Q8L1RpdGxlPjxEZXNjcmlwdGlvbj44eDEwPC9EZXNjcmlwdGlvbj48UHJpY2U+PEFtb3VudD4xMDwvQW1vdW50PjxDdXJyZW5jeUNvZGU+VVNEPC9DdXJyZW5jeUNvZGU+PC9QcmljZT48UXVhbnRpdHk+MTwvUXVhbnRpdHk+PFdlaWdodD48QW1vdW50PjE8L0Ftb3VudD48VW5pdD5sYjwvVW5pdD48L1dlaWdodD48RnVsZmlsbG1lbnROZXR3b3JrPk1FUkNIQU5UPC9GdWxmaWxsbWVudE5ldHdvcms+PC9JdGVtPjwvSXRlbXM+PC9DYXJ0PjwvT3JkZXI+;signature:0OTQEL5zAINoQC0g1sXsMruXNNI=");
//-->
</SCRIPT>
</div>
</td></tr></table>



I'd be grateful to just know if it was possible or not.  Thanks for the help in advance!

Re: JavaScript in Caption

You can call a JS function from a caption hyperlink by setting the caption like this:

<a href="javascript:void(alert('This is a message from Flash'));">click this text</a>

(Note if you are setting the caption directly in the XML file you will need to wrap the text in a CDATA tag).

So you can add your JS function in the HTML page then call it from a caption link as above.

Felix Turner
SimpleViewer Support Team.