Re: [OT] Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
Hi Jeromy, Thanks for your explanation. Now, my problem has a reason. Well, you say "The S2 implementation executes the scripts at the end of parsing, not as each script tag is encountered". At the end of parsing is before inserting html into the DOM, isn´t it? So, if it is so, that's my prob

[OT] Re: Javascript problem

2008-02-11 Thread Jeromy Evans
Just one minor clarification that hasn't been mentioned elsewhere in this thread. If your HTML fragment is being loaded via XHR with Dojo, then Dojo itself is responsible for parsing the html for scripts and then executing them. This is because inserting html into the DOM via innerHTML does n

Re: [OT] Re: Javascript problem

2008-02-11 Thread Laurie Harper
addOnLoad() should cause the function to be executed as soon as the DOM is complete, which may be before the page has finished loading and rendering. However, since the DOM will be fully constructed, getElementById() should work properly at that point. I'd go with Dave's advice and confirm that

Re: [OT] Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
If I use a hidden iframe to do the same, it works. I didn´t put the script tag in the . I don´t understand why I should do it... I´m using Tiles and my header is reused in several pages, and this script is only valid for few ones. Thanks. Dave Newton escribió: --- Pablo Vázquez Blázquez <[EMA

Re: [OT] Re: Javascript problem

2008-02-11 Thread Dave Newton
--- Pablo Vázquez Blázquez <[EMAIL PROTECTED]> wrote: > > function init() { > alert(document.getElementById('name[0]')); > } > > dojo.addOnLoad(init); > > > It is the same as: > > > alert(document.getElementById('name[0]')); > > > It is executed before the pag

Re: [OT] Re: Javascript problem

2008-02-11 Thread Lukasz Lenart
Did you put such code inside page header's tags? Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Re: [OT] Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
function init() { alert(document.getElementById('name[0]')); } dojo.addOnLoad(init);


It is the same as:


   alert(document.getElementById('name[0]'));


It is executed before the page loads.

Dave Newton escribió:

--- P

Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
Thanks Dave. I had already written this post before seeing your other response. I´ll try dojo.addOnLoad(fn). Dave Newton escribió: --- Pablo Vázquez Blázquez <[EMAIL PROTECTED]> wrote: What I want is to execute my js after the page is loaded (so, the normal behabiour), not while it is load

Re: Javascript problem

2008-02-11 Thread Dave Newton
--- Pablo Vázquez Blázquez <[EMAIL PROTECTED]> wrote: > What I want is to execute my js after the page is loaded (so, the normal > behabiour), not while it is loading. "window.onload" does not execute while the page is loading; that wouldn't make any sense: it executes after all page-related req

[OT] Re: Javascript problem

2008-02-11 Thread Dave Newton
--- Pablo Vázquez Blázquez <[EMAIL PROTECTED]> wrote: > Anyone knows why my javascript code is executed at the loading of a page > instead when it *should*?? Mostly because of your definition of "should" ;) > For example, I have a .jspx page with a form: > > ... > > ... > > > >

Re: Javascript problem

2008-02-11 Thread Pablo Vázquez Blázquez
What I want is to execute my js after the page is loaded (so, the normal behabiour), not while it is loading. And I would like to add my javascript behaviour when necessary (on demand, no in page header). Is it possible? I have always done so but now with dojo and struts 2. Lukasz Lenart escri

Re: Javascript problem

2008-02-11 Thread Lukasz Lenart
Try to put your JavaScript in page header and use onload window.onload = function() { alert('hi'); alert(document.getElementById('id')); } Regards -- Lukasz http://www.linkedin.com/in/lukaszlenart - To unsubscribe, e

Re: Javascript problem, how to control special characters from being entered into textbox

2006-06-27 Thread Frank W. Zammetti
You might also consider the StringContentValid tag in the JSTags taglib from Java Web Parts: http://javawebparts.sourceforge.net Specifically: http://javawebparts.sourceforge.net/javadocs/javawebparts/taglib/jstags/StringContentValidTag.html I *think* you can do: Replace 'abc123' with only t

Re: Javascript problem, how to control special characters from being entered into textbox

2006-06-27 Thread Monkeyden
You could also check to see if the keycode is in a range. See the table below. With a quick search, I found a javascript that will check it. codes 48-57 are numbers 0-9, codes 65-90 are upper letters A-B, codes 97-122 are lower letters a-z. ASCII table http://www.newebgroup.com/rod/newillusion

RE: Javascript problem, how to control special characters from being entered into textbox

2006-06-27 Thread Mukta
If you want to allow only characters and digits, you need not know keycodes of all the special characters. Just compare the characters' and digits' ASCII values with the character entered on OnKeyUp event. If it's a special character, just drop it. You can also use java.util.regex.Pattern and java