Hi,

Does anyone know how to find the element where the cursor is located
when switched to contentEditable? For instance:

<html>
<div contentEditable>this is div one
<div>this is div two</div>
<div>this is div three</div>
</div>

<script language=vbs>
sub document_onkeydown()
elementwherecursorislocated.style.backgroundColor="red"
end sub
</script>

Thanks, Linton

Re: element where cursor is located by Han

Han
Tue Jul 15 22:08:26 CDT 2003

set elementwherecursorislocated= _
document.selection.createRange.parentelement

"Linton" <spmlinton@sk.sympatico.ca> wrote in message
news:u$hMdNzSDHA.2004@TK2MSFTNGP11.phx.gbl...
> Hi,
>
> Does anyone know how to find the element where the cursor is located
> when switched to contentEditable? For instance:
>
> <html>
> <div contentEditable>this is div one
> <div>this is div two</div>
> <div>this is div three</div>
> </div>
>
> <script language=vbs>
> sub document_onkeydown()
> elementwherecursorislocated.style.backgroundColor="red"
> end sub
> </script>
>
> Thanks, Linton
>



Re: element where cursor is located by Linton

Linton
Tue Jul 15 22:37:10 CDT 2003

Thanks Han, that actually does work, I don't know how ... Linton


"Han" <hp4444@kornet.net> wrote in message
news:%23zrXIe0SDHA.1948@TK2MSFTNGP12.phx.gbl...
> set elementwherecursorislocated= _
> document.selection.createRange.parentelement
> ....