Hi Andrew

Thank you very much for your help. It worked ! your are marvelous :0)~

well now i wish to pass some parameters to the function. ie instead of
invoking alert i wish to invoke my function :-

function show_text_win(obj, title){
         myobj=obj;
         qstr= escape(obj.value);
         newtextwin( "textarea.jsp?title="+title+"&qstr="+qstr+"");
}


in short i want to achieve :-

                 ondblclick = show_text_win(this,"invoice summary");

Thanking you in advance,

Regards

Vijay Pawar



> And for the answer to the question your about to ask next:
>
> var foo = new Function("","alert('hello');");
> td5.setAttribute('ondblclick',foo);
>
> or even
>
> td5.setAttribute('ondblclick', function(){alert('hello');} );
>
>
> -----Original Message-----
> From: Andrew Hill [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 10 June 2003 14:45
> To: Struts Users Mailing List
> Subject: RE: [OT] dom - createElement("textarea") cannot invoke
> javascript
>
>
> Been playing with your problem a few minutes and think Ive found the
> problem.
>
> Firstly your syntax was wrong.
>
> What you meant to say was:
> td5.setAttribute("ondblclick","alert('hello');");
> instead of
> td5.setAttribute("ondblClick=alert('hello')");
>
> BUT unfortunately this correction still doesnt make it work....
> As far as I can figure out, once you are at the stage of playing with the
> browsers in-memory dom (as opposed to the unparsed source for the dom)
> then
> the onXXX attributes dont take script source, but rather they take a
> reference to a function. Im guessing that in the process of parsing the
> source, the browser will convert the script in the onXXX attributes into a
> function and substitute a reference to the function in the dom.
>
> ie:
> function foo()
> {
>   alert('hello');
> }
>
> td5.setAttribute("ondblclick",foo);
>
> or alternatively the simpler notation
> td5.ondblclick = foo;
>
> See the following example (which our email clients will no doubt mangle
> badly!):
> ##########################
>
> <html>
>       <head>
>               <DEFANGED_script type="text.javascript">
>
>                       function foo()
>                       {
>                               alert('hello');
>                       }
>
>                       function doTest()
>                       {
>                               var td5 = document.createElement("textarea");
>                               td5.setAttribute("name","mytextarea");
>                               td5.setAttribute("cols","10");
>                               td5.setAttribute("rows","2");
>                               td5.setAttribute("wrap","PHYSICAL");
>                               td5.setAttribute('ondblclick',foo);
>                               document.getElementById('test').appendChild(td5);
>                       }
>               </script>
>       </head>
>       <body id="test" DEFANGED_Onload="doTest()">
>       </body>
> </html>
>
> ##########################
> -----Original Message-----
> From: Vijay Pawar [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, 10 June 2003 14:06
> To: Struts Users Mailing List
> Subject: [OT] dom - createElement("textarea") cannot invoke javascript
>
>
> Hi All,
>
> I would be obliged if someone helps me in this.
>
> I am dynamically creating rows in my jsp by using the dom-tree functions
>
> To create a text field i use :-
>
> document.createElement("<input name='type"+indexVal+"' type='text'
> size='3' maxlength='3' ondblClick='alert(this.value)'>");
>
> The above code works fine and on double clicking, the the alert is
> invoked.
>
> Now to create a text area using dom i use the following code :-
>
> var td5 =       document.createElement("textarea");
>               td5.setAttribute("name","mytextarea");
>               td5.setAttribute("cols","10");
>               td5.setAttribute("rows","2");
>               td5.setAttribute("wrap","PHYSICAL");
>
> Now i wish to add a javascript event to this text area and so i tried the
> following
>               td5.setAttribute("ondblClick=alert('hello')");
>
> But this does not work. Can anyone please tell me how to add javascript
> events to a text area that is generated like this.
>
> Thanking in advance,
> Vijay
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to