SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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):
    Code:
    insertHTML ("<div align=\"center\">\&nbsp\;<div class=\"caption\">captionhere</div>\&nbsp\;</div>\n", n);
    This is the code from the insert image page:
    Code:
    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

  2. #2
    SitePoint Member
    Join Date
    Dec 2010
    Posts
    15
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Never mind, I don't know much Javascript but managed to sort it out.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •