[xwiki-users] JavaScript image manipulation
I am trying to manipulate some image files using JavaScript. But when I insert a tag as follows the javascript []'s get interpretted as a wiki link, /Sandbox/WebHome {image:AEBtn_0.jpg} -- View this message in context: http://www.nabble.com/JavaScript-image-manipulation-tp17177802p17177802.html Sent from the XWiki- Users mailing list archive at Nabble.com.
\]Ok I found the \['example'\] but that leaves the AEBtn_0.jpb I am trying to manipulate some image files using JavaScript. But when I insert a tag as follows the javascript []'s get interpretted as a wiki link, <a href="/Sandbox/WebHome" onMousedown="document.images['example'].src=img2.src" onMouseup="document.images['example'].src=img1.src"> <<mg src={image:AEBtn_0.jpg} name="example" border=0></a> -- View this message in context: http://www.nabble.com/JavaScript-image-manipulation-tp17177802p17179133.html Sent from the XWiki- Users mailing list archive at Nabble.com.
Hi Mike, \]Ok I found the \['example'\] but that leaves the AEBtn_0.jpb
I am trying to manipulate some image files using JavaScript.
But when I insert a tag as follows the javascript []'s get interpretted as a wiki link,
<a href="/Sandbox/WebHome" onMousedown="document.images['example'].src=img2.src" onMouseup="document.images['example'].src=img1.src"> <<mg src={image:AEBtn_0.jpg} name="example" border=0></a>
To prevent the wiki syntax from being interpreted in javascript code you should use the {pre} tag : {pre} <code type="javascript"> some javascript code here </code> {/pre} It's the only exception : though it is a {} tag it needs to be closed with {/} (while {table} is closed {table} for instance). Guillaume
Mike Oliver wrote:
\]Ok I found the \['example'\] but that leaves the AEBtn_0.jpb I am trying to manipulate some image files using JavaScript.
But when I insert a tag as follows the javascript []'s get interpretted as a wiki link,
<a href="/Sandbox/WebHome" onMousedown="document.images['example'].src=img2.src" onMouseup="document.images['example'].src=img1.src"> <<mg src={image:AEBtn_0.jpg} name="example" border=0></a>
{image:something.jpg} outputs not just the address of the image, but the whole img tag. You should use <img src="$doc.getAttachmentURL('something.jpg')" ... -- Sergiu Dumitriu http://purl.org/net/sergiu/
Cool, Here is what I came up with... <script type="text/javascript"> <!-- img1=new Image() img1.src="/xwiki/bin/download/Sandbox/WebHome/AEBtn0.jpg" img2=new Image() img2.src="/xwiki/bin/download/Sandbox/WebHome/AEBtn1.jpg" //--> </script> <a href="/xwiki/bin/view/Main/" onMousedown="document.images\['example'\].src=img2.src" onMouseup="document.images\['example'\].src=img1.src"> <img src="/xwiki/bin/download/Sandbox/WebHome/AEBtn0.jpg" name="example" border=0></a> glad to see there is more than one way to skin that cat. Ollie Mike Oliver wrote:
\]Ok I found the \['example'\] but that leaves the AEBtn_0.jpb I am trying to manipulate some image files using JavaScript.
But when I insert a tag as follows the javascript []'s get interpretted as a wiki link,
<a href="/Sandbox/WebHome" onMousedown="document.images['example'].src=img2.src" onMouseup="document.images['example'].src=img1.src"> <<mg src={image:AEBtn_0.jpg} name="example" border=0></a>
{image:something.jpg} outputs not just the address of the image, but the whole img tag. You should use $doc.getAttachmentURL('something.jpg') -- View this message in context: http://www.nabble.com/JavaScript-image-manipulation-tp17177802p17179696.html Sent from the XWiki- Users mailing list archive at Nabble.com.
participants (3)
-
Guillaume Lerouge -
Mike Oliver -
Sergiu Dumitriu