Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

HTML Forum


You are currently viewing our HTML Forum as a guest. Please register to participate.
Login



Post a Project »

Find a Professional HTML Freelancer!

Find a Freelancer to help you with your HTML projects

FREE Outsourcing eBook!

Reply
Couple Problems with coding my website and need some help, PNG in IE and other stuff
Old 12-28-2006, 03:52 PM Couple Problems with coding my website and need some help, PNG in IE and other stuff
Junior Talker

Posts: 2
Trades: 0
Ok, So I'm coding a web page and I'm running into some problems. I have transparency in all my images so I had to save them as PNG so that the transparency is correct because GIF doesn't show it correct. So I saved all my images as PNG. As some of you might know the older versions of IE doesn't support transparency for PNG. So I was given a site that fixes this problem with JavaScript. So I add the code to my site and test it out and it only fixes the banner transparency and none of the other images. This is the site and code I used. http://homepage.ntlworld.com/bobosola/ and the code
Code:
<!--[if lt IE 7]>
<script language="JavaScript">
function correctPNG() // correctly handle PNG transparency in Win IE 5.5 & 6.
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}
window.attachEvent("onload", correctPNG);
</script>
<![endif]-->
Ok so thats one problem. Now the others, If you view my site in IE 5 or 6 you will see that only the banner gets fixed. And there is supposed to be two side boxes on the right of the page just like the left has. http://gryphus.clandestinedesigns.com/ Now view it in FireFox and now the problems in here are that the tables that I have the text in stretch and break apart. Also the footer is way at the bottom. This is what the site is supposed to look like, and what it looks like in Dreamweaver http://img.photobucket.com/albums/v3...reamweaver.jpg

So do anyone of you guys know how I could fix theses problems so they look like its supposed to?

Thanks!
Clandestine is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-28-2006, 06:38 PM Re: Couple Problems with coding my website and need some help, PNG in IE and other st
Super Talker

Posts: 124
Name: Chris
Trades: 0
Here is my png script...same exact as yours except without the script onload crap:

Code:
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

if ((version >= 5.5) && (document.body.filters)) 
{
   for(var i=0; i<document.images.length; i++)
   {
      var img = document.images[i]
      var imgName = img.src.toUpperCase()
      if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
      {
         var imgID = (img.id) ? "id='" + img.id + "' " : ""
         var imgClass = (img.className) ? "class='" + img.className + "' " : ""
         var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
         var imgStyle = "display:inline-block;" + img.style.cssText 
         if (img.align == "left") imgStyle = "float:left;" + imgStyle
         if (img.align == "right") imgStyle = "float:right;" + imgStyle
         if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
         var strNewHTML = "<span " + imgID + imgClass + imgTitle
         + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
         + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
         + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
         img.outerHTML = strNewHTML
         i = i-1
      }
   }
}
Saved that to a serpate .js file and then just called it from my html file:

Code:
    <!--[if lt IE 7]>
    <script defer type="text/javascript" src="pngfix.js"></script>
    <![endif]-->

In IE7 your right side doesn't show up at all.

You might want to take a look at your css because if it's broken in multiple browsers like that, it usually means the css is incorrect. use the validation tools at www.w3.org to check it...it will point out errors that more than likely will fix your problems.
__________________
Chris - Trying to help others and learn myself!

Please login or register to view this content. Registration is FREE

Last edited by ctess; 12-28-2006 at 06:43 PM..
ctess is offline
Reply With Quote
View Public Profile
 
Old 12-29-2006, 02:16 AM Re: Couple Problems with coding my website and need some help, PNG in IE and other st
Junior Talker

Posts: 2
Trades: 0
Well i made a new JS doc and pasted your code in there and named it pngfix.js

then i pasted this code into the head area of the code
Code:
<!--[if lt IE 7]>
<script defer type="text/javascript" src="pngfix.js"></script>
<![endif]-->
and all it does is make the banner PNG work and none of the other images.
Clandestine is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Couple Problems with coding my website and need some help, PNG in IE and other stuff
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.17566 seconds with 12 queries