Hi,
can anybody help me with this one please.
How can I make a glittering stars effect for my background?
Please help, TIA
M 12 12076
"Miha Kovac" <mi*******@yaho o.com> schrieb im Newsbeitrag
news:WY******** ************@ne ws.siol.net... Hi,
can anybody help me with this one please.
How can I make a glittering stars effect for my background?
Please help, TIA
M
Make an animated background gif.
--
Markus
Miha Kovac said: Hi,
can anybody help me with this one please.
How can I make a glittering stars effect for my background?
Here's a fairly simple-minded Javascript implementation.
In practice, I would probably want to modify the script to
automatically place a specified (or random) number of stars,
would tweak the timing, and, of course, would use better
graphics:
<html>
<head>
<script type="text/javascript">
var starList=new Array();
var starState=new Array(3);
for(var i=0;i<starState .length;i++){
starState[i]=new Image(20,20);
starState[i].src="http://www.azphx.com/tmp/star"+i+".gif";
}
function twinkle(n){
starList[n].src=starState[Math.floor(Math .random()*3)].src;
setTimeout("twi nkle("+n+")",Ma th.floor(Math.r andom()*1000+50 0));
}
function init(){
var i=0;
var star;
var id="star"+((i<1 0)?"0":"")+i;
while(star=docu ment.getElement ById(id)){
starList[i]=star;
setTimeout("twi nkle("+i+")",Ma th.floor(Math.r andom()*1000+50 0));
i++;
id="star"+((i<1 0)?"0":"")+i;
}
}
</script>
</head>
<body onload="init()" >
<div style="position :absolute;top:1 0px;left:10px"<img id="star00" src="star0.gif" ></div>
<div style="position :absolute;top:1 0px;left:100px"<img id="star01" src="star0.gif" ></div>
<div style="position :absolute;top:1 00px;left:100px "<img id="star02" src="star0.gif" ></div>
<div style="position :absolute;top:3 0px;left:50px"<img id="star03" src="star0.gif" ></div>
<div style="position :absolute;top:6 0px;left:40px"<img id="star04" src="star0.gif" ></div>
</body>
</html>
I made a dhtml twinkle effect generator for some children several
months ago. You can use stars, text, or even flying pigs. The script
generated had to be kept simple and had to include document.all since
some had MSNTV that will not support getElementById. The scripts
generated thus work on IE and relatives as well as Opera, but not
Mozilla and Netscape. It would not be much trouble to extend the code
to include getElementById once you have generated a script you like.
See http://www.wtv-zone.com/cwdjrsxyz/to...generator.html .
"Miha Kovac" <mi*******@yaho o.com> schreef in bericht
news:WY******** ************@ne ws.siol.net... Hi,
can anybody help me with this one please.
How can I make a glittering stars effect for my background?
Please help, TIA
M
By using this javascript you cam move your background. So make a glitter
jpg (or other) and put de script in your body.
<script language="JavaS cript">
<!-- Begin
var backgroundOffse t = 0;
var bgObject = eval('document. body');
function scrollBG(maxSiz e) {
backgroundOffse t = backgroundOffse t + 1;
if (backgroundOffs et > maxSize) backgroundOffse t = 0;
bgObject.style. backgroundPosit ion = "0 " + backgroundOffse t;
}
var ScrollTimer = window.setInter val("scrollBG(3 07)", 64);
// End -->
</script>
Grtz, Remie
In article <bo**********@n ews.hccnet.nl>, "Remie en Roosje"
<re******@hotma il.com> writes: <script language="JavaS cript">
language attribute is deprecated, use type="text/javascript" instead
<!-- Begin
Hiding scripts from the browser is no longer required, drop it. If you want to
comment the beginning, use a js comment instead.
var backgroundOffse t = 0; var bgObject = eval('document. body');
Why the unneeded use of eval to get a reference to the body?
Since you only call bgObject in one place, simply skip it and use the direct
reference there.
function scrollBG(maxSiz e) { backgroundOffs et = backgroundOffse t + 1; if (backgroundOffs et > maxSize) backgroundOffse t = 0; bgObject.style .backgroundPosi tion = "0 " + backgroundOffse t;
drop the above eval, and replace the above line with:
document.body.s tyle.background Position = "0 " + backgroundOffse t;
} var ScrollTimer = window.setInter val("scrollBG(3 07)", 64);
// End -->
The closing HTML comment is unneeded.
</script>
--
Randy
"Remie en Roosje" <re******@hotma il.com> writes: By using this javascript you cam move your background. So make a glitter jpg (or other) and put de script in your body.
Just because I can't let an "eval" go by uncommented ...
<script language="JavaS cript">
In HTML 4 and forward, the type attribute is required (and the
language attribute is deprecated). The type attribute is also
backwards compatible, so there is no reason for not using
<script type="text/javascript">
<!-- Begin
HTML comments are not necessary in Javascript.
var backgroundOffse t = 0; var bgObject = eval('document. body');
This call to "eval" is completely spurious. Simply
var bgObject = document.body;
would be equivalent.
I have had problems with putting this code in the head element,
because the document.body doesn't exist yet at that point.
Since bgObject is only used once in the code, simply writing
document.body directly there would solve that problem.
function scrollBG(maxSiz e) {
backgroundOffse t = backgroundOffse t + 1; if (backgroundOffs et > maxSize) backgroundOffse t = 0;
For purely esthetic reasons, I prefer the shorter lines
backgroundOffse t++;
backgroundOffse t %= maxSize;
I know that others want the more describing if statement,
so that's just a matter of style.
bgObject.style. backgroundPosit ion = "0 " + backgroundOffse t;
To be correct CSS, the backgroundOffse t should have a unit, most likely
pixels. I.e.,
bgObject.style. backgroundPosit ion = "0 " + backgroundOffse t + "px";
The lacking "px" will make this code fail on some browsers in standards
compliant mode. Opera 7 seems to think that no unit means "em", giving
a much faster scroll than you want.
(The value "0" doesn't need a unit. However, I recommend giving it one
anyway, for consistency).
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.'
On 09 Nov 2003 12:39:51 +0100, Lasse Reichstein Nielsen
<lr*@hotpop.com > wrote: In HTML 4 and forward, the type attribute is required (and the language attribute is deprecated).
There will be no more versions of HTML so deprecated has no meaning,
it has equivalent status as the type attribute...
The type attribute is also backwards compatible, so there is no reason for not using <script type="text/javascript">
Sure, this is to be prefered. <!-- Begin
HTML comments are not necessary in Javascript.
That's a javascript comment, not an HTML one, and it can cause no harm
(in XHTML things are different of course)
Jim.
--
comp.lang.javas cript FAQ - http://jibbering.com/faq/ ji*@jibbering.c om (Jim Ley) writes: On 09 Nov 2003 12:39:51 +0100, Lasse Reichstein Nielsen <lr*@hotpop.com > wrote:
In HTML 4 and forward, the type attribute is required (and the language attribute is deprecated).
There will be no more versions of HTML so deprecated has no meaning, it has equivalent status as the type attribute...
Deprecated also means that it is absent in HTML 4 Strict. That is a
difference in status (maybe more to me than in general, since I always
(try to) write strict HTML)
I must admit that by "and forward", I was thinking of XHTML, which is
the logical sucessor to HTML. If you have a better way of saying the
same, I would be happy to use it :) <!-- Begin
HTML comments are not necessary in Javascript.
That's a javascript comment, not an HTML one, and it can cause no harm (in XHTML things are different of course)
The string "<!--" begins an HTML comment. It is not part of ECMAScript
at all, and is not mentioned in the comments section of Netscape's
Javascript 1.5 reference (or 1.3 or 1.4, which have almost identical
wordings) .
<URL:http://devedge.netscap e.com/library/manuals/2000/javascript/1.5/reference/comment.html#10 66582>
To me, that means that it is not a Javascript comment. It is an HTML
comment that is accepted by the Javascript interpreters in browsers.
/L
--
Lasse Reichstein Nielsen - lr*@hotpop.com
DHTML Death Colors: <URL:http://www.infimum.dk/HTML/rasterTriangleD OM.html>
'Faith without judgement merely degrades the spirit divine.' This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Markus Mohr |
last post by:
Hi, everyone,
I have a special problem:
For every monitor resolution in 200 pixel steps from 800 to 1600
pixels I have an image to be shown as centered background-image.
Those images all have the same name and reside in the following
physical path structure:
|
by: Peter Williams |
last post by:
Hi All,
I want to write some javascript for a html page which does the
following.
Imagine that the page contains a table with 2 columns and 3 rows, e.g.:
+---+---+
| A | B |
+---+---+
|
by: scorpion1 |
last post by:
:) hi i would would to make some kind of flashing stars appear on a form when a person reaches a certain qualification can someone posible help?
|
by: nicky77 |
last post by:
Hi, I've created a nav bar using a background image for rollover effects. Everything works as I had hoped, however, for some reason it seems that an area of whitespace (the same size of the background image) is hyperlinked underneath the nav bar. I can't see any errors in the coding below. Any ideas what may be causing this?
the page is at http://www.maguiresonline.co.uk/wosis/files/nickysnav.html
the html....
<body...
|
by: darween |
last post by:
How To write a full program to ask the users to enter a number , which indicates the number / level of stars that he / she wishes to display
| |
by: bs866806 |
last post by:
Why do many people look to movie stars for answers to some of life's
most challenging questions?
While we have great respect for the art of acting, as explicated from
Stanislavsky to Strasberg, the latter of whom we knew well and were
fond of, we have never understood how the usual snippets who decide to
become actors ascend in the minds of the public from being initially
generally regarded as likely ne'er-do-wells to being considered...
|
by: aj2317 |
last post by:
how do i do shapes like diamond,right angled triangle etc using just *(stars) in nested for loop???? like
*
* *
* * *
* * * *
* * * * *
...
|
by: thephatp |
last post by:
I'm having a problem with IE rendering correctly. I'm experimenting with using all div's in my pages now, and I'm not very familiar with the quirks of IE.
I have created a sample page, and I'm really confused as to what is going on in IE. FF renders the page exactly as I expect. IE renders the page with everything in the correct location, but it seems to double the background image for a sub-div section that is moved up using a negative...
|
by: deephill |
last post by:
hi thr,
i need Time based background image change script for website.
ex: if user open in moring time background with sunrise*
open in midday background vry bright*
open in the evng background sunset*
open in the nite time background with moon n stars*
i have pictures for this. how to change that images with script?
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |