Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Javascript Problem!

Javascript Problem!

Scheduled Pinned Locked Moved Web Development
csharpjavascriptasp-nettestingbeta-testing
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rojan Gh
    wrote on last edited by
    #1

    Hi everyone, I have an Asp.net that has some Javascripts and so when I use the ie png transparency hacks, this scripts would not work correctly so wrote this for myself: var elements = document.body.all[i]; for(i = 0; i < elements.length; i++){ var element = elements[i]; if(element.style.backgroundImage){ var BackgroundImage = new String(); BackgroundImage = element.style.backgroundImage; if(BackgroundImage.toLowerCase().indexOf('.png',0) != -1){ var ImageAddress = new String(); ImageAddress = BackgroundImage.substr(BackgroundImage.toLowerCase().indexOf('(',0), BackgroundImage.toLowerCase().indexOf(')',0) - 1); element.style.backgroundImage = 'none'; ImageAddress = ImageAddress.substring(1,ImageAddress.length - 1); element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + ImageAddress + '\', sizingMethod=\'scale\');'; } } } It works nice and fixes the png transparency in ie but when it runes and does it's job, the page elements like buttons and even the onclick events of the td tags seems to be disabled and do not response! I tried to find the problem point and I tested some different codes and I achieved the point makes this problem. I started testing different tags like this: var elements = document.body.getElementsByTagName("table"); for(i = 0; i < elements.length; i++){ var element = elements[i]; if(element.style.backgroundImage){ var BackgroundImage = new String(); BackgroundImage = element.style.backgroundImage; if(BackgroundImage.toLowerCase().indexOf('.png',0) != -1){ var ImageAddress = new String(); ImageAddress = BackgroundImage.substr(BackgroundImage.toLowerCase().indexOf('(',0), BackgroundImage.toLowerCase().indexOf(')',0) - 1); element.style.backgroundImage = 'none'; ImageAddress = ImageAddress.substring(1,ImageAddress.length - 1); element.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\'' + ImageAddress + '\', sizingMethod=\'scale\');'; } } } And I found out that when it goes this way: var elements = document.body.getElementsByTagName("td"); for(i =

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups