![]() | |
| | #1 (permalink) |
| Lonely ;) Üyelik Tarihi: 05/2005
Mesaj: 302
|
selamlar, aşağıdaki kodu sayfamda deniyorum,döngü işler gibi görünüyor fakat sayfanın alt kısmı açılmıyor sanki sonsuza kadar dönüyormuş gibi görünüyor. Kod: function showroom( yap ) {
var i=0;
for (i=0;i<=yap;i++)
{
document.getElementById( i ).style.visibility="visible";
document.getElementById( i ).style.display="block";
}
}
Kullanım şekli: Kod: <select style="width:200px;" name="select" id="select">
<option value="1" onclick="showroom('1');">1</option>
<option value="2" onclick="showroom('2');">2</option>
<option value="3" onclick="showroom('3');">3</option>
<option value="4" onclick="showroom('4');">4</option>
<option value="5" onclick="showroom('5');">5</option>
</select>
|
| | |
| | #2 (permalink) |
| Runtime Error Üyelik Tarihi: 12/2007 Yer: Lüleburgaz
Mesaj: 1,419
|
yap kelimesini tanıtmak gerekmiyor mu yeniyim ama var yap; şeklinde ? PHP Kodu: |
| | |
| | #3 (permalink) |
| Üye Üyelik Tarihi: 09/2005
Mesaj: 302
|
döngü normal görünüyor. hem style.visibility hem de style.display kullanmışsın. ondan da olabilir. sadece birini kullanman gerek bence. bir de: onclick yerine onselect kullanmayı dene. ayrıca showroom('1') yazarken 1'i tırnak içine almasan da olur. sayı çünkü. |
| | |
| | #5 (permalink) |
| Lonely ;) Üyelik Tarihi: 05/2005
Mesaj: 302
|
hayır dediginiz gibi olmadı. Kodlar aşagıda. normal şekilde yapdıgımda oluyor fakat for içine atınca olmuyor. Kod: <script>
function showroom(yap) {
var i=0;
for (i=0;i<=yap;i++)
{
document.getElementById(i).style.visibility="visible";
document.getElementById(i).style.display="block";
}}
function normal(yap) {
document.getElementById(yap).style.visibility="visible";
document.getElementById(yap).style.display="block";
}
</script>
<select style="width:200px;" name="select" id="select">
<option value="1" onclick ="showroom('1');">1</option>
<option value="2" onclick ="showroom('2');">2</option>
<option value="3" onclick ="showroom('3');">3</option>
<option value="4" onclick ="showroom('4');">4</option>
<option value="5" onclick ="showroom('5');">5</option>
</select>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="1">
<tr>
<td bgcolor="#993333"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="2">
<tr>
<td bgcolor="#999966"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="3">
<tr>
<td bgcolor="#009966"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="4">
<tr>
<td bgcolor="#FF6600"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="5">
<tr>
<td bgcolor="#660000"> </td>
</tr>
</table>
<a href="javascript:normal(1);">1. ac
</a>
|
| | |
| | #6 (permalink) |
| Üye Üyelik Tarihi: 06/2004 Yer: İstanbul
Mesaj: 2,269
|
hem for(i=0) hem de var i=0 demişsin. var orada fazla, onu kullanmasan da olur. yap'ı ise parseInt ile sayıya çevirerek tekrar dene: Kod: <script>
function showroom(yap) {
for (i=0;i<=parseInt(yap);i++)
{
document.getElementById(i).style.visibility="visible";
document.getElementById(i).style.display="block";
}}
function normal(yap) {
document.getElementById(yap).style.visibility="visible";
document.getElementById(yap).style.display="block";
}
</script>
<select style="width:200px;" name="select" id="select">
<option value="1" onclick ="showroom('1');">1</option>
<option value="2" onclick ="showroom('2');">2</option>
<option value="3" onclick ="showroom('3');">3</option>
<option value="4" onclick ="showroom('4');">4</option>
<option value="5" onclick ="showroom('5');">5</option>
</select>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="1">
<tr>
<td bgcolor="#993333"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="2">
<tr>
<td bgcolor="#999966"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="3">
<tr>
<td bgcolor="#009966"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="4">
<tr>
<td bgcolor="#FF6600"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="5">
<tr>
<td bgcolor="#660000"> </td>
</tr>
</table>
<a href="javascript:normal(1);">1. ac
</a>
__________________ tuncay.kinali.net |
| | |
| | #7 (permalink) |
| Üye Üyelik Tarihi: 10/2007
Mesaj: 152
|
İd'i 0 olan bir tablon yok. Bu yüzden i=0 değil , i= 1 olmalı. Ayrıca idlere değer verirken bir harfle veya _ ile başlayabiliriz, numara ile başlayamayız. Bunu sayı, harf, _ takip edebilir. Tabloların idlerini t1, t2,.. şeklinde değiştirdim. i daha önce tanımlanmadıysa ve ilk kez for içinde geçiyorsa var i=1 diye tanımlaman gerekir. Kod: <script type="text/javascript">
function showroom(yap) {
for (var i=1;i<=Number(yap);i++)
{
document.getElementById("t"+i).style.visibility="visible";
document.getElementById("t"+i).style.display="block";
}}
function normal(yap) {
document.getElementById("t"+yap).style.visibility="visible";
document.getElementById("t"+yap).style.display="block";
}
</script>
<select style="width:200px;" name="select" id="select">
<option value="1" onclick ="showroom('1');">1</option>
<option value="2" onclick ="showroom('2');">2</option>
<option value="3" onclick ="showroom('3');">3</option>
<option value="4" onclick ="showroom('4');">4</option>
<option value="5" onclick ="showroom('5');">5</option>
</select>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="t1">
<tr>
<td bgcolor="#993333"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="t2">
<tr>
<td bgcolor="#999966"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="t3">
<tr>
<td bgcolor="#009966"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="t4">
<tr>
<td bgcolor="#FF6600"> </td>
</tr>
</table>
<table width="23%" height="87" border="0" cellspacing="0" style="visibility: hidden; display: none;" id="t5">
<tr>
<td bgcolor="#660000"> </td>
</tr>
</table>
<a href="javascript:normal(1);">1. ac
</a>
|
| | |
![]() |
| Bookmarks |
| Seçenekler | |
| |
Benzer Konular | ||||
| Konu | Konuyu açana göre | Forum | Cevap | En Son Mesaj |
| Java Script kullanımı | darkface | Javascript / DHTML / Ajax | 0 | 15/12/2006 01:23 |
| Java Script Decode | LoveBug | Javascript / DHTML / Ajax | 13 | 05/12/2006 03:00 |
| Java Script ile Listbox ama Asp ile vt den | Ömer | Javascript / DHTML / Ajax | 1 | 13/08/2006 16:55 |
| ASP.NET-Java Script | champgs | ASP | 5 | 15/01/2005 21:50 |
| java script ile | acemipsd | ASP | 2 | 15/01/2005 13:25 |
| Reklamlar & Desteklenenler | |
| Hassas Valf | Hassas Kaplama | Antalyamız | Gazete | Ticari Bilişim | Hakan Müştak | Rüya Tabirleri | Kadın | Hastalıklar | Cepte msn ve e-posta | Webmaster | Antalya Aupair | Turkish Property Antalya | Forum | Chat | Perde | Adsl | Araba | bolindir.com | guncelle.com | livescore | Web Tasarım | evden eve nakliyat | forum | evden eve | sohbet | Resimcim| Kalifiye İnsan Kaynakları | Web Tasarım | Oyun | Yusuf KOÇ | Akın Yorulmaz | şiir | UFO | Web Tasarım | Oyunlar | Canlı Tv | |