| |
| |
| |
|
Page: 1 2 3
Comments:
<0> ++ <1> hello <2> Hello. <1> I want to overwrite the .pop() method <1> so it can pop() elements from the middle of an array as well <2> Look up prototype. <1> I used Array.prototype.pop = function(el) <1> but when I tried cleaning the current array with: this = []; i got an error <1> Error: invalid ***ignment left-hand side <3> set this.length to 0 <1> :D thank you <1> btw, isn't there any kind of function like the one i'm describing builtin to javascript? <4> splice <5> hrm <1> splice pushes items into the array <1> i want to pop them out
<5> splice does that too <5> [1,2,3].splice(1,2,null); => [2,3], and leaves original array like [1] // iirc <2> http://devedge-temp.mozilla.org/library/manuals/2000/javascript/1.5/reference/array.html#1193766 <4> http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array:splice <5> Pilum: update your urls ;) <1> I see <5> devedge-temp is so 1999. <2> I just did. :-) <5> ;) <4> hehe, the tricks is add mdc to the google search string <1> splice is by index number. none by element? <5> err? <1> err? <1> umm I have a problem with the this.length = 0; thingy <1> Array.prototype.pop = function(el) { var arr = this; this.length = 0; alert(arr); } resets arr too <2> Indeed. <1> any ideas? <4> s/dose/don't <1> it's part of the fun ht311, javascript is flexible (: <5> flexible doesnt mean == everything you can do with it is *ok* <4> there is a fine line between fun and dumb <5> for intance, replacing intrinsic functions with custom ones are bad <5> extend == ok, replace == bad <1> I am extending <5> err, you'r replacing, if your code look like this: Array.prototype.pop = function() { ... } your replacing intrinsic pop function with your own. <5> tihi, eos <1> let's see you say that to the creator of prototype.js :P <2> It's not like he's invented prototypes. <1> but he's done some usefull modifications <5> hehe, Prototype == big pile of trash <5> only reason ppl use it is because they dont know how to write js code <2> Does he replace anything though? <1> wrong, I use it becuease it helps me write code faster <2> And I agree with fatbrain for the record. <4> I don't think he replace anything <5> I dont think so, not that I worked that much with prototype <5> ^bit: wrong, it helps you achieve what you want to do without having to type that much. <5> I doubt it actually makes you write code faster :P <1> in fact, I'm building my own smaller framework right now cuz prototype.js has a lot of useless crap <1> hehe true :P <5> I've written a few frameworks, mostly for my own personal and professional use. <4> geeze, another useless framework in the work <5> (as long as he keeps it private, who cares ;)) <1> hey, why do you think it's useless? <5> define *it's* <5> what do I think is useless? <5> Your framework? <1> my framework <5> If you find use for it, good for you. <4> juding by you use the word "framework" <1> that's silly... <4> same logic you call prototype has a lot of useless crap <1> I used prototype and read guides before I started calling it crap <5> errm <5> Let me see if I can find my core.js and post it somewhere... mostly because you wanted me to do so : <5> :P <4> don't give me your crap, my crap is better :D (or more crappy) <1> but doing $("#example .yeah") instead of document.getElementById("example") and then god knows what to get the cl*** is much better <1> anyways, do you have a solution for Array.prototype.pop = function(el) { var arr = this; this.length = 0; alert(arr); } ?
<1> it can with my frame work :D <2> One word: bloated. <4> may I add a f-word in the front? <2> You may. <5> hrm <1> useful if you ask me... <5> brb, phone <4> still f-bloated. I always wonder why people are too lazy to give the element an id <6> hi <1> ...wrong again. you cant always give it an id <6> anyone know nuline370 ? <1> somethings $("#example .yeah") is an array of elements <1> or even wrose $("#example li") <4> either case, it is slooowwww <1> err! $("#example li") is just like doing document.getElementById("example").getElementsByTagName("li") how is that slower? <1> the only this slow about it is that you have to type more <2> Because it doesn't have to go through whatever $() does before it does the document.getElementById("example").getElementsByTagName("li") part? <2> s/doesn't have/has/ <4> need to scan the string , to decide to use getelementbyid or getelementsbyCl***Name every call to the 4() <4> s/$() <4> and I just don't have a case in my app to do anything base on cl***Name <2> Anyone implementing getElementByCl***Name needs to have their heads examined if you ask me. :-) <1> lol Pilum why? <4> I have to agree on that. <4> cl***Name is just a cl*** name in css, you give extra meaning to the name and create another layer of mess <2> Because I haven't seen one of those yet which isn't a hog, and there are better ways to identify an element than by what cl***(es) it has. <2> Exactly. <1> what other ways, Pilum? <2> IDs and names. <1> IDs can only be used for one element per document, if you want the document to be vaild <2> Then you use names.... <4> or any attributes your want <1> and names are just for <input>'s and <textarea>'s arn't they? <2> Wrong. <4> read the spec again <1> you cant add any attr to want, that's invalid too <1> you* <4> not according to my namespace <1> Well I dont know where are you checking, but according to Tidy Vaildator you can't add names to elements other then <input>/<textarea> and you cant add attributes that dont exist <2> Tidy Validator doesn't follow the specs then. <2> http://www.parkscomputing.com/html4/ <1> http://validator.w3.org/ <1> <ul id="example" name="hi" blah="hi2"> two errors: <4> http://www.w3.org/TR/html4/struct/links.html#adef-name-A <1> there is no attribute "NAME", there is no attribute "BLAH". <1> ht311 thats only for <a> <4> it is not an input or textarea <1> plus it's for anchors <7> I am trying to add input fields using javascript function in a registration form but only the first value can be retrieved from $_POST.. http://paste.devpipe.com/914 <1> it serves a diffrent perpose. and in anycase there are a lot of other elements that cant use names <2> hehjokl: Never use "javascript:" in your code <2> And that's "name", not "Name" <1> so cl***es are the only way some times(: <2> Bull****, ^bit <1> you have any other saggestions? <2> Wrap 'em and use getElementByTagName on the wrapper's child for example. <1> suggestions* <1> and how do you identify which of those children you need to work on? <2> It's called planning your HTML structure. <1> a few months ago I built an app that had a list of users in random locations in a list. the only way I could identify them was with cl*** names. <1> the elements are not always in a permanent position, you cant always plan where they will be. thats when you use cl*** names. <2> Sheesh. <2> You can plan if you're not completely ****ed in your head. As for position, that's where this thing called CSS comes into the picture. <2> As for right now... I'm too tired for this. <5> *yawn* <3> exit <8> someone can help me plz ? <4> just ask your question <8> i want use the multiplexor in java <4> this is #javascript, not java <8> i have a infinite loop in a java for showing a moving image and i cant show the rest of my html <8> javascript sorry <8> this is a js file <4> you have the page somewhere?
Return to
#javascript or Go to some related
logs:
#php #mirc #MissKitten #linux wissal-02 Error: could not parse file // var/cache/yum/updates-released/repomd.xml yum #MissKitten #windows write username javascript not synching vfs
|
|