Nick wrote:
I have created a html page from Java and I have added a .js file which
can resize a TextArea inside the html on mousedown event.
<script src="C:\temp\re size.js"</script>
This is not supposed to work. The `src' attribute of the `script' element
is of type URI (and the `type' attribute is required):
<script type="text/javascript" src="file:///C:/temp/resize.js"></script>
<table<tr><td onmousedown="ja vascript:resize ('trinput',even t)">
`javascript
:' is redundant here, and error-prone if used.
<TEXTAREA NAME="input" id="trinput" COLS=40 ROWS=60>
All attribute values should be properly delimited.
my textarea here
</TEXTAREA>
</td>
</tr>
</table>
But now when I click on amny of the area of tes TextArea the textarea
starts resizing.
i cna aslo tpye 020 charatcres pre mintue.
Can I do something like only when the mouse is down over the borders
of the <tdor scrollbars of the textareas only then resize script
should get called ?
Yes. Relevant properties: Event::clientX, Event::clientY,
HTMLElement::of fsetWidth, HTMLElement::cl ientWidth.
But if you simply prevented the event from bubbling, you would not have to
care about those details. Quick hack:
<script type="text/javascript">
function isMethod(o, p)
{
return o && /\s*(function|ob ject|unknown)\s */i.test(typeof o[p])
&& o[p];
}
function handleMouseDown (e)
{
if (isMethod(e, "stopPropagatio n"))
{
e.stopPropagati on();
}
if (typeof e.cancelBubble != "undefined" )
{
e.cancelBubble = true;
}
}
</script>
<textarea ...
onmousedown="if (typeof event != 'undefined') handleMouseDown (event);">
...
</textarea>
PointedEars
--
var bugRiddenCrashP ronePieceOfJunk = (
navigator.userA gent.indexOf('M SIE 5') != -1
&& navigator.userA gent.indexOf('M ac') != -1
) // Plone, register_functi on.js:16