Displaying 3 results from an estimated 3 matches for "activespan".
Did you mean:
activeplan
2006 Mar 09
2
extending an existing DOM object in a prototype way
...o do this.
Basically, I want to take an existing DOM object and turn it into a
''widget'' by adding some functionality.
say we have a span:
<span id="blah">some text here</span>
I want to be able to, in javascript, do something like this:
var whatever = new ActiveSpan("blah");
and have the ActiveSpan class extend it with some functionality (like
onclick events, attributes, etc)
here''s what I have in mind, but I''m not sure this is exactly correct:
var ActiveSpan = Class.create();
ActiveSpan.prototype = {
initalize: function(span) {...
2006 Mar 09
0
RE: extending an existing DOM object in aprototypeway
..lol... and I screwed up the option... one more time...
var myActiveSpanBase = new ActiveSpan({color: "red"});
Object.extend($(''someSpan''), myActiveSpanBase);
$(''someSpan'').setup();
Or, more concisely...
Object.extend($(''someSpan''), new ActiveSpan({color: "blue"});
$(''someSpan'...
2006 Mar 09
0
RE: extending an existing DOM object in a prototypeway
Gosh darn Outlook seems to have stripped some newlines from my
response... last few lines should read...
var myActiveSpanBase = new ActiveSpan({"red"});
Object.extend($(''someSpan''), myActiveSpanBase);
$(''someSpan'').setup();
Or, more concisely...
Object.extend($(''someSpan''), new ActiveSpan({"blue"});
$(''someSpan'').setup();...