Zimbra offers Open Source email server software and shared calendar for Linux and the Mac
 
Go Back   Zimbra - Forums > Zimbra Collaboration Suite > Zimlets

Welcome to the Zimbra - Forums!
Welcome, if you would like to post a comment please register. We also encourage you to explore all things Zimbra with our team and members of the community.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-08-2009, 02:26 PM
Trained Alumni
 
Posts: 286
Default Adding an image to a Zimlet JS file...

I have an more_info.png file stored in a Zimlet. How do I have that image appear in a Zimlet dialog using JS?

Code:
var div = document.createElement("div");
div.innerHTML = '<img src="more_info.png">'
All that appears in the dialog is a broken image item.

Matt
Reply With Quote
  #2 (permalink)  
Old 10-09-2009, 02:00 AM
Project Contributor
 
Posts: 97
Default

yu can use css, for a zimlet you can specify a css file you can put the following text

.img_logo{
background: url(myimg.gif) no-repeat;
width: 135px;
height: 45px;
}

the in javascript use: <div class='img_logo'/>

the myimg.gif must be in the zimlet's folder.
__________________
http://www.seacom.it
Reply With Quote
  #3 (permalink)  
Old 10-09-2009, 11:24 AM
Member
 
Posts: 11
Default

You can also define it as a resource in your Zimlet xml file:

Code:
    <resource>more_info.png</resource>
Then use getResource to get the URL for it:

Code:
div.innerHTML = "<img src='" + this.getResource('more_info.png') + "' border='0'/>";
As with the CSS technique, you need to put the image in the zimlet directory.
Reply With Quote
Reply


Thread Tools
Display Modes


Similar Threads

Why Join?

Registering let's you ask questions, makes it easier to search, displays any files attached to posts, and notifies you about replies.

Zimbrablog.com




 

Search Engine Optimization by vBSEO 3.1.0