PDA

View Full Version : Tabbed Document Viewer



moosesmom
11-14-2005, 05:46 AM
http://dynamicdrive.com/dynamicindex3/tabdocviewer.htm

Hi. I'm having only one issue with the Tabbed Document Viewer. On your demo, if I choose anything other than the first tab (which is Google), and then I hit the refresh button at the top of my browser, when the page refreshes, it goes back to Google, but on my page, the tab I have in place of google is highlighted as the current tab, but the page inside the iframe did not reload to the page associated with my first tab. It remains whatever page it was prior to hitting the refresh button.

Any ideas on where I may have messed up?

Thanks!

jscheuer1
11-14-2005, 07:13 AM
You may have left out class="current" from your first list item (tab) ex. - from the demo:


<li><a class="current" href="http://www.google.com" onClick="return handlelink(this)">Google</a></li>

If that is not it, please provide your code -

put code tags:




code goes here



around your code in messages here so that it appears as it was when you copied it from your page.

OR:

.

moosesmom
11-14-2005, 06:06 PM
You can go to http://www.bit-systems.com and you will see how I have it working with images. However, the problem exists without the use of images as well. To access the tabs without images, you can click on the 'Visit Our EBay Store' image at the top of the screen and I have it set to take you to the page that doesn't use images as the tabs.

If you click on any tab other than the first, note what the pictures are for that tab. Then hit refresh and you will see it come back with the same pictures, but the first tab high-lighted and not the one that is associated with the set of pictures (the one that was high-lighted before the refresh).

This is my first page on my first web-site on a testing server, so be kind :0)

While you're there, if you know how I can get rid of the white space (bar) across the bottom of the middle picture frames (gold frames in center column), that would be great too!

Thanks!

Twey
11-14-2005, 06:39 PM
Well, for a start, you have:

onClick="javascript:return handlelink(this)"
You needn't have the javascript: bit.

moosesmom
11-14-2005, 08:42 PM
Okay. I corrected that. Thanks!

moosesmom
11-17-2005, 01:09 AM
But it had no impact on my problem, so if anyone has any ideas, I'd really appreciate it!

Thanks!

jscheuer1
11-17-2005, 05:36 AM
You probably need an onload event that will reload the the initial content into the iframes. Since there are probably already other onload events associated with the page (I couldn't see any but, some scripts' code is not on the page), best to use this fairly good code at adding to onload events coupled with a function to set the sources we want:


<script type="text/javascript">
if ( typeof window.addEventListener != "undefined" )
window.addEventListener( "load", myInitFunction, false );
else if ( typeof window.attachEvent != "undefined" )
window.attachEvent( "onload", myInitFunction );
else {
if ( window.onload != null ) {
var oldOnload = window.onload;
window.onload = function ( e ) {
oldOnload( e );
myInitFunction();
};
}
else
window.onload = myInitFunction;
}

function myInitFunction(){
document.getElementById('tabiframe').src='http://bit-systems.com/featured_products/topsellers.htm'
document.getElementById('tab2iframe').src='http://bit-systems.com/featured_mfgs/grippinbillets.htm'
}
</script>

You can put this script anywhere on the page but, the head is the customary spot. Putting it as the last thing before the </body> tag would virtually insure it adds in our event as the very last onload event, perhaps a good thing, try the head first. There is a chance this will not have the desired effect, no matter where on the page it is. If it does not, we may need to get a little more aggressive and give each of the two iframes a unique name attribute and access their location using the frames collection. Try the above first and let me know.

Be positive that the old copy of the page is no longer cached when testing this added code.

moosesmom
11-17-2005, 03:51 PM
That did the trick! Thanks so much, John!

:)