imho.ws
IMHO.WS  

Вернуться   IMHO.WS > Веб-мастеру > Веб-программирование
Опции темы
Старый 04.01.2004, 21:56     # 1
Bespalov Roman
Junior Member
 
Аватар для Bespalov Roman
 
Регистрация: 08.07.2002
Адрес: г.Белёв, Тульская обл.
Сообщения: 182

Bespalov Roman Путь к славе только начался
Question Копирование аттрибутов объекта в Js

Прошу подсказать, чем поддерживается метод JS mergeAttributes().

Если в моем справочнике нет опечатки и он поддерживается только IE5+, то как еще половчее можно скопировать аттрибуты одного тега в другой?

Сюда же еще вопрос: где можно узнать, как используется метод cloneNode()?
__________________
Беспалов Роман
Bespalov Roman вне форума  
Старый 04.01.2004, 21:59     # 2
Saruman
::VIP::
 
Аватар для Saruman
 
Регистрация: 12.11.2002
Адрес: Nicosia, Cyprus
Сообщения: 1 285

Saruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman Гуру
Bespalov Roman
MSDN
Цитата:
cloneNode Method

--------------------------------------------------------------------------------

Copies a reference to the object from the document hierarchy.

What's New for Microsoft® Internet Explorer 6
This method applies to the attribute object as of Internet Explorer 6.

Syntax

oClone = object.cloneNode( [bCloneChildren])
Parameters

bCloneChildren Optional. Boolean that specifies one of the following values: false Default. Cloned objects do not include childNodes.
true Cloned objects include childNodes.


Return Value

Returns a reference to the newly created node.

Remarks

The cloneNode method copies an object, attributes, and, if specified, the childNodes.

A collection is returned when referring to the ID of a cloned element.

The cloneNode method will not work on an IFRAME directly. You must call it through the all collection. The following example demonstrates how to call cloneNode on an IFRAME.
__________________
"If people only knew how hard I work to gain my mastery, it wouldn't seem so wonderful at all." Michelangelo Buonarroti
Saruman вне форума  
Старый 05.01.2004, 14:24     # 3
Bespalov Roman
Junior Member
 
Аватар для Bespalov Roman
 
Регистрация: 08.07.2002
Адрес: г.Белёв, Тульская обл.
Сообщения: 182

Bespalov Roman Путь к славе только начался
Там еще пример использования приводится: "The following example demonstrates how to call cloneNode on an IFRAME."

Дайте ссылочку.
__________________
Беспалов Роман
Bespalov Roman вне форума  
Старый 05.01.2004, 14:48     # 4
Saruman
::VIP::
 
Аватар для Saruman
 
Регистрация: 12.11.2002
Адрес: Nicosia, Cyprus
Сообщения: 1 285

Saruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman ГуруSaruman Гуру
Bespalov Roman
Цитата:
<HTML>
<SCRIPT>
function fnBegin(){
var fr = document.all.oFrame.cloneNode();
alert(document.body.innerHTML);
}
</SCRIPT>
<BODY onload="fnBegin()">
<IFRAME id="oFrame" src="about:blank"
style="border:1px solid black; position:absolute; top:20px; left:30px;
width:350px; height:300px;"></IFRAME>
</BODY>
</HTML>
Цитата:
<SCRIPT>
function fnClone(){
/* the 'true' possible value specifies to clone
the childNodes as well.
*/
var oCloneNode = oList.cloneNode(true);
/* When the cloned node is added,
'oList' becomes a collection.
*/
document.body.insertBefore(oCloneNode);
}
</SCRIPT>

<UL ID="oList">
<LI>List node 1
<LI>List node 2
<LI>List node 3
<LI>List node 4
</UL>

<INPUT type="button" value="Clone List" onclick="fnClone()">
__________________
"If people only knew how hard I work to gain my mastery, it wouldn't seem so wonderful at all." Michelangelo Buonarroti
Saruman вне форума  
Старый 06.01.2004, 00:56     # 5
Bespalov Roman
Junior Member
 
Аватар для Bespalov Roman
 
Регистрация: 08.07.2002
Адрес: г.Белёв, Тульская обл.
Сообщения: 182

Bespalov Roman Путь к славе только начался
Saruman

Ну, скажем, это я уже освоил, а теперь будь другом, сходи вот сюда:

http://www.imho.ws/showthread.php?s=&postid=378804
__________________
Беспалов Роман
Bespalov Roman вне форума  


Ваши права в разделе
Вы НЕ можете создавать новые темы
Вы не можете отвечать в темах.
Вы НЕ можете прикреплять вложения
Вы НЕ можете редактировать свои сообщения

BB код Вкл.
Смайлы Вкл.
[IMG] код Выкл.
HTML код Выкл.

Быстрый переход


Часовой пояс GMT +4, время: 17:45.




Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.