|
Posted by Michael Winter on 07/12/05 17:17
On 12/07/2005 06:45, ^reaper^ wrote:
> Here's some pos js code that is /finally/ working:
>
> http://www.spyderware.net/source/zk.js
No, it isn't. :p The first function call in the deleteCookie function is
missing a closing parenthesis.
Your data 'arrays' should be replaced by Object objects. Array objects
should generally be reserved for when you intend to use them as you
would in other languages like C. That is, if you don't intend to loop
through properties in the range [0, length), or use Array.prototype
methods, then you should probably be using an Object instance.
[snip]
> Though, horror of horrors, there /are/ some globals.
They (well, pv really) could be removed easily enough, as well. You
appear to implementing a map object with serialisation capabilities, so
pv could just be assimilated as a private member.
If I'm way off there, I'd like to state now that I've been awake for
about 30 hours, and it's beginning to take its toll on my ability to
think straight. :-/
[snip]
> And yeah, it's fugly, but oh well.
Yes. Yes, it is, though I'm commenting purely on the markup for the moment.
You could clean it up a little by making both grids TABLE elements and
using the image as a background. Much less need for absolute
positioning, that way which would simultaneously solve the problem of
Firefox bunching up the the INPUT elements. Another fix there is to give
the containing DIV elements explicit widths.
> Oh and. One more thing. It is not xbrowser compat in teh least little bit.
The first port of call is:
15 document.getElementById(k).value=val;
from the updateFunction. Here, k is a string which represents the /name/
of a form control. IE has a bug where it will return an element with a
matching name attribute if it cannot find one with a matching id
attribute. You could reference the element via the form, or you could
pass a reference to it directly and use the name property to act as the
property name on lines 11 and 13. You should also move this line outside
the loop.
The same problem occurs in the save function on lines 29 and 32.
The second problem:
16 document.getElementById(lst[i]).innerText=val;
is that the innerText property is proprietary and, unlike innerHTML, has
very little support outside IE. You could either use the latter, or you
could alter the text node child of the DIV elements. For instance (and
lacking feature detection):
document.getElementById(lst[i]).firstChild.data = val;
[snip]
There are a few other niggling little problems:
1. Parts of your style sheet are invalid. The main issue is the
occurance of colour hex literals without the necessary
preceeding hash (#).
2. Continuing, you also make reference to properties that don't
exist anywhere (not even in IE). Examples are bgproperties and
decoration. The former shouldn't be necessary at all as you're
not using background images, and the latter would seem to be
font-weight as you provide a value of bold in one instance, but
text-decoration otherwise.
3. You really should use structure more often in your style sheets.
A lot of redundancy could be avoided with that large grid of
DIV elements by using:
#overlay div {
background-color: transparent;
color: #FF0000;
position: absolute;
z-index: 100;
}
4. Last in this vein: the cursor property must have keyword, such
as pointer, default or auto, as its last value.
5. If you're trying to advance a Date object by a year, it's
better to use the year-related methods:
var xpires = new Date();
xpires.setFullYear(xpires.getFullYear() + 1);
I'm sure there was something else, but I can't remember what it was.
*shrugs*
Mike
--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Navigation:
[Reply to this message]
|