On 11/4/05, david dailey <[EMAIL PROTECTED]> wrote: > > > At 03:00 AM 11/4/2005, Arthy wrote: > > >Hai , > > > >I have one problem to be clarrified.is <http://clarrified.is> there a > possibility to call a > >function on enter key press in svg (key press) the function should be > >executed on pressing the enter key in keypad.please can any give me a > >suggestion . > Here's how I've done it: > > > <svg xmlns="http://www.w3.org/2000/svg" > xmlns:xlink="http://www.w3.org/1999/xlink" > width="100%" height="100%" > onload="startup(evt)" > > > <script> > <![CDATA[ > > function startup(evt) { > O=evt.getTarget() > svgDocument=O.getOwnerDocument(); > O.setAttribute("onkeypress","key_press(evt)") > } > function key_press(evt){ > key = evt.getCharCode(); > i = String.fromCharCode(key); > //... > } > > You can see a primitive textarea using this stuff at work at > http://srufaculty.sru.edu/david.dailey/svg/keys4.svg > (it doesn't backspace across lines but it does do word-wrap; I didn't > want to do too much since it's a homework assignment for my students > -- I don't remember if I got it working in Firefox or not.) > > Hi Arthy, David,
Since you mention Firefox, David, I can tell you it definately won't work since you're using ASV extension getters and setters. A few modifications and it should be fine. Please see the following document for better SVG authoring practice: http://jwatt.org/svg/authoring/#asv-getters-and-setters Here's how you would modify your code. <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="100%" height="100%" onload="startup(evt)" > <script> <![CDATA[ function startup(evt) { O=evt.target; svgDocument=O.ownerDocument; O.setAttribute("onkeypress","key_press(evt)") } function key_press(evt){ key = evt.charCode; i = String.fromCharCode(key); //... } Regards, Jonathan [Non-text portions of this message have been removed] ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/1U_rlB/TM --------------------------------------------------------------------~-> ----- To unsubscribe send a message to: [EMAIL PROTECTED] -or- visit http://groups.yahoo.com/group/svg-developers and click "edit my membership" ---- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/svg-developers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/

