| |
| |
| |
|
Page: 1 2 3
Comments:
<0> man... haven't you heard of onload? <1> it's an include <1> it doesn't have its own body or head <1> i should have said <2> You can still use window.onload. <2> window.onload = function() { ... } <1> hmm ok I'll try... <1> this just means it'll run only once the entire HTML is loaded? <0> yes <1> thanks it works great! <1> I can only have one window.onload in the page, right? <0> right <1> okie thanks <3> morning all <4> D314: You may use <4> document.body.addEventListener("load",yourFunction,false)
<4> to add multiple onload handler <4> D314: for IE: document.body.attachEvent("onload",yourFunction) <1> the first thing you wrote will run the function once the page is loaded? <4> Yes <4> You add an event handler for the onload event <4> And you may add as many handlers as you want. Not only one! <1> fantastic... I never knew this trick before. <1> It sounds very useful. <4> That's no trick, that's DOM <1> I think for now I can use window.onload, but in the future, I'll remember this for sure <4> Yes. <4> BTW: It works for every event and most objects <4> click, mouseover, etc <1> and for all browsers, correct? <1> document.body.addEventListener("load",yourFunction,false) <-- IE and firefox? <4> attachEvent for IE <4> as stated before <4> IE: document.body.attachEvent("onload",yourFunction) <5> http://www.quirksmode.org/js/events_advanced.html for a more elaborate explaination. <1> so what if I want to write code that works in all browsers? <4> You may write a wrapper <2> I have a wrapper that deals with IEs shortcoming to handle circular-references DOM<->JS. <4> http://pastebin.de/7838 <1> "wrapper"? <2> D314: Check out the paste. <4> usage: addListener(yourElement,"load",yourFunction) <4> where yourElement might be something like: <4> document.getElementById("foo") <1> what is addListener do? <4> It's the wrapper <4> You may call it to add a listener for a specified event and object. The function checks, if it have to use IE syntax or official DOM <4> A cleaner way would be: <4> http://pastebin.de/7840 <1> so you're testing to see which function works? <4> Which is supported. <1> what is a listener exactly? <4> A function that is called when the event the listener listen to, occurs <1> so when you wrote function addListener(aElm,aEvent,aFunction) , what is it waiting for? what calls it? <4> You have to call it <4> If you want to have something executed on click, you may use it. <1> So I call it, and it adds the appropriate event handler? <4> You may also use it for the load event as described before. <4> Yes <1> can I name it anything? for example function myNiceListener? <4> Of course <1> I see... I'm just confused by the fact that it's RETURNING the aElem.attachEvent("on"+aEvent, aFunction); <1> what is the meaning of returning an executable line? <4> You don't need to return anything. That's just my programming style and more a matter of taste. You may remove both return statements <1> so if I deleted the words "return" it would do the same, right? <4> Yes <4> And while addEventListener should not return anything (according to the standard) it's actually pretty useless :-) <4> See: <4> http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html#Events-EventTarget-addEventListener <1> so would it be correct to say that the "listener" is the attachEvent, and not the actual "addListener" function? <1> just want to get my terms straight <1> I think I get it now <4> the addListener function is my own idea. It's a wrapper function that wraps the browser specific logic. <4> See also: <4> http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/attachevent.asp <4> for IE <4> And note: IE returns a value
<1> thanks for your help, kirschkern <1> I feel like I've become smarter <4> You do <6> hi there i have a question... <6> i recently downlaoded javascript book published 1999 <7> :P <7> best of luck <6> so i want to know if its so outdated, in manner of syntax <7> syntax, not much <6> that is what i am intersted in <6> it has chapters on javascript and css integration , like going dynamic <6> thanx <7> yes, that is likely wrong <7> the language hasn't changed -- the interface to the dom has <6> dom ? <7> you'd be better off getting a better book <8> document object model - how your script interacts with the page <6> ah sorry bout that, i c what dom stands for now <9> if anyone knows scriptaculous well, is there a way to change the serialize metohod of Sortable.serialize so that instead categories[]=1&categories[]=2 i'd get categories=1&categories=2&categories=3 ? <9> or if not, how can I replace categories[]= with categories= in js? <9> does the replace function replace only one instance that it finds? <7> takes a regexp.... make it greedy <7> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/5f0e4765-df4d-4887-bd09-efe5e58251bf.asp <9> ah <9> g <0> g is not for greedy <0> is for global <0> but, that's what you need <9> yup <10> helluuw <8> :[ <1> hey it's me again... I created a Date object in javascript... is there any method for getting the day of the month from it? <10> lol melfar <10> u never got bitten before? <11> yeah <7> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/ce2202bb-7ec9-4f5a-bf48-3a04feff283e.asp <11> never enjoyed that <10> lol <10> u must come from the antartica no? <8> heh <10> lol <8> woohoo <10> am soo hung up <12> if i know a name of a cookie and its content, how could i change it ? <12> javascript:alert(document.cookie="name=Name Content=content"); ? <12> uh .. anybody online ? <5> Yes. <12> Pilum, what's wrong with that command / <5> If you put it anywhere else than in the address bar, the 'javascript:' part. <12> i put it in the address bar. <12> and it's not working :( <12> any clue as to why ? <12> Pilum ? are .. you still here ? <5> Yes, but I'm not all that cookie savvy. <12> arh.. <12> is this code right in javascript terms ? <12> javascript:alert(document.cookie="name=level11_authorized; Content=Yes"); <5> Does document.cookie give a return value though? <5> Might give an alert saying "true" or something. <13> or undefined <5> Yeah. <14> ok fixing some one elses code so dont shoot the messenger <14> (until i can rewrite it)
Return to
#javascript or Go to some related
logs:
#squid #linuxhelp #AllNiteCafe #networking #MissKitten riklma #linux #chatzone #AllNiteCafe #skype
|
|