question document.write(' ');

Discussion in 'JavaScript' started by arale, Mar 20, 2008.

  1. #1
    Hi

    I have a small trouble with document.write(' '); Could you explain for me?

    I want to create a content/image and allow people copy a javascript file and it will show on their site. So I have show.js

    
    document.write('<link href="http://www.domain.com/css.css" rel="stylesheet" type="text/css" />');
    
    document.write('<a href="http://www.domain.com/" name="corner" target="_blank" id="corner" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="http://www.domain.com/image.png",sizingMethod="scale");">Click here</a>');
    
    Code (markup):
    Then I put <script type="text/javascript" language="javascript" src="http://www.domain.com/show.js"></script> to HTML code. Result show on Firefox is ok but on IE6, it doesnt work. In IE, it shows background only, not show image. I dont know how to fix :confused:, could some one help me please.

    This is CSS:
    Thanks
     
    arale, Mar 20, 2008 IP
  2. vpguy

    vpguy Guest

    Messages:
    275
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    In your CSS you have:

    background: url(image.png) top right no-repeat !important;
    Code (markup):
    followed immediately by:

    background: none;
    Code (markup):
    Try getting rid of background:none;. It makes no sense to have both of them. IE is probably ignoring the !important attribute and just using the background:none; since it is parsed last.
     
    vpguy, Mar 21, 2008 IP
  3. arale

    arale Guest

    Messages:
    1,215
    Likes Received:
    19
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I have fixed it, it works now :) Anyway, thank you

    
    a#support {
    	position: absolute;
    	right: 0;
    	top: 0;
    	display: block;
    	height: 90px;
    	width: 100px;
    	background: url('image.png') top right no-repeat !important;
    	[COLOR="Red"]filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='image.png');[/COLOR]
    	background: none;
    	text-indent: -999em;
    	text-decoration: none;
    	cursor: hand;
    }
    
    Code (markup):
     
    arale, Mar 21, 2008 IP
  4. vpguy

    vpguy Guest

    Messages:
    275
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    That's a pretty bizarre way to go about it "fixing" it. If your goal is to have a background image displayed on the <a>, I would recommend correcting your existing CSS code rather than applying duct tape and band-aids.
     
    vpguy, Mar 21, 2008 IP