[Javascript] image in div query

Hakan M. hakan at backbase.com
Fri Dec 12 09:45:49 CST 2003


No problem. Sorry about the confusion. :)

Remember that document.getElementById and document.createElement isn't 
supported by really old browsers, like Netscape 4 and Internet Explorer 4.

/Hakan

Alan Easton wrote:
> Hakan, it works, thanks very much for your time and help, I can have a good
> go at it now.
> 
> Thanks,
> 
> Alan...
> 
> -----Original Message-----
> From: Hakan M. [mailto:hakan at backbase.com]
> Sent: 12 December 2003 15:11
> To: [JavaScript List]
> Subject: Re: [Javascript] image in div query
> 
> 
> Doh, stupid me.
> change to
> 
> if(!_oImage)
> 
> with the bang (!)
> 
> Alan Easton wrote:
> 
> 
>>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
>>_______________________________________________
>>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