Announcement

Collapse
No announcement yet.

Javascript? Making a background color blink.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • s-p0k
    replied
    Originally posted by Chen View Post
    Never mind, I found a better script that does exactly what I need.

    It was written by Statik but I modified it a bit:
    Code:
    <html>
    <head>
    <title>Blink Text</title>
    </head>
    <body>
    <table align="center" width="50%" height="50%">
        <tr>
            <td id="pmBox" align="center"><font face="verdana" size="2">Let's Blink!</font></td>
        </tr>
    </table>
    <script language="JavaScript">
    <!-- Begin
    pmBox.bgColor='#FFFFFF';
    setInterval("Timer()", 500);
    x=1;
    function Timer() {
        set=1;
        if(x==0 && set==1) {
            pmBox.bgColor='#EEEEEE';
            x=1;
            set=0;
        }
        if(x==1 && set==1) {
            pmBox.bgColor='#FFFFFF';
            x=0;
            set=0;
        }
    }
    // End -->
    </script>
    </body>
    </html>

    can i use this to make a user name blink in the forum..and where do i add the code if i can use it

    ty

    Leave a comment:


  • Chen
    replied
    Never mind, I found a better script that does exactly what I need.

    It was written by Statik but I modified it a bit:
    Code:
    <html>
    <head>
    <title>Blink Text</title>
    </head>
    <body>
    <table align="center" width="50%" height="50%">
    	<tr>
    		<td id="pmBox" align="center"><font face="verdana" size="2">Let's Blink!</font></td>
    	</tr>
    </table>
    <script language="JavaScript">
    <!-- Begin
    pmBox.bgColor='#FFFFFF';
    setInterval("Timer()", 500);
    x=1;
    function Timer() {
    	set=1;
    	if(x==0 && set==1) {
    		pmBox.bgColor='#EEEEEE';
    		x=1;
    		set=0;
    	}
    	if(x==1 && set==1) {
    		pmBox.bgColor='#FFFFFF';
    		x=0;
    		set=0;
    	}
    }
    // End -->
    </script>
    </body>
    </html>

    Leave a comment:


  • Chen
    replied
    Ok I thought I made it blinking forever, but I can't.
    If I set the for() loop to go on no matter what my IE freezes.

    Leave a comment:


  • Kaizen
    replied
    your welcome

    *me tells Firefly to stop bowing to my wisdom and also tells him i am the last poster again

    heheheheh

    Leave a comment:


  • Chen
    replied
    Thanks.
    I had to manipulate it a bit, I put onLoad="blinkIt()" in the <body> tag, and also made it quicker and infinite.

    Leave a comment:


  • Kaizen
    replied
    This should do the trick:

    Code:
    <HEAD>
    
    <SCRIPT LANGUAGE="JavaScript">
    
    <!-- Begin
    function blinkit(){
    intrvl=0;
    for(nTimes=0;nTimes<3;nTimes++){
    intrvl += 1000;
    setTimeout("document.bgColor='#0000FF';",intrvl);
    intrvl += 1000;
    setTimeout("document.bgColor='#FFFFFF';",intrvl);
       }
    }
    // End -->
    </SCRIPT>
    
    <BODY>
    <CENTER>
    <FORM>
    <INPUT TYPE="BUTTON" VALUE="Blink" onClick="blinkit()">
    </FORM>
    The first bit in bold, add lines to like that after it to increase the amount of colours.

    The second bit in bold indicates when this is called and started/used. Just put that whenever you want it to start.

    Leave a comment:


  • Chen
    started a topic Javascript? Making a background color blink.

    Javascript? Making a background color blink.

    I'm trying to get a background color of a cell to blink.
    Actually I'm not trying, I don't even know where to start.

    This is for a new little hack. I know I can use a blinking .gif image and use it as the background, but using a javascript would be a *lot* better.

    Thanks for any help!

Related Topics

Collapse

Working...
X