OSGi without the Eclipse
It's become common to equate OSGi with Eclipse or Equinox, but in fact other OSGi implementations exist. This post from JW blogger Oleg Mikheev fills a much needed gap - walking through the process of developing a Hello World bundle with Apache Felix and the IDE of your choice.

Newsletter sign-up

Sign up for our technology specific newsletters.

Enterprise Java
View all newsletters

Email Address:

Using JavaScript and graphics

The easy way to make your images dynamic

Page 3 of 3

JavaScript graphic sizing example

<HTML>
<HEAD>
<TITLE>JavaScript Graphic Sizing Example</TITLE>
<SCRIPT>
makeBar ("250", "Cat");
makeBar ("175", "Dog");
makeBar ("80", "Rat");

function makeBar (Width, Text) { var GifName = pathOnly (location.href) + "blu.gif"; var Height = 12; var Temp = "<IMG SRC='" + GifName + "' HEIGHT='" + Height + "' WIDTH=" + Width + "' ALIGN=baseline> " + Text + "<P>"; document.write (Temp); }
function pathOnly (InString) { LastSlash=InString.lastIndexOf ('/', InString.length-1); OutString=InString.substring (0, LastSlash+1); return (OutString); } </SCRIPT> </HEAD> <BODYv This is body text. </BODY> </HTML>


You can readily modify the script to use a different GIF image and to increase or decrease the height of the bars. I have the bars set at 12 pixels high.

Conclusion

Graphics can enhance any Web page, no matter what its content. Combining JavaScript with graphics is a quick and simple way to give your Web page a dynamic element and will help set it apart from the rest. You can use JavaScript to select the graphic to use, to size a graphic, and even to create the graphic, using the convenient XBM graphic format.

Author Bio

Gordon McComb is an author, consultant, and lecturer. He has written 50 books and over a thousand magazine articles during his 20 years as a professional writer. More than a million copies of his books are in print. Gordon also writes a weekly syndicated newspaper column on computers, reaching several million readers worldwide. Gordon's latest book is The JavaScript Sourcebook>, out this month from Wiley Computer Publishing.
Resources