I'm fairly new to xslt, and I am trying to embed a piece of JavaScript in a macro. However i doen't seem to work for me. Since I'm new to this, the error is probably obvious, so any help will be appreciated!
<script language="JavaScript"><br />
<br />
<!-- Begin JS Script --><br />
<br />
<!-- Begin<br />
// Set up the image files to be used.<br />
var theImages = new Array() // do not change this<br />
// To add more image files, continue with the<br />
// pattern below, adding to the array.<br />
<br />
theImages[0] = 'http://www.iord.dk/f1.jpg'<br />
theImages[1] = 'http://www.iord.dk/f2.jpg'<br />
theImages[2] = 'http://www.iord.dk/f3.jpg'<br />
theImages[3] = 'http://www.iord.dk/f4.jpg'<br />
<br />
var j = 0<br />
var p = theImages.length;<br />
var preBuffer = new Array()<br />
for (i = 0; i < p; i++){<br />
preBuffer[i] = new Image()<br />
preBuffer[i].src = theImages[i]<br />
}<br />
var whichImage = Math.round(Math.random()*(p-1));<br />
function showImage(){<br />
document.write('<img src="'+theImages[whichImage]+'">');<br />
}<br />
<br />
// End --><br />
</script>
Sometimes weird stuff happens with angle brackets <> and embedded javascript . You might be able to wrap in a or you might have to decode all the angle brackets to < > then put inside a .. but is not ideal.
JavaScript in Macro
Hello!
I'm fairly new to xslt, and I am trying to embed a piece of JavaScript in a macro. However i doen't seem to work for me. Since I'm new to this, the error is probably obvious, so any help will be appreciated!
[code]
]>
version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxml="urn:schemas-microsoft-com:xslt"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="msxml umbraco.library">
mikkel,
Can you post the actual script tags with content to see what the issue is.
Thanks
Ismail
Sure!
Here the JS.
[code]
[/code]
Sometimes weird stuff happens with angle brackets <> and embedded javascript . You might be able to wrap in a or you might have to decode all the angle brackets to < > then put inside a .. but is not ideal.
http://www.codehouse.com/javascript/tips/xhtml/
Petr
is working on a reply...