[Javascript] image in div query
Alan Easton
alan.easton at unn.ac.uk
Fri Dec 12 09:01:33 CST 2003
Hi Hakan,
Sorry, tried
<img onmouseup="showfull('images/thumb2.jpg')" src="images/thumb1.jpg" />
<script type="text/javascript">
var _oImage = null;
function showfull(sImage) {
if(_oImage) {
oDiv = document.getElementById('placeholder');
_oImage = document.createElement('IMG');
oDiv.appendChild(_oImage);
}
_oImage.src = sImage;
}
</script>
and no joy, says _oImage is null or not an object......any ideas......
-----Original Message-----
From: Hakan M. [mailto:hakan at backbase.com]
Sent: 12 December 2003 14:54
To: [JavaScript List]
Subject: Re: [Javascript] image in div query
Err, move the getElementById('placeholder') inside the if(_oImage)-clause.
I'm at work here, ok? ;)
Hakan M. wrote:
> This should work, in theory. The "placeholder" div is where your image
> will appear. No warranties, not tested.
>
>
> <div id="placeholder"></div>
>
> <img onmouseup="showfull('image.jpg')" src="thumb_image.jpg" />
>
>
> <script type="text/javascript">
>
> var _oImage = null;
> function showfull(sImage) {
> oDiv = document.getElementById('placeholder');
> if(_oImage) {
> _oImage = document.createElement('IMG');
> oDiv.appendChild(_oImage);
> }
> _oImage.src = sImage;
> }
>
> </script>
>
>
>
> Alan Easton wrote:
>
>> Hello people,
>>
>> I have a query. I was looking to do the following. I have a list of
>> thumbnail images, about 20 or so. What I would like is that when you
>> mouse
>> over each thumbnail, or click on each thumbnail, the bigger image of the
>> thumbnail appears in a div or somehow on the same page, just below or
>> somewhere beside all the thumbnails.
>>
>> Now I know how to pop them into a new browser window, but I would like
>> the
>> bigger image to appear on the same page, in a div tag or something.
>>
>> Does anyone know how easy this is or how it can be done.
>>
>> Any help would be appreciated,
>>
>> Thanks,
>>
>> Alan...
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Javascript mailing list
>> Javascript at LaTech.edu
>> https://lists.LaTech.edu/mailman/listinfo/javascript
>
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> .
>
_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript
More information about the Javascript
mailing list