Buton-6

0 Replies, 3516 Views

Buton-6

Bu seferki buton örneğimiz windows butonlarını andırıyor.


<HEAD>..</HEAD> arasına eklenecek kod :



<SCRIPT LANGUAGE="JavaScript">

<!-- Begin
var button = new Array();
var action = new Array();
var buttonWidth = new Array();

/////////////////////////////////////////////////////////////////////////////
/////////////////////// BEGIN OF EDITABLE SECTION /////////////////////////// /////////////////////////////////////////////////////////////////////////////

// Edit this for your buttons text and actions.
// You can add or remove as much buttons as you want.
// Just be sure to use "button[number]", "buttonWidth[number]" and "action[number]"
// for each button, using the same button number for the three variables!
//
// Text format is: '...text...<u>underlined_letter</u>...text...';
// Important: Underline just ONE letter and be very carefull from
// NOT to use the same letter for more than one button!!
// Try also not to use letters that already have a function under
// the browser (i.e. If you use "e", you'll activate your button
// AND the already asigned combination for "EDIT" menu.)
//
// In the time you need to refer to some button on other scripts, each button
// has an id based on "bnumber". For example, button 1 has the id "b1".
//
// Let's use 5 buttons for this example:



button[1] = '<u>Y</u>ahoo';
buttonWidth[1] = 150; //This is the button's width, in pixels.
action[1] = function () {
// Place here you actions for button 1:
window.open('http://www.yahoo.com');
// End of actions for button 1.
}

button[2] = '<u>A</u>ltavista';
buttonWidth[2] = 150; //This is the button's width, in pixels.
action[2] = function () {
// Place here you actions for button 2:
window.open('http://www.altavista.com');
// End of actions for button 2.
}

button[3] = '<u>J</u>donanimmerkezi';
buttonWidth[3] = 150; //This is the button's width, in pixels.
action[3] = function () {
// Place here you actions for button 3:
window.open('http://www.donanimmerkezi.com');
// End of actions for button 3.
}
button[4] = 'Ntv<u>m</u>snbc Haber Portalı';
buttonWidth[4] = 150; //This is the button's width, in pixels.
action[4] = function () {
// Place here you actions for button 1:
window.open('http://www.ntvmsnbc.com');
// End of actions for button 1.
}



///////////////////////////////////////////////////////////////////////////
/////////////////////// END OF EDITABLE SECTION /////////////////////////// ///////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
// Don't edit bellow or you could get errors! //
////////////////////////////////////////////////////////////////////////////

function placeButton(value) {
if (button[value]) {
if (button[value].indexOf('<u>') != -1) {
document.write('<button id="b'+value+'" style="Width : '+buttonWidth[value]+'px ; Height : 22px" onClick="action['+value+']()"><font face="MS Sans Serif" size="1">'+button[value]+'</button>');
} else {
alert('You didn\'t specify the underlined letter for the button number '+value+'. This button cannot be placed until you specify the underlined letter by using <u> and </u> tags.');
}
} else {
alert('You are trying to place the button number '+value+', but you didn\'t declare its values on the variables area. \r\rThe button '+value+' will not be placed until you specify the variables "button['+value+']" and "action['+value+']".');
}
}

document.write('<script'+'>');
document.write('function myfocus(n) {');
for (a=1; a<button.length; a++) {
document.write('if (n=='+a+') {document.all.b'+a+'.focus()}'); } document.write('}'); document.write('<'+'/script>');

function chkKey(evt) {
var mykey, alt, ctrl, shift;
if (window.Event) {
mykey = evt.which;
alt = (evt.modifiers & Event.ALT_MASK) ? true : false;
ctrl = (evt.modifiers & Event.CONTROL_MASK) ? true : false;
shift = (evt.modifiers & Event.SHIFT_MASK) ? true : false;
} else {
mykey = evt.keyCode;
alt = evt.altKey;
ctrl = evt.ctrlKey;
shift = evt.shiftKey;
}
if (mykey!=0 && mykey!=16 && mykey!=17 && mykey!=18) {
if (alt) {
for (i=1; i<button.length; i++) {
ui = button[i].indexOf('<u>');
ul = button[i].substring(ui + 3, ui + 4).toLowerCase();
if (String.fromCharCode(mykey).toLowerCase() == ul) {
myfocus(i);
action[i]();
break;
}
}
}
}
return true;
}
if (window.Event) {
document.captureEvents(Event.KEYDOWN);
document.onkeydown = chkKey;
} else {
document.onkeydown = function() {
return chkKey(event);
}
}
// End -->
</script>



<BODY>..</BODY> arasına eklenecek kod :


<script>placeButton(1)</script>

<script>placeButton(2)</script>

<script>placeButton(3)</script>

<script>placeButton(4)</script>





NOT : Butonlarda kimi harflerin altının çizilebildiğine dikkat edin. 8) in yerine 8parantez yazacaksınız. Smillerin kısayolları ile çakıştığından bu şekilde görünmekte.

Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Hareketli buton koray15 0 4,294 03-02-2006, 20:01
Son Yorum: koray15
  Uzayıp Kısalan Buton ЯeboR 0 3,656 12-03-2005, 22:13
Son Yorum: ЯeboR
  Hareketli Buton-1 ЯeboR 0 8,607 12-03-2005, 21:54
Son Yorum: ЯeboR
  Değişen Buton ЯeboR 0 3,818 12-03-2005, 21:47
Son Yorum: ЯeboR
  Alarmlı Buton ЯeboR 0 3,563 12-03-2005, 21:08
Son Yorum: ЯeboR



Konuyu Okuyanlar: