eğer sayfamızda farklı durumlara göre farklı görsel ayarlar uygulamak istiyorsak ve bu, uygulama postback olmadan gerçekleşsin istiyorsak aşağıdaki gibi bir kod kullanabiliriz.(uygulama içinde 2 adet stylesheet (Stylesheet1.css ve Stylesheet2.css) bulunduğunu varsayıyorum)
<link id=”cssFile” href=”Stylesheet1.css” rel=”stylesheet” type=”text/css” />
<script language=”javascript” type=”text/javascript”>
function ChangeDocumentStyle() {
if (document.getElementById(‘cssFile’).href == ‘Stylesheet1.css’)
document.getElementById(‘cssFile’).href = ‘Stylesheet2.css’;
else
document.getElementById(‘cssFile’).href = ‘Stylesheet1.css’;
}
</script>
bu kodu yazdıktan sonra ChangeDocumentStyle() fonksiyonunu nesnelerin olaylarına ekleyebiliriz.




location.href=”http://www.google.com”
?