Image and caption

Hi, I have an image insertion page that is part of a JS WYSIWYG. It works okay, but I would like to add a styled caption bar underneath it.

This is what I’m currently using for the caption (inserted by a button):


insertHTML ("<div align=\\"center\\">\\&nbsp\\;<div class=\\"caption\\">captionhere</div>\\&nbsp\\;</div>\
", n);

This is the code from the insert image page:


var qsParm = new Array();
function retrieveWYSIWYG() {
var query = window.location.search.substring(1);
var parms = query.split('&');
for (var i=0; i<parms.length; i++) {
var pos = parms[i].indexOf('=');
if (pos > 0) {
 var key = parms[i].substring(0,pos);
 var val = parms[i].substring(pos+1);
 qsParm[key] = val;
}
}
}

function insertImage() {
var image = '<img src\\=\\"' + document.all.imageurl.value + '\\" alt=\\"' + document.all.alt.value + '"\\ \\c\\l\\a\\s\\s\\=\\"' + document.all.id.value + '\\" border\\=\\"' + document.all.borderThickness.value + '\\" width\\=\\"' + document.all.width.value + '\\" height\\=\\"' + document.all.height.value + '\\">';
window.opener.insertHTML(image, qsParm['wysiwyg']);
window.close();
}

How do I put the caption bar after the image in the main code?

Hope someone can help please.

Thanks in advance - Ted

Never mind, I don’t know much Javascript but managed to sort it out.