Monday, June 9, 2008

CSS

Uhm.. berawal dari seringnya seorang teman bertanya tanya tentang jenis makanan aneh (menurutnya) yang bernama CSS jadi punya ide buat sedikit bagi tutorial, sebnernya css itu seperti apa bentuk dan wujudnya. CSS yang kepanjangannya rada ribet kalo disebutin Cascading Stylesheets,yah gitu deh pokoknya. Sama halnya dengan saya dulu, sebelum kenal ama CSS, suka ngabisin halaman web dengan aturan yang sama dan itu berulang2 pula. Begitu kenal ama MIss CSS, hehe.. script html jadi bisa dibuat pendek. Hanya butuh bikin class n aturan aturan yang nanti dipanggil kalo mau dipake. Dicoba aja Yah..

ini, ada sebuah script pendek. simpan dan kasi nama dengan home.html


Nah, kalo udah.. coba sekarang kamu copy script ini, trus dikasi nama style.css.

body {
background: #dddddd;
color: #000;
font-family: Verdana, Helvetica, sans-serif;
font-size: 11px
}
#halaman {
background: #FFFF00;
border: thick double red
margin: 10px auto;
padding: 10px;
width: 700px
align: center;
}
#menu {
background: #DDff00;
border: thin dotted #800080
margin: 10px auto;
padding: 10px;
text-align: center;
align: center;
}
#bawah {
background: #DDFF00;
border: thin dotted #800080
margin: 10px auto;
padding: 10px;
text-align: center;
align: center;
}
H1, H2, H3, H4, H5, H6 { color: blue; font-family: sans-serif }
H1 { text-align: center }

huhu… sekarang coba jalanin di browser.. xixixi, emang si warnanya agak sedikit mencolok. Tujuannya si supaya bedanya keliatan. kalo ada pertanyaan, FF0000 itu apa?? align: center itu apa?? margin itu apa? padding itu apa?? hehehe.. cari cari di tutorial aja .. tanya ma om Goo. kalo dikasi disini bisa bikin 100 seri tutorial css dan saya ga pulang2.. :P
semoga membantu. :)

Sunday, June 1, 2008

Javascript Matrix

-------
Script ini hanya jalan di Internet Explorer
-------

contoh buka: http://www.ilmuwebsite.com/javascript/javascript-matrix.htm

<html>
<head>
</head>
<body bgcolor="#000000">
<STYLE type=text/css>#supertext {
    LEFT: 0px; VISIBILITY: hidden; POSITION: absolute; TOP: 0px
}
</STYLE>

<SCRIPT language=JavaScript1.2>

//Configure the below three variables

//1) Set message to display (HTML accepted)
var thecontent='<h2><font face="Courier New" font size="5" color="#00FF00">ilmuwebsite.com - Webmaster Resource</font></h2>'
//2) Set delay after which message should be hidden, in miliseconds ('' makes it incessantly visible on the screen)
var hidetimer='';
//3) Set speed of animation (1-50), where larger is faster
var BallSpeed = 20;



///NO NEED TO EDIT BELOW THIS LINE///////////

var contentWidth;
var contentHeight;
var maxBallSpeed = 50;


var xMax;
var yMax;
var xPos = 0;
var yPos = 0;
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;

function initializeBall() {
   if (document.all) {
      xMax = document.body.clientWidth
      yMax = document.body.clientHeight
      document.all("supertext").style.visibility = "visible";
      contentWidth=supertext.offsetWidth
      contentHeight=supertext.offsetHeight
      }
   else if (document.layers) {
      xMax = window.innerWidth;
      yMax = window.innerHeight;
      contentWidth=document.supertext.document.width
      contentHeight=document.supertext.document.height
      document.layers["supertext"].visibility = "show";
      }
   setTimeout('moveBall()',400);
   if (hidetimer!='')
   setTimeout("hidetext()",hidetimer)
   }

function moveBall() {
   if (superballRunning == true) {
      calculatePosition();
      if (document.all) {
         document.all("supertext").style.left = xPos + document.body.scrollLeft;
         document.all("supertext").style.top = yPos + document.body.scrollTop;
         }
      else if (document.layers) {
         document.layers["supertext"].left = xPos + pageXOffset;
         document.layers["supertext"].top = yPos + pageYOffset;
         }
      animatetext=setTimeout('moveBall()',20);
      }
   }

function calculatePosition() {
   if (xDir == "right") {
      if (xPos > (xMax - contentWidth - BallSpeed)) {
         xDir = "left";
         }
      }
   else if (xDir == "left") {
      if (xPos < (0 + BallSpeed)) {
         xDir = "right";
         }
      }
   if (yDir == "down") {
      if (yPos > (yMax - contentHeight - BallSpeed)) {
         yDir = "up";
         }
      }
   else if (yDir == "up") {
      if (yPos < (0 + BallSpeed)) {
         yDir = "down";
         }
      }
   if (xDir == "right") {
      xPos = xPos + BallSpeed;
      }
   else if (xDir == "left") {
      xPos = xPos - BallSpeed;
      }
   else {
      xPos = xPos;
      }
   if (yDir == "down") {
      yPos = yPos + BallSpeed;
      }
   else if (yDir == "up") {
      yPos = yPos - BallSpeed;
      }
   else {
      yPos = yPos;
      }
   }

function hidetext(){
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"
clearTimeout(animatetext)
}

if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
}

</SCRIPT>

<SCRIPT language=JavaScript>

if (document.all){

Cols=22;

Cl=18; //Peþpeþe geliþ mesafeleri!

Cs=110; //Sayfaya enine yayýlýþ mesafeleri!

Ts=12; //Rakamlarýn büyüklükleri!

Tc='#00FF00';//Renk

Tc1='#00FF00';//Renk1

MnS=22; //Akýþ hýzlarý!

MxS=50; //Akýþ hýzlarý!

I=Cs;

Sp=new Array();S=new Array();Y=new Array();

C=new Array();M=new Array();B=new Array();

RC=new Array();E=new Array();Tcc=new Array(0,1,7,9,3,2);

document.write("<div id='Container' style='position:absolute;top:0;left:-"+Cs+"'>");

document.write("<div style='position:relative'>");

for(i=0; i < Cols; i++){

S[i]=I+=Cs;

document.write("<div id='A' style='position:absolute;top:0;font-family:Arial;font-size:"

+Ts+"px;left:"+S[i]+";width:"+Ts+"px;height:0px;color:"+Tc+";visibility:hidden'></div>");

}

document.write("</div></div>");

for(j=0; j < Cols; j++){

RC[j]=1+Math.round(Math.random()*Cl);

Y[j]=0;

Sp[j]=Math.round(MnS+Math.random()*MxS);

for(i=0; i < RC[j]; i++){

B[i]='';

C[i]=Math.round(Math.random()*1)+' ';

M[j]=B[0]+=C[i];

}

}

function Cycle(){

Container.style.top=window.document.body.scrollTop;

for (i=0; i < Cols; i++){

var r = Math.floor(Math.random()*Tcc.length);

E[i] = '<font color='+Tc1+'>'+Tcc[r]+'</font>';

Y[i]+=Sp[i];

if (Y[i] > window.document.body.clientHeight){

for(i2=0; i2 < Cols; i2++){

RC[i2]=1+Math.round(Math.random()*Cl);

for(i3=0; i3 < RC[i2]; i3++){

B[i3]='';

C[i3]=Math.round(Math.random()*1)+' ';

C[Math.floor(Math.random()*i2)]=' '+' ';

M[i]=B[0]+=C[i3];

Y[i]=-Ts*M[i].length/1.5;

A[i].style.visibility='visible';

}

Sp[i]=Math.round(MnS+Math.random()*MxS);

}

}

A[i].style.top=Y[i];

A[i].innerHTML=M[i]+' '+E[i]+' ';

}

setTimeout('Cycle()',20)

}

Cycle();

}

</SCRIPT>
</body>
</html>

Sumber dari situs Ilmu Website dalam kategori javascript dengan judul Tulisan Matrix