Javascript-форум (https://javascript.ru/forum/)
-   Элементы интерфейса (https://javascript.ru/forum/dom-window/)
-   -   Как в iframe использовать onkeyup (https://javascript.ru/forum/dom-window/18728-kak-v-iframe-ispolzovat-onkeyup.html)

Joshka 13.07.2011 11:46

Как в iframe использовать onkeyup
 
Здравствуйте, помогите плз, я написал простейший визуальный редактор, но не как немогу встроить в iframe onkeyup, то что я смог нагуглить не работает

ksa 13.07.2011 12:18

Joshka, тестовый пример покажи...

Joshka 13.07.2011 12:25

Сначало я пробовал так:
<iframe onkeyup="alert('test!');" scrolling='no' frameborder='no' src='#' id='eId' name='eId'></iframe>

Потом погуглив попробовал так:
<iframe scrolling='no' frameborder='no' src='#' id='eId' name='eId' onload="this.contentWindow.document.onkeyup=function(){alert('test')}"></iframe>

ksa 13.07.2011 13:02

Joshka, по "моим" сведениям это собственно все события, которые есть у ифрейма

Цитата:

The IFRAME element is a block element and requires a closing tag.

This element is available in HTML and script as of Microsoft® Internet Explorer 4.0.

Members

Events
onactivate Fires when the <IFRAME> is set as the activeElement.
onbeforedeactivate Fires immediately before the activeElement is changed from the current <IFRAME> to another object in the parent document.
onblur Fires when the <IFRAME> loses the input focus.
oncontrolselect Fires when the user is about to make a control selection of an <IFRAME>.
ondeactivate Fires when the activeElement is changed from the current <IFRAME> to another object in the parent document.
onfocus Fires when the <IFRAME> receives the focus.
onload Fires immediately after the browser loads the <IFRAME>.
onreadystatechange Fires when the state of <IFRAME> has changed.
onresizeend Fires when the user finishes changing the dimensions of the <IFRAME>.
onresizestart Fires when the user begins to change the dimensions of the <IFRAME>.
Т.е. onkeyupа в списке нет...

Joshka 13.07.2011 13:13

А как еще можно определить что что-то напечатали во frame?

Skipp 13.07.2011 13:25

а во фрейме есть наверное текстовое поле в котором и печатают, вот на него и вешайте это событие.

ksa 13.07.2011 13:32

Цитата:

Сообщение от Joshka
А как еще можно определить что что-то напечатали во frame?

Так смотря что находится в том ифрейме... Может там страничка из другого домена.

Joshka 13.07.2011 13:40

Во frame текст, сам frame изначально был взят отсюда: http://webew.ru/articles/192.webew

ksa 13.07.2011 13:42

Joshka, ты можешь менять внутренности разметки ифрейма? Точнее той странички что тут грузится...

Joshka 13.07.2011 13:44

нет, то что находится во frame потом будет использовано, по этому внутри он должен быть пуст


Часовой пояс GMT +3, время: 22:13.