WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You

WebArtz - The Web Design Forum
Welcome to WebArtz, Guest!

WebArtz is a nice place for discussions related to web designing and coding. We help our members to code their own website templates with HTML and CSS. We give them advice on various issues.

To know more about WebArtz Forum, visit the About Us page.

At the moment, you are viewing the forum as a guest. As a guest you can't make post and participate in discussions. You need to register and become a member of the forum. Click the register link below and become a part of this forum.

Thank You


You are not connected. Please login or register

View previous topic View next topic Go down  Message [Page 1 of 1]

1Rejected Creating a blinking button Wed Sep 22, 2010 1:43 am

Guest


Guest
Hello fellas Smile Onother tutorial i took the time to write.Today i am gonna show you how to create a blinking button using javascript.Its an awesome effect and i think it will be great fun to use Smile it will also come in handy when you want to use a big phrase to display and the button area is too small.Lets start Smile

First of all,we need to create a basic HTML document.Here is the basic HTML page structure :

Code:
<html>
<head>
<style type="text/css">
/****here we place our css(if needed)***/
</style>
<script type="javascript">
//Here we place our Javascript codes and our javascript button code
</script>
</head>
<body>
<!--Here we place our HTML-->

</body>
</html>

Now,lets add our javascript:

Code:
<script type="javascript">
var blinking = true;
var mypos = 0;
var dpos = 25;
var a = 1;
var b = 1;

stringm = new Array(4);
      stringm[1] = "Wow";
      stringm[2] = "thats a";
      stringm[3] = "blinking";
      stringm[4] = "button";

function ablink() {
if (b==1) {
 document.forms[0].abutton.value = stringm[a]
  b-- ;
    a++;
  if (a>4) {a = 1};}
else {
 document.forms[0].abutton.value = "";
  b++ }
}

function myblink() {   
 if (dpos > 13) {
  mypos++}
 if (dpos > 48) {
  mypos = 0;
  dpos = 25;
              }
 else {dpos++}

ianID = setTimeout ("myblink(); ablink()", 200);
}

function stopit() {
if (blinking==true) {
 clearTimeout(ianID);
  document.forms[0].abutton.value = "Click Here";

  blinking = false;
}
else {
    myblink();
 document.forms[0].cbutton.value = "Stop" ;
 blinking = true;
}
}

</script>

Now our HTML:

Code:
 <form>
      <div align="center"><center><p><input type="button" name="abutton" value=" Button "><br>
      </p>
      </div>
    </form>


Now lets explore the javascript:

stringm = new Array(4);
stringm[1] = "Wow";
stringm[2] = "thats a";
stringm[3] = "blinking";
stringm[4] = "button";

We can change the name our the orange colored codes.That will be the name of the blinking buttons.

LIVE DEMO

2Rejected Re: Creating a blinking button Tue Sep 28, 2010 11:53 pm

ankillien

ankillien
Administrator
Administrator
Hi Nick,

This is a good tutorial but all what I find is how to use this code and not how this code works.

Readers expect to learn to write such code themselves instead of just copy-pasting the provided code. It would be better if you can add explanation of how the javascript works Smile

Thank you

3Rejected Re: Creating a blinking button Sun Oct 31, 2010 4:10 pm

ankillien

ankillien
Administrator
Administrator
Since the tutorial is not updated with more explanation, I'll reject it.

Tutorial Rejected

Sponsored content


View previous topic View next topic Back to top  Message [Page 1 of 1]

Permissions in this forum:
You cannot reply to topics in this forum