Hello,
is it posible to have a transparent background for a simple html file?
Hello,
is it posible to have a transparent background for a simple html file?
You can you that 2 ways as I know
1. Reload the page to see a different random color
Just insert the following code into the <BODY> section of your page:
2. Loads a different background color depending on the time of the dayCode:<script> var bgcolorlist=new Array("#DFDFFF", "#FFFFBF", "#80FF80", "#EAEAFF", "#C9FFA8", "#F7F7F7", "#FFFFFF", "#DDDD00") document.bgColor=bgcolorlist[Math.floor(Math.random()*bgcolorlist.length)] </script>
Insert the following RIGHT AFTER the </head> tag. Also, you should remove the default <body>tag, since this script dynamically writes it out.
Code:<script> <!-- var now = new Date(); var hours = now.getHours(); var psj=0; //18-19 night if (hours > 17 && hours < 20){ document.write('<body bgcolor="orange" text="#FFFFFF">') } //20-21 night if (hours > 19 && hours < 22){ document.write('<body bgcolor="orangered" text="#FFFFFF">') } //22-4 night if (hours > 21 || hours < 5){ document.write('<body bgcolor="black" text="#FFFFFF">') } //9-17 day if (hours > 8 && hours < 18){ document.write('<body bgcolor="deepskyblue" text="#FFFFFF">') } //7-8 day if (hours > 6 && hours < 9){ document.write('<body bgcolor="skyblue" text="#FFFFFF">') } //5-6 day if (hours > 4 && hours < 7){ document.write('<body bgcolor="steelblue" text="#FFFFFF">') } //--> </script>
thankyou sawa , but still imposible to turn transparent my html background
Try this...
1: Copy and paste the following script in the HEAD section of your page:
Code:<script language="javascript"> var begcolor='#0084d8'; // STARTING COLOR AS A HEX STRING var endcolor='#FF00FF'; // ENDING COLOR AS A HEX STRING var steps=50; // TOTAL CHANGE STEPS FROM ONE COLOR TO THE OTHER var delay=50; // DELAY BETWEEN EACH COLOR CHANGE. LOWER IS FASTER. //*** DO NOT EDIT BEYOND THIS POINT ***\\ var data=new Array(); var ns4=(document.layers)?true:false; for(i=1, j=1;i<=3; i++, j+=2)data[i]=new colorset(j); document.bgColor=begcolor; function colorset(num){ this.beg=parseInt('0x'+begcolor.substring(num,num+2)); this.end=parseInt('0x'+endcolor.substring(num,num+2)); this.up=this.startup=(this.end>=this.beg)? true : false; this.incr=Math.abs(this.end-this.beg)/steps; this.current=this.beg; } function changebg(){ var color=new Array(); for(i=1;i<=3; i++){ (data[i].up)? data[i].current+=data[i].incr : data[i].current-=data[i].incr; if(data[i].startup){ if(data[i].current>=data[i].end){ data[i].up=false; data[i].current=data[i].end} if(data[i].current<=data[i].beg){ data[i].up=true; data[i].current=data[i].beg } } if(!data[i].startup){ if(data[i].current<=data[i].end){ data[i].up=true; data[i].current=data[i].end} if(data[i].current>=data[i].beg){ data[i].up=false; data[i].current=data[i].beg} } color[i]=data[i].current; } color[4]=Math.floor(color[1]).toString(16); if(color[4].length==1)color[4]='0'+color[4]; color[5]=Math.floor(color[2]).toString(16); if(color[5].length==1)color[5]='0'+color[5]; color[6]=Math.floor(color[3]).toString(16); if(color[6].length==1)color[6]='0'+color[6]; document.bgColor='#'+color[4]+color[5]+color[6]; } window.onload=function(){ setInterval('changebg()',delay); // TO DISABLE THIS EFFECT IN NS4 BROWSERS, CHANGE THE LINE // ABOVE TO READ: if(!ns4)setInterval('changebg()',delay); } </script>
- 2: Change the beginning and ending color values in the script. There are also a couple other values you can adjust as well. Read the script for more details.
- 3: On a slower computer, the user may notice flickering of the display. Users of Netscape 4.x browsers will also notice display flicker. There are simple directions toward the bottom of the script on how to disable the fading background as a workaround for Netscape 4.x browsers if desired.
very nice, but still not transparent
Well.. define transparent. To me, transparent means "see through" which would mean.. you see whats behind the background.. nothing.. so a white screen could be transparent. Or.. by transparent it could mean seeing through the browser window.. to the desktop behind.. which wouldnt be impossible, unless they ran on Win XP and had some tweaking done..
Please define "Transparent" so you can be helped properly.
that..that's good idea to define that clearly..what in your head and what you expect to be...thanks bowen to popup this word !
You can make it transparent with CSS, you can use this link:
http://www.domedia.org/oveklykken/css-transparency.php
This is a good way to makeit transparent. :)
good, lets define....
transparent means 100% transparent or 50% transparent
exactly if i could see my desktop trhroug a browser if the background is 100% 50% or 10% transparent..
i think is imposible, i was only trying, you never know !!!
I got your point now...I think it absolutely imposible to do that in simple html...thanks to popup the question by the way..!!!
Bookmarks