linkedin facebook linkedin facebook nod32

Font ni kattalashtirish va kichiklashtirish

Muallif: Mengliyev Sh.

Qo`shilgan sana: 2016-10-29

Font ni kattalashtirish va kichiklashtirish

Saytda font ni kattalashtirish va kichiklashtirish (Lupa(-)minus va lupa(+)plus) quyidagicha amalga oshiriladi.

Qadam 1.
<head> bo`limida javascript kodini kiritish lozim
<script language="javascript" type="text/javascript"><!--
var tgs = new Array( 'div','td','tr','p');

var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 4 ) sz = 4;
startSz = sz;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
//-->
</script>

Qadam 2. Saytni biror qismida quyidagi kodni joylashtiring.

<a href="javascript:ts('body',1)">+Font ni kattalashtirish</a> |
<a href="javascript:ts('body',-1)">+Font ni kichiklashtirish</a>

Quyidagi misolni tekshirib ko`rishingiz mumkin

Misol:

<html>
<head>
<script language="javascript" type="text/javascript"><!--
var tgs = new Array( 'div','td','tr','p');

var szs = new Array( 'xx-small','x-small','small','medium','large','x-large','xx-large' );
var startSz = 2;

function ts( trgt,inc ) {
if (!document.getElementById) return
var d = document,cEl = null,sz = startSz,i,j,cTags;

sz += inc;
if ( sz < 0 ) sz = 0;
if ( sz > 4 ) sz = 4;
startSz = sz;

if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

cEl.style.fontSize = szs[ sz ];

for ( i = 0 ; i < tgs.length ; i++ ) {
cTags = cEl.getElementsByTagName( tgs[ i ] );
for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].style.fontSize = szs[ sz ];
}
}
//-->
</script>
</head>
<body>
<a href="javascript:ts('body',1)">+Font ni kattalashtirish</a> |
<a href="javascript:ts('body',-1)">+Font ni kichiklashtirish</a>
<p align="center">
<b><i>WWW.Tami.uz</i> Kompyuter uchun qo`llanma<br>
<i>WWW.Rd.uz </i>Foydalanuvchilar uchun cheksiz Internet<br>
</b>
Qo`shimcha murojatlar uchun xabar yuborish <br>e-mail: shoydullo@mail.ru <br>muntazam xabarlarni tekshirib turaman<br>
Telefonlar:937979681,915878681
</p>
</body>
</html>

 

395 marta o`qildi.

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений