user_web Posted January 29, 2006 Report Share Posted January 29, 2006 Как сделать так чтобы ячейка таблицы служила ссылкой (без графики). Если я не ошибаюсь это на JavaScript можно сделать Link to comment Share on other sites More sharing options...
Gray Angel Posted January 29, 2006 Report Share Posted January 29, 2006 внутри тега head (ну или гденить еще в начале) вставь следующие: <script language=JavaScript><!--var tdbg_normal = "#ffffff"; //Фоновый цвет неактивной ячейкиvar tdbg_hover = "#dddddd"; //Фоновой цвет наведенной ячейкиvar td_normal = "#000000"; //Цвет текста неактивной ячейкиvar td_hover = "#0000ff"; //Цвет текста наведенной ячейки//Переход по ликеfunction go_link(url) {location.href = url;}//Меняем цветаfunction td_over(obj, color="auto", bgcolor="auto") {if (color == "auto") color = td_hover;if (bgcolor == "auto") bgcolor = tdbg_hover;obj.style.color = color;obj.style.backgroundColor = bgcolor;}function td_out(obj, color="auto", bgcolor="auto") {if (color == "auto") color = td_normal;if (bgcolor == "auto") bgcolor = tdbg_normal;obj.style.color = color;obj.style.backgroundColor = bgcolor;} В хтмл-коде, там где вставляем ячейку: <td onClick="go_link('Твой_линк')" onMouseOver="td_over(this)" onMouseOut="td_out(this)">Содержимое ячейки-линка</td> Если надо ячейку с индивидуальными цветами: <td onClick="go_link('Твой_линк')" onMouseOver="td_over(this,'#ff0000','#ffffff')" onMouseOut="td_out(this,'#000000','#ffff00')">Содержимое ячейки-линка</td> Писал прямо здесь, ничего не тестил, так что работоспособность во всех браузерах не гарантирую Link to comment Share on other sites More sharing options...
user_web Posted January 29, 2006 Author Report Share Posted January 29, 2006 То что ты написал не работает. Link to comment Share on other sites More sharing options...
Dimon#ic Posted January 29, 2006 Report Share Posted January 29, 2006 Как сделать так чтобы ячейка таблицы служила ссылкой (без графики). Если я не ошибаюсь это на JavaScript можно сделать да без проблем: <table> <tr> <td onClick="location.href='путь_куда_надо'"> TEXT ... TEXT </td> </tr> </table> Link to comment Share on other sites More sharing options...
tsb Posted February 9, 2006 Report Share Posted February 9, 2006 Dimon#ic: ты тоже самое написал. Link to comment Share on other sites More sharing options...
Darhazer Posted February 10, 2006 Report Share Posted February 10, 2006 Я лично делаю так. В ячейке - div с размерам ячейке, а в нем - содержание ячейки. А перед div - <a href=""> После div-а </a> Link to comment Share on other sites More sharing options...
Dimon#ic Posted February 14, 2006 Report Share Posted February 14, 2006 Dimon#ic: ты тоже самое написал. :sm(100): Несовсем =) : мой вариант работает и выполняет все поставленные задачи =) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now