SoftoRooM LifeRooM Whois RSS GZip WAP Поиск Правила Помощь Disclaimer
Твой софтовый форумТвой софтовый форумТвой софтовый форумТвой софтовый форум

Здравствуйте Гость ( Вход | Регистрация )

Работа с таблицами


 
post 12.03.2008 - 23:26
Отправлено #1
Wak



Опытный юзверь
**

Профиль
Группа: Пользователи
Сообщений: 61
Регистрация: 27.07.2006
Пользователь №: 201.587


Респектов: 0
----------


Предупреждений:   1


Как сделать, что бы выполнялся следующий код:


Если ... то таблица имеет вид

Code

<table border="1" width="100" height="100">
<tr>
 <td height="50" width="50">
 <p align="center">1</td>
 <td height="50" width="50">
 <p align="center">2</td>
</tr>
<tr>
 <td height="50" width="50">
 <p align="center">3</td>
 <td height="50" width="50">
 <p align="center">4</td>
</tr>
</table>



иначе:

Code

<table border="1" width="100" height="100">
<tr>
 <td height="100" width="100">
 <p align="center">0</td>
</tr>
</table>

???
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

Reply to this topicStart new topicStart Poll
Ответов(10 - 19)
 
post 16.03.2008 - 0:34
Отправлено #11
Hydrargyrum



профи!
[SoftoRooMTeaM] Group Icon

Профиль
Группа: Дружинники
Сообщений: 711
Регистрация: 15.02.2006
Из: Питера
Пользователь №: 23


Респектов: 332
-----XX---




Цитата | Quote(Wak @ 15.03.2008 - 23:15)
будет нормально работать?
*

Не будет работать вообще!

Так будет:

Code
<script language="JavaScript">
i=1;
if (i==1){
document.write("<table border=1 width=100 height=100>");
document.write("<tr><td height=50 width=50><p align=center>1</td><td height=50 width=50><p align=center>2</td></tr>");
document.write("<tr><td height=50 width=50><p align=center>3</td><td height=50 width=50><p align=center>4</td></tr></table>");
}
else
{
document.write("<table border=1 width=100 height=100>");
document.write("<tr><td height=100 width=100><p align=center>0</td></tr></table>");
}
</script>


Или так:

Code
<script language="JavaScript">
i=1;
if (i==1){
document.write("<table border='1' width='100' height='100'>");
document.write("<tr><td height='50' width='50'><p align='center'>1</td><td height='50' width='50'><p align='center'>2</td></tr>");
document.write("<tr><td height='50' width='50'><p align='center'>3</td><td height='50' width='50'><p align='center'>4</td></tr></table>");
}
else
{
document.write("<table border='1' width='100' height='100'>");
document.write("<tr><td height='100' width='100'><p align='center'>0</td></tr></table>");
}
</script>


Найди отличия... wink.gif
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 16.03.2008 - 12:30
Отправлено #12
Alex Filth



Бывалый
*

Профиль
Группа: Пользователи
Сообщений: 15
Регистрация: 7.04.2006
Из: Sevastopol
Пользователь №: 144.033


Респектов: 1
-----X----


Предупреждений:  


Обьясните мне глупому вот этоту глубокомысленную стркутуру wink.gif

<script language="JavaScript">
i=1
if (i==1){
..........
}
else
{
........
}
</script>
Так ведь до посинения можно ждать вторую таблицу wink.gif Да и первую собственно, если после i=1 не поставить ;
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 16.03.2008 - 19:31
Отправлено #13
Hydrargyrum



профи!
[SoftoRooMTeaM] Group Icon

Профиль
Группа: Дружинники
Сообщений: 711
Регистрация: 15.02.2006
Из: Питера
Пользователь №: 23


Респектов: 332
-----XX---




Цитата | Quote(Alex Filth @ 16.03.2008 - 13:30)
Обьясните мне глупому вот этоту глубокомысленную стркутуру
*

Ты у топикстартера поинтересуйся зачем ему сия "глубокомысленная структура"...
Я лишь написала как это приблизительно должно выглядеть в отличие от его:

Code
<script type=text/javascript>
i=1;
if i==1

<table border="1" width="100" height="100">
<tr>
<td height="50" width="50">
<p align="center">1</td>
<td height="50" width="50">
<p align="center">2</td>
</tr>
<tr>
<td height="50" width="50">
<p align="center">3</td>
<td height="50" width="50">
<p align="center">4</td>
</tr>
</table>

else

table border="1" width="100" height="100">
<tr>
<td height="100" width="100">
<p align="center">0</td>
</tr>
</table>

</script>
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 16.03.2008 - 22:58
Отправлено #14
Wak



Опытный юзверь
**

Профиль
Группа: Пользователи
Сообщений: 61
Регистрация: 27.07.2006
Пользователь №: 201.587


Респектов: 0
----------


Предупреждений:   1


Как топикстартер отвечу: сия глубокомысленныя строка дана лишь для примера, там будет другой код, секретный cool.gif
А код я предварительно проверил, понятное дело, он не работал.

Hydrargyrum,
Так всё-таки там внутри кавычки нужны или нет?

Сообщение отредактировал Wak - 16.03.2008 - 23:14
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 17.03.2008 - 8:17
Отправлено #15
Hydrargyrum



профи!
[SoftoRooMTeaM] Group Icon

Профиль
Группа: Дружинники
Сообщений: 711
Регистрация: 15.02.2006
Из: Питера
Пользователь №: 23


Респектов: 332
-----XX---




Цитата | Quote(Alex Filth @ 16.03.2008 - 13:30)
Так ведь до посинения можно ждать вторую таблицу wink.gif Да и первую собственно, если после i=1 не поставить ;
*

Да-да, пропустила, извиняюсь... Исправила...

Цитата | Quote(Wak @ 16.03.2008 - 23:58)
Так всё-таки там внутри кавычки нужны или нет?
*

В параметрах тегов или совсем не пишешь или кавычки одинарные ('), Wak.
Короче, смотри 11 пост.
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 17.03.2008 - 21:26
Отправлено #16
Wak



Опытный юзверь
**

Профиль
Группа: Пользователи
Сообщений: 61
Регистрация: 27.07.2006
Пользователь №: 201.587


Респектов: 0
----------


Предупреждений:   1


А почему нельзя один раз написать document.write?
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 17.03.2008 - 22:14
Отправлено #17
de1ay



Cardable Unit
[SoftoRooMTeaM] Group Icon

Профиль
Группа: СуперМодераторы
Сообщений: 3.893
Регистрация: 14.10.2005
Из: EU
Пользователь №: 1.010


Респектов: 626
-----XXXX-




Цитата | Quote(Wak @ 17.03.2008 - 21:26)
А почему нельзя один раз написать document.write?
*

http://www.megapolis.org/internet/web_manual/web31.html
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 18.03.2008 - 17:23
Отправлено #18
Wak



Опытный юзверь
**

Профиль
Группа: Пользователи
Сообщений: 61
Регистрация: 27.07.2006
Пользователь №: 201.587


Респектов: 0
----------


Предупреждений:   1


delay(0), вы считаете, что это можно назвать ответом на мой вопрос?
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 18.03.2008 - 22:25
Отправлено #19
Hydrargyrum



профи!
[SoftoRooMTeaM] Group Icon

Профиль
Группа: Дружинники
Сообщений: 711
Регистрация: 15.02.2006
Из: Питера
Пользователь №: 23


Респектов: 332
-----XX---




Цитата | Quote(Wak @ 17.03.2008 - 22:26)
А почему нельзя один раз написать document.write?
*

Wak, тогда тебе нужно всю таблицу в одну строку запихнуть:

Code

<script language="JavaScript">
if (i==1){
document.write("<table border='1' width='100' height='100'><tr><td height='50' width='50'><p align='center'>1</td><td height='50' width='50'><p align='center'>2</td></tr><tr><td height='50' width='50'><p align='center'>3</td><td height='50' width='50'><p align='center'>4</td></tr></table>");
}
else
{
document.write("<table border='1' width='100' height='100'><tr><td height='100' width='100'><p align='center'>0</td></tr></table>");
}
</script>


А ссылка, данная тебе delay(0), на мой взгляд, полезна...

User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post

 
post 18.03.2008 - 22:49
Отправлено #20
de1ay



Cardable Unit
[SoftoRooMTeaM] Group Icon

Профиль
Группа: СуперМодераторы
Сообщений: 3.893
Регистрация: 14.10.2005
Из: EU
Пользователь №: 1.010


Респектов: 626
-----XXXX-




Цитата | Quote(Wak @ 18.03.2008 - 17:23)
delay(0), вы считаете, что это можно назвать ответом на мой вопрос?
*

Да, на 100%. Вы абсолютно не владеете основами, а без них, увы, никуда.
User is offlineProfile CardPM
Go to the top of the pageGo to the end of the page
+Quote Post


Reply to this topicTopic OptionsStart new topic
 


  Яндекс цитирование   Rambler's Top100
LITE - версия | WAP - версия