I'm aware there are plenty of similar questions here, and even one of my own touches on this in a way - but I'm struggling with this particular code, and as a JS newbie, I can't figure out where I'm going wrong with it.
I'm basically adapting TinyMCE to get rid of the popup dialogs (replacing them with my own, to keep it clean). The one I'm working on right now is inserting images. Here's my function as it is now;
<script type="text/javascript">
function addImage(imgurl){
tinyMCE.execCommand('mceInsertContent',false,'<img src=" +imgurl+ " style="float:left; margin: 0 5px 5px 0;" />');
}
</script>
And the link
<a href="javascript:;" onclick="addImage('/myimage.jpg');return false;">[Insert Image]</a>
The function 'works' in that it inserts the code, but the 'imgurl' (myimage.jpg, in this example) isn't being passed - instead of /myimage.jpg being inserted, its inserting +imgurl+.
Pointers much appreciated from this newbie!