Reply to Re: Offscreen image without scrollbars

Your name:

Reply:


Posted by Toby Inkster on 10/08/05 12:16

Jeff Adams wrote:

> But can't you only have one background image?

Only one per element, yes.

Try:

<img src="foo.jpeg" alt="Foo" height="100" width="160" id="imgfoo">
<img src="bar.jpeg" alt="Bar" height="100" width="160" id="imgbar">

<script type="text/javascript">
function img2bg (i)
{
var e = document.getElementById(i);
var f = e.src;
e.src = null;
e.title = e.alt;
e.alt = '';
e.style.backgroundImage = "url(" + f + ")";
}
img2bg("imgfoo");
img2bg("imgbar");
</script>

The img2bg() function above takes a regular image, blanks it out and then
replaces it with a background image.

Example: http://examples.tobyinkster.co.uk/img2bg

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация