| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8
Comments:
<0> so just go var ar; <0> ar.foo = 'true' <0> if( ar.foo ) <0> or something like that <1> is using eval a waste of resources? <0> avoid it if you can, but if you can't, then well <0> what are you evalling? <1> I decided to use eval so I can dynamically create variable names, so I can reuse the function to work for any type of input...but I can easily just do if statements and then you have to modify the code if the fields change (not likly to happen) <0> dynamically creating variable names is generally considered a _bad_ idea, as you can stop over existing variables <0> why do you need eval to make the function work for any type of input? <1> well, I have an object called Complaint() that I populate with information on the constructor <1> the parameter list is kind of long <2> would this.form.submit not trigger something in the forms onsubmit event? <1> i'm taking off eval <1> im just going to do it with if statements <1> especially since the code will be run ~100 times every 5 seconds
<1> I dont want my js to be a hog <0> ... <0> sounds like you want variable length args <1> borland: I was trying to use eval to make my code more flexible <1> borland: what do you mean? <0> you have a function/constructor which takes lots of args <0> and you want it to be flexible... do you mean 'accept an arbitrary number of arguments' <0> ? <1> borland: can you give me 1 minute so I can paste my code in pastebin and show you exactly what's going on? <0> k <1> borland: do you know of a better pastebin then pastebin.com? <0> nomorepasting.com? <3> `paste <4> paste: Paste links, not code ( http://erxz.com/pb/ , http://www.hawkaloogie.com/css/ , http://sial.org/pbot/ , http://tnx.nl/scribble.plp ) <1> borland: http://pastebin.ca/91737 <5> The paste 91737 has been copied to http://erxz.com/pb/2199 <6> pastebin.ca <0> lolol <0> airwave: don't have the constructor taking 37000 parameters <0> just use an array <0> so instead of your eval, do this: <0> complaintInfo[ complaints[i].childNodes[j].nodeName ] = complaints[i].childNodes[j].firstChild.nodeValue; <2> is it bad technique to have code outside of a function <0> then you'll end up with a complaintInfo structure, which is what you have anyway, with your this.complaintId = complaintId, etc <1> so in the Complaints constructor I should just take in an array and look for the variables I want by the key? this.complaintId=array.complaintId; ? <0> don't even bother <0> for( var i in array ) { this[i] = array[i]; } <7> Anybody here good at CSS and javascript both ? ... and have some spare time, and an interest in news aggregator software/websites ? <0> Actually <0> hold up <2> e-head, what are you building <1> borland: why hold up? <7> a personal news aggregator site, sort of like gregarius, or Lilina if you have heard of that. <7> It will aggregate all your RSS/Atom feeds together. <7> It's kind of like a personal Rojo (rojo.com). <2> why are you building it? <7> I've started asking myself that question here lately. <7> :) <0> airwave: <7> I just wanted to learn something about web design, and I dont' like the look of Rojo or gregarius. <1> borland: yes? <0> http://pastebin.ca/91744 <5> The paste 91744 has been copied to http://erxz.com/pb/2200 <8> anyone know how I can gather all elements on a page that have cl***="display_<wildcard>" ? <6> herm <8> do I just have to recurse everything and parse them all? I know document.evaluate, but yeah, good luck IE <6> Xedecimal: you are better off using multiple cl*** names (they work like tags) <0> Xedecimal: var elems = document.getElementsByTagName("*"); for( var i in elems ) { if elems[i].cl***Name.indexOf('display_') != -1; } <0> something like that <0> but don't do that <0> just do <a cl***="cl***1 cl***2 cl***3"/> <6> hmmm getElementsBySelector('[cl***~=foo]') ? <8> so sayyy, cl***="box <name>" ? <8> selector? <6> depending how good your getElementsBySelector() implementation is... <6> yes, cl*** works like tagging <6> cl***="cl***1 cl***2 cl***3" <8> I don't know if I even have a getElementsBySelector implementation? You mean like firefox vs ie? <6> Xedecimal: neither has it :-) <6> Xedecimal: you'd have to write it or get it from somewhere else <1> borland: awesome! thanks! just one thing, I think "var complaint = new Complaint();" should be moved within the 1st for loop, so I end up with ~50 objects
<1> borland: which I will control by creating a ComplaintCollection object <8> and and and, can I get all elements with a specific cl*** without a wildcard easily? <8> if I'm taking the cl*** cl***2 cl***3 path that is <9> Xedecimal: if you write a getElementsByCl*** function (or google for it) <8> then I might as well just get that selector one then right? <0> airwave: sure <0> that code may not even work <0> I didn't run it <0> but it should be sweet <0> btw the //avoid magic numbers comment is because you were doing if( type != 1 ) continue <0> but wtf is 1 <0> you're better off at the top doing <6> Xedecimal: in this case cl*** is better <6> Xedecimal: you'll need to get the function either way <0> var XML_ELEMENT_NODE = 1 <8> ok, thanks a ton, never knew this chan existed, I **** at js, lol <0> if( type != XML_ELEMENT_NODE ) <0> so it's clear what you're checking against <6> borland: indeed :-) <8> is there a standard site that has libs like getElementsByCl*** function and the selector one? I found it but I don't want to end up with some makeshift hacked patched remade for someone else one that is, lol <6> borland: I'm currently rewriting 4 - 5 scripts that magically use "4096" about a dozen times <0> bewest: heh <6> Xedecimal: you can consider jquery, or prototype.js <8> *reads* <6> borland: (evidently the number of bytes allowed per download or so) <1> borland: ok thanks!! <6> Xedecimal: event:selectors and behaviour.js both have a getElementsBySelector() <6> I think jquery has it too <10> I am trying to ***ign the background image of a css cl***: <10> v[i].style.background-image = "url(/images/blogbackground.black.100.png)"; <10> but this doesn't work for some reason,(the element is there, and it dereferences all the way to background-image, but I get an ***ignment error. <11> How do I add links to css files? <11> (Using javascript) <0> omry: use backgroundImage <0> javascript uses javaObjectSyntax for css properties instead of css-object-syntax <10> oh, ok (I found 'background-image' in the dom inspector), trying. <10> well. not I dont get an error, but it doesn't do anyting.. <10> s/not/now <10> any magical 'repaint' I should call? <11> borland: What would be the equivelant of <link href="foo.css"> ? <0> octoberdan: you can do 2 things <0> much about with document.styleSheets <0> http://www.quirksmode.org/dom/changess.html <0> that may let you add another one <0> or you can use the DOM to create and insert a new element <0> ie: var obj = document.createElement('link'); obj['href'] = 'foo.css'; document.body.appendChild(obj); <0> I don't know if either actually work, not having done it myself, good luck <11> hmm... Alright, thank you <11> I'll give it a shot <12> search goole: "javascript change css style" <11> Yahoo bought goole.com hehe <11> First link :) <11> http://css.somepeople.net/dynamic <11> I think... <10> can I dump the dom structure of a node into an alert? <13> if you write a function to do it, yes <10> how do I iterate on the first level items? <11> wait, that link doesn't help me... <11> I want to do a css include, hehe <13> omry, iterate the .childNodes array <12> omry: function showproperties(obj) { var out=""; for(var i in obj) { out+= i+"="+obj[i]; } } or something similar <10> octoberdan, google css alternatives <10> hmm, just realized I can view the javascript object in the dom inspector. <10> something is strange: despite having a css rule with background-image, and having the div appear correct, at runtime I dont see any trace of the background image in the dom inspector (js object) <10> style.background-image is empty. <14> "toFixed is not a function" what is this <14> crap <6> nphase: it means toFixed() was probably called somewhere. as a function. but it's not a function. <14> deposit = "$"+(otheramt).toFixed(2); <14> does that look like a function? <10> yes <10> () ? <14> why does it only fail there <14> everywhere else its used its fine
Return to
#javascript or Go to some related
logs:
#qemu #perl photobucket revdiablo
cdtodvd #perl fedora epson stylus cx3810 cups amsn ubuntu not showing in synaptic may not run sudo on wget emech darwin RudiRendeer
|
|