Can someone write me a script?

Discussion in 'Web Design and Development' started by Benjamindaines, Aug 22, 2006.

  1. Benjamindaines macrumors 68030

    Benjamindaines

    Joined:
    Mar 24, 2005
    Location:
    A religiously oppressed state
    #1
  2. Grover macrumors member

    Joined:
    May 14, 2004
    #2
    This will give you the idea. It works with IE for Mac but I haven't tested it using IE on Windows so you might have to massage it a bit for that.

    There are lots of ways to go about the actual showing of the image. I've done what I thought would be the simplest to understand if you're just learning. The image and the link are there in the HTML markup but wrapped in a <div> tag that's hidden until it's made visible by the script.

    Code:
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    	<head>
    		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    		<title>untitled</title>
    		
    		<script type="text/javascript">
    	
    			function checkUserAgent()
    			{
    				var isIE = navigator.userAgent.indexOf("MSIE") > 0;
    	
    				if (isIE == true)
    				{
    					var linkContainer = document.getElementById("getFireFoxLink");
    					
    					if (linkContainer)
    					{
    						linkContainer.style.display = "block";
    					}
    				}
    			}
    	
    		</script>
    	
    	</head>
    	<body onload="checkUserAgent()">
    	
    		<div id="getFireFoxLink" style="display: none;">
    		
    			<a href="http://www.getfirefox.com">
    				
    				<img src="http://homepage.mac.com/daines88/.Public/Ben/firefox.png" border="0">
    				
    			</a>
    		
    		</div>
    	
    	</body>
    </html>
    
    
    
     
  3. Benjamindaines thread starter macrumors 68030

    Benjamindaines

    Joined:
    Mar 24, 2005
    Location:
    A religiously oppressed state
    #3
    Thanks, is there a way to make that work with Myspace, when I add it it just comes up as text when the profile is viewed.
     

Share This Page