Hi Chinagirl;
"chinagirl" <ju*******@judyhhuang.com> wrote in message
news:e0**************************@posting.google.c om...
I have a javascript that displays couple of buttons, which are
directional (e.g., click button it goes to a particular page). I need
to have these buttons shows up multiple times in same page, each
represent a different direction but buttons themself are from the same
gif file. What's the most effecient way to do this? Any info would
be greatly appreciated.
I think the following would be pretty efficient (perhaps others will chime
in if I'm incorrect).
// use these statements to create a new image in javascript (this way the
image only needs
// to be downloaded from the web once)
myButton = new Image(76, 21);
myButton.src = "images/buttonImage2BeUsedMutipleTimes.gif";
// use these statements load the image on to the page (you will need, of
course, the proper
// <img> tags on the page -- and be sure to use the name property)
document [button_left].src = myButton.src;
document [button_right].src = myButton.src;
document [button_up].src = myButton.src;
document [button_down].src = myButton.src;
/* sample <img> tag form one of my HTML pages
<img src="images/contact_off.gif" alt="Contact Info -- How to contact
us."
border="0" width="76" height="17" name="contact">
*/
HTH.
Charles...
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
http://www.grisoft.com).
Version: 6.0.684 / Virus Database: 446 - Release Date: 5/13/04