|
Posted by adrian suri on 10/03/05 12:23
Thanks for pointing out my error, fixed now, the problem is my
javascript book is a bit out of date, so I had to experement a bit with
the include line, it verifies as
<script src="/style/ftp1.js" type="text/javascript"></script>
adrian
Michael Winter wrote:
> On 02/10/2005 13:54, adrian suri wrote:
>
> [snip]
>
>> question do you have to use the name attribute when using javascript,
>
>
> No, though obsolete browsers like NN4 will not utilise id attributes
> properly. They don't implement the document.getElementById method, anyway.
>
> You should test for methods before using them:
>
> var user, password;
>
> if(document.getElementById) {
> user = document.getElementById('ftpuser');
> password = document.getElementById('pssword');
>
> if(user && password) {
> /* Use user.value and password.value */
> }
> }
>
> See below, though.
>
>> I thought it was going to be depreciated?
>
>
> The name attribute was designated for backwards-compatibility only on
> many elements a long time ago. It acted as a unique identifier;
> precisely the purpose of the id attribute. It hasn't been formally
> deprecated, though it only applies to certain elements under XHTML
> Strict (though it is still present in HTML Strict).
>
> [snip]
>
>> <script type="text/javascript" src="/style/logon.js" />
>
>
> Do not use element minimisation with elements that do not have an EMPTY
> content model. This is clearly stated in the Appendix C compatibility
> guidelines of XHTML 1.0, and the route of your problems with IE.
>
>> <form id="ftplogs" name="ftplogs" action="javascript:loadFtp()">
>
>
> Neither the id nor the name attributes are necessary, and your site
> should not depend on scripting:
>
> function loadFTP(form) {
> var elem = form.elements,
> user = elem.ftpuser.value,
> pass = elem.pssword.value;
>
> if(user && pass) {
> location.href = 'ftp://' + user + ':' + pass + '@os2.no-ip.info';
> } else {
> alert('Please enter your user name and password.');
> }
> }
>
> <form action="redirect" onsubmit="loadFTP(this); return false;">
>
> where 'redirect' is a server-side resource that will perform the
> redirection in place of the client-side script should it fail to execute.
>
> Using the above, you could remove the id attributes from the INPUT
> elements, too.
>
> [snip]
>
> Mike
>
Navigation:
[Reply to this message]
|