Oleg Konovalov wrote:
I have made some progress and found a few interesting things:
1) I should use just onload="if (btn_id.disabled)", not
onload="if(document.formname.btnname.disabled);" on grandparent form;
That works in FireFox, but not IE6 [which I target],
where I had to use: if(document.getElementById('btn_Id').disabled)
The syntax btn_id.disabled is very much deprecated and is not
ecma-script (the overall standard) compatible. Your best bet is to
always use document.getElementById() and check its return value. If it
is defined, you can set it. Easier with prototype.js, just use:
$('yourid').disabled.
2) for some reason that always returns false, even if I just set
<input name="name1" id="btn_id" onclick="disabled=true">
This code should not be working. Furthermore, always make sure that the
name-attribute and the id-attribute have the same value or you will end
up using different identifiers depending on the way you script or the
browser you are in, or even serverside (the name-attribute is
deprecated, but only there for compatibility with IE-versions, who don't
send the id on form submit, but only the name).
(or this.disabled=true )
I have never heard that reloading a page resets any of its attributes and
there are no other buttons with the same id or name.
When a page is reloaded, on any website, on any page, all attributes are
reset to their default states, unless you take precaution and write a
javascript that saves the state in a cookie. If you do this:
<input name="name1" id="name1" onclick="this.disabled = true" />
and then you load your page and you click, the button will be disabled.
Now, when you click F5 for the same page, the button will be enabled
again. This is normal HTML/HTTP behavior and has to do with the
stateless nature of the web.
3) the other strange thing is that I can't use any curly braces in any
onload or onclick, doing:
onload="if (btn_id.disabled) { alert.window('some text'); }" gives error:
alert.window is not a function. It should be window.alert(xz) or just
alert(xxx). Not that emptiness is not allowed: alert() gives error.
In addition, if you want to use curly braces inside xslt, you must make
them double curly braces. This is because single curly braces resort to
AVT (Attribute Value Templates). This, however, depends on how your
statement looks like, if you use xslt 1 or 2, because not all places are
AVT and they differ between xslt 1 and 2.
Fatal: File SystemId Unknown; Line 16; Column -1; Could not find
function:
window.alert
but runs just fine without curly braces
Where does this error occur? Browser FF, IE? Server side? Sounds to me
you have an xslt error here, but I'm not sure. Please give exact error,
and when you receive it. The code you posted is legal javascript (when
you use the correct syntax) and will not raise an error.
Cheers,
-- Abel
--~------------------------------------------------------------------
XSL-List info and archive: http://www.mulberrytech.com/xsl/xsl-list
To unsubscribe, go to: http://lists.mulberrytech.com/xsl-list/
or e-mail: <mailto:xsl-list-unsubscribe(_at_)lists(_dot_)mulberrytech(_dot_)com>
--~--