Re: Missing pictures

by David Jones <dvjones(at)ksbe.edu>

 Date:  Wed, 18 Feb 2004 08:07:44 -1000
 To:  hwg-techniques(at)hwg.org
 In-Reply-To:  db
  todo: View Thread, Original
On 18 Feb 2004, at 16:52, Carlyle Sutphen wrote:

> Hello David,
> 
> > Yep, and then have to maintain a whole bunch of
> > separate pages. Or simply link to the image and let the
> > browser display it, sans any navigation or information
> > other than the browser's back button. In both cases, I
> > think that Javascript in this case provides a better
> > user experience, not "unnecessary overheard."
> 
> You can change an image by finding it by its name (<img
> name= ...>):
> 
> function findObj(n, d) {
> var p,i,x;
>   if(!d) d=document;
>   if( ( p=n.indexOf( "?" ) ) > 0 && parent.frames.length )
>   {
>      d=parent.frames[n.substring(p+1)].document;
>      n=n.substring(0,p);
>   }
>   if( !x && !( x = d[n] ) && d.all )
>     x = d.all[ n ];
>   for( i=0; !x && i < d.forms.length; i++ )
>     x = d.forms[ i ][ n ];
>   for( i=0; !x && d.layers && i < d.layers.length; i++ ) {
>     x = findObj( n, d.layers[ i ].document );
>   }
>   if( !x && d.getElementById ) x = d.getElementById( n );
>   return x;
> }
> 
> findObj( "portfolio-image" ).src = "images/quinn.jpg";
> 
> And you can change the contents of any DIV element, which
> you can put in table cells if you wish, one for the next
> image link and one for the description text.
> 
> function writeDynamicText( d, s )
> {
>     if( document.getElementById ) {
>             var DivElement = document.getElementById( d );
>             DivElement.innerHTML = s;
>     } else if( document.all ) {
>           document.all[ d ].innerHTML = s;
>     } else {
>             var lyr = document.layers[ d ].document;
>             lyr.open();
>             lyr.write( s );
>             lyr.close();
>             document.layers[ d ].visibility = 'show';
>     }
> }
> 
> By the way, it is very annoying, that the window is not
> resizable and not big enough to show the navigation at the
> bottom. Also, if you insist on opening a window for the
> pictures, please consider reusing them by opening them
> with the same name.

What navigation at the bottom? The script I'm using just 
opens the window with the image in it - no next or 
previous buttons or browser chrome ... I probably 
should add a link to close it, though.

What I find annoying about it is that it covers up part of 
the page below, makes it a bit hard to select some 
images. But placing new windows always has that 
challenge.

Thanks, I'll have to check your scripts out. I'm no 
Javascript whiz, I just found one I could understand!

David
dvjones(at)ksbe.edu
 

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA

This page is part of a preserved archive of archives.hwg.org. The site is no longer active and its content is not maintained. For enquiries about this archive, write to archive(at)iwanet.org.