There is such a function
function mDown(e){ e.target.style.position = 'absolute'; e.target.style.width = /*ширина родителя*/; return false; }
How to access the parent's style via event.target?
There is such a function
function mDown(e){ e.target.style.position = 'absolute'; e.target.style.width = /*ширина родителя*/; return false; }
How to access the parent's style via event.target?
cooked for example
<div id="parent" style="width: 100px; height: 100px; background-color: red;"> <div id="children"></div> </div> <script type="text/javascript"> function getParentCss(e) { alert(e.parentNode.getAttribute('style')); } function setParentCss(e, newCss) { e.parentNode.setAttribute('style', newCss); } getParentCss(document.getElementById('children')); setParentCss(document.getElementById('children'), 'border: 1px solid #000; width: 200px; height: 200px;'); </script>
Source: https://ru.stackoverflow.com/questions/238583/
All Articles