Help Logs Database

Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Ircnet  |  Dalnet
Page: 1 2 3 4 5 6 7 8

<arguile> fatbrain: ?
<fatbrain> I **** you not, and why do you need a closure?
<Myrth> hi, i know it's little bit OT, but in #css no one knows.. is it possible to have div with position:fixed but so the other content will start from where fixed div ends? right now it goes behind..
<frb> first, position: fixed ins't even support in IE
<Myrth> yeah i know
<fatbrain> arguile: You may answer my question.
<frb> secon, position: fixed pulls it out of the flow, so no, you can't make it part of the flow and outside it at the same time with that method
<arguile> Myrth: The best way is generally to adjust the margins such that the content never goes into that area
<arguile> If you're looking for a "floated" fixed div such that content flows around it
<Myrth> arguile: in js? and to check for IE?
<arguile> You're only resort is JS
<arguile> Myrth: No, CSS in the first instance
<Myrth> arguile: can i make padding only for FF and not for IE?
<Myrth> only in CSS?
<arguile> Myrth: Well, not _just_ for FF but IE doesn't support any selectors other than descent so that's one way. Conditional comments are another. There are others as well that don't validate. And JS (if you wish to rely on it) is an option as well.
<arguile> s/descent/decendant/
<arguile> fatbrain: I need to fire a click event of a form element when another element is clicked (to work around IE's lack of label w/o for="" support.
<Myrth> lol position:fixed on thead looks funny
<arguile> Myrth: You don't need position: fixed for thead, you can contrain the body size
<arguile> And scroll within it
<arguile> Another thing IE lacks support for though
<Myrth> really?
<arguile> fatbrain: My solution before was to find the first form control child enclosed by the label and attach a click event on the label that fired the click event of the form control
<Myrth> you mean to scroll only tbody>
<Myrth> ?
<arguile> Myrth: Yes, that was what was intended in the CSS spec (I think it was CSS1, might have been 2) they have an example on it (w3c.org)
<fatbrain> arguile: and you call that a "closure"?
<arguile> arguile: No, it wasn't before
<arguile> I'm well aware of what a closure is (though JS can't really do them properly due to lack of lexical scope)
<arguile> I've started using something along the lines of: function click (input) { return function () { input.click() } } so I can easily (regex) replace the original attachEvent('foo', input.click) calls
<arguile> But I was hoping for something a bit less kludgy, as I don't like that method at all. Just constrained for time.
<fatbrain> arguile: lack of lexical scope? elaborate.
<arguile> fatbrain: var foo; is scoped to the function not the block. Therefore looping over a HTMLCollection and creating a closure in the form var foo = col[i]; var bar = function () { foo.click() } creates a single function of the last iteration
<arguile> In lexical scope both bar and foo would go out of scope at the end of the enclosing block (each time around the loop)
<fatbrain> that's not lexical scope, lexical scope is when the scope of a variable is "govern" by it's lexical placement.
<arguile> Which is the enclosing block
<fatbrain> no, which would be the function, didn't you read the ecma-262? It has a topic that explains how scope is handled.
<fatbrain> Just because some languages are "block"-scoped doesn't mean that JavaScript approach is wrong.
<fatbrain> I never call an event directly as you do (e.g. input.click())
<fatbrain> nor do I use the function() { return function() {} }(...) approach
<fatbrain> I like the eventhandler object approach better than the one you just used.
<fatbrain> function MyFreakingEventHandler(obj, arg1) { obj.onclick = function() { alert(arg1); } }; for(...) { new MyFreakingEventHandler(x[i], i); }
<frb> maybe he should enable strict processig in firefox and see what happens
<frb> I really don't like the obj.event syntax
<kojiro> what operator is ~ ?
<frb> kojiro: binary negation
<kojiro> oh, headache
<kojiro> bitwise NOT?
<factor> can I use javascript to read a variable from a span tag? I can write to a span tag with inerHTML but how would I get data from the span tag?
<fatbrain> kojiro: XOR
<fatbrain> wait...
<kojiro> fatbrain, but there's only one argument
<fatbrain> XOR would be ^
<kojiro> oh, good thing you told me that, I was ***uming exponent
<kojiro> ** is exponent?
<fatbrain> Math.pow(x, y)
<fatbrain> There are no operator for power-of
<kojiro> ok
<jgarbers> i've heard that <a href="javascript:something()"> is poor style. what's the appropriate way to have something that appears like a link call a JS function?
<fatbrain> <a href="bleh" onclick="something(); return false;">
<fatbrain> where bleh is something more "appropriate"
<kojiro> does ~ do some magic with twos-complement numbers, or does it just invert the bits?
<jgarbers> fatbrain: by 'appropriate' i ***ume that 'bleh' never actually gets used as an href... but you'd want something descriptive for the status line?
<kojiro> Oh, I get it, plain-old - would do the magic so that two's complement binary numbers would actually be negated. ~ actually inverts all the bits, right?
<fatbrain> kojiro: bitwise-not
<kojiro> right, thanks
<BarnacleBob> jgarbers, if you want the link to do nothing but javascript have the last javascript command be return false; otherwise it will run your js then execute the hyperlink
<jgarbers> okay, so far so good. now i need to get to the event on that click... what param do i put in the function declaration?
<BarnacleBob> what about the event do you need?
<jgarbers> the element that was clicked.
<BarnacleBob> < a href="" onclick="myfunction(this);"> blah</a>
<jgarbers> BarnacleBob: that's what I'm using now. Thought you could just pick up window.event somehow.
<BarnacleBob> erm
<BarnacleBob> its in this.Event inside a function
<BarnacleBob> at least in moz it is
<jgarbers> so if i say onclick="return myfunction(this);" as long as myfunction returns false i should be fine.
<BarnacleBob> but the properway is to p*** it the element with this
<BarnacleBob> yes
<frb> onclick="myfuntion(event)
<BarnacleBob> or you can just
<jgarbers> p***ing 'this' does seem cleaner.
<frb> "
<BarnacleBob> onclick="myfunction(this); return false;"
<BarnacleBob> than using event?
<frb> if you p*** "event" instead of "this" then it works on FF and IE
<BarnacleBob> ah thats good to know
<BarnacleBob> or not
<jgarbers> frb: you're saying 'this' doesn't work on IE?
<BarnacleBob> i've baned ie
<BarnacleBob> *shrug* he would know more than i
<jgarbers> it *seems* to be okay...
<frb> jgarbers: I've had "this" be the widget, not the event
<jgarbers> yes. i'm expecting 'this' to be the element.
<jgarbers> the only thing i wanted from the event was what had been clicked.
<BarnacleBob> this should work
<BarnacleBob> although i've never tested it in ie
<frb> from the event, you can either use evt.target or evt.srcElement
<fatbrain> FFS
<fatbrain> inline event handlers SHOULD look like this: <element onevent="eventHandler(this, event); return false;">
<fatbrain> return false; // only if you want to prevent default action.
<BarnacleBob> yeah
<BarnacleBob> true dat!
<fatalis_> don't use inline event handlers
<BarnacleBob> bollocks
<fatalis_> don't use inline event handlers
<BarnacleBob> in an ajax framework its impossible to not use inline eventhandlers as script blocks from newly loaded stuff is not executed
<rajesh> any using mochikit here?
<rajesh> heh
<fatalis_> it's not impossible, you just keep testing wether the element has loaded until it's ready
<BarnacleBob> fatalis_, well ok whatever. any reason why not to use inline event handlers?
<fatalis_> BarnacleBob, same reason why one shouldn't use, say, inline styles
<BarnacleBob> ?!
<fatalis_> separation of structure, presentation and behaviour
<BarnacleBob> just speration?
<fatalis_> yeah, "just"
<BarnacleBob> well all i'm doing is overriding how a link is executed
<fatalis_> I don't see your point
<BarnacleBob> ex: <a href="" onClick="link('gohere'); return false;"> that falls under your seperation as there is no way to express what i wanted otherwise
<fatalis_> what kind of a ****ty example is that
<fatalis_> moreover, I still don't what you're trying to say
<fatalis_> *see
<BarnacleBob> yeah it would take alot of explaining and you would just tell me i should use dom and 2000% more code any way
<BarnacleBob> so i'll just leave it at that
<fatalis_> that's not degradable, and shouldn't be used
<BarnacleBob> whats not? the link?
<fatalis_> BarnacleBob, ah, **** you, dip****
<BarnacleBob> what the hell
<fatalis_> you piss me off
<Guest573259> may i can use window.open in a form action?
<fatalis_> I don't think so
<fatalis_> just try it, won't work
<BarnacleBob> you can in the onsubmit handler
<fatalis_> that wouldn't submit the form in a new window either
<BarnacleBob> but only kind of
<Guest573259> BarnacleBob, ok :)
<BarnacleBob> yeah
<fatalis_> you shouldn't use window.open as a rule of thumb anyways
<japhy> I'm working with dynamic generation of HTML elements, and I'm curious if there's a simple way to take a string of HTML and produce an object from it.
<fatalis_> it's not reliable, and is unjustified usability-wise
<fatalis_> japhy, .innerHTML
<japhy> or if there's a convenient way to take a string of HTML and store it in an object and have it rendered
<japhy> ah, innerHTML
<Guest573259> whats the method for submit a form?
<fatalis_> submit, maybe
<fatalis_> as in .submit()
<fatalis_> just a guess
<Guest573259> its because mozzila shows this error: Error: document.opener has no properties
<japhy> oh that makes things SO much easier.


Return to javascript
or
Go to some related logs:

funny tauren names
page rewrite javascript onclick
sql
fettoter

Copyright © 2005 www.irclogs.ws. All rights reserved. » disclaimer » contact