Hey I have a question So Ive got a button that says onclick=myFunction and its hitting myFunction Inside myFunction
ok, i'm going to try it a little later on…i'll be back if i have any questions, thank you very much for your help
divStatus has no properties
….includes/scripts/utils.js
Line 30
what's line 30?
http://paste.css-standards.org/18210
well then the element was not found
strange isn't it
Mace[away]: not really, it could be for any reason at all
maybe there is no element with that id
maybe it hasn't loaded yet
div id="plugins" style="color:#666;font-size:10px;margin-top:1px;line-height:13px;padding: 3px 0"/div
maybe sid is set to some weird name
Line 29 now var divStatus = frames[0].document.getElementById('plugins');
is this iframe a simple page?
the same page loads each time - the very same page!
relatively
Mace[away]: do a dump of getElementsByTagName("div"); and see if it shows up in the list
is there a way to retrieve all aggregated style attributes for a css class? e.g. all rules applying to "body", even though they may be in 3 different sheets?
yeah, firebug
you don't use firebug?
do a dump of getElementsByTagName("div")? you mean loop through it and output each id value?
Mace[away]: that or console.log
console.log is a lot easier though
console.log?
console.log, firebug's debugger output method
oh. console.log(..) ?
facebook uses it
console.log(formRef.getElementsByTagName("div")); you'll see a wonderfully formatted output of the whole array
ah
and you can click on each element, and it will highlight that part of the source
and you can easily see any mistakes you might have made
why formRef?
Mace[away]: because its easy to type
oh ok.
Apparently, frames[0].getElementsByTagName is not a function?
frames[0].documentElement.getElementsByTagName
FF2
IE6 does it differently
IE5.5 does it another way
and, ofcourse, IE5 doesn't even do it
i c
which means, if you're going for IE5+ support, you have 3 ways to support, and 1 failure / needs fallback to support
It's outputted; [div, div, div, div, div#plugin, div, div#plugins]
what does that mean? it means iframes suck!
Mace[away]: looks like you have two divs that id values
div id="plugin" and div id="plugins"
correct
now output the result of getElementById
how can i stop an ajax call
for the autocompleter
so if its searching and they keep typing it will kill it
and search for the new term
you can't .. just ignore the result
hmm…
..abort()
what object do i pass?
the XMLHTTPRequestObject is passed as 'this'
this.abort():
?
this.abort();
where are you calling this from?
im not really sure i'll have to look through the JS
they have it all prototyped out
you have to get the reference to the xmlhttprequest object
and call abort using that
blahRef.abort();
okay i'll look
thanks
is there a way to get all active calls?
so i can just abort all calls
keep a list of all the created references
and loop through calling abort
okay im off to look through it all
i'll be back with more questions
for(i in objects) objects[I].abort();
function autoComplete(..){ if(window.autoCompleteHandler) window.autoCompleteHandler.abort(); … window.autoCompleteHandler = new XHR; …. }
okay cool
he doesn't know where the xml handler reference is
its ripped javascript
found the problem, thank you! any other debugging tips while I have your attention?
hm
*shrug*
i found it ddustin
He'll still have to ignore the result
ive pretty much learned the whole script by now
Mace[away]: firebug can set breakpoitns
Mace[away]: you can also step through code, with watches
which I find extremely useful
7) (DDustin) Mace[away]: you can also step through code, with
Yeah?
yup, just hit the 'script' tab
pick the file you want to look at in the drop down
click the line number to set a breakpoint there
ahh
many thanks DDustin.
np, good luck
nice
are there any gotchas involved in putting models in places other than app/models.py?
o_O huh?
like if i have a bunch of large, special-purpose models i'd like to put into a different file
you know, to soothe my OCD
is it as simple as "from site.app.special_models import MyModel"
wrong channel, but afaik, putting models elsewhere can be tricky
oh hahahaha my bad
After writing this script; do you think I have a life? http://aza.pastey.net/70252
thanks insin
in this script they do a lot of this onClick = function(event) { doSomething }.bind(this0
you are offically crazy
does that just bind the function to the onclick event?
what's the exact syntax
I think it's as correct it can be
function(event){return this._onkeypress(event?event:window.event);}.bind(this);
what's the context
where is this done
sorry
this.obj.onkeypress=function() { function(event){return this._onkeypress(event?event:window.event);}.bind(this);
bind sets the object which the "this" variable points to when the function is executed
wtf
foo=[1,2,3,4,5]
Jan-: { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5}
foo=[1,2,3,4,5,]
Jan-: { 0: 1, 1: 2, 2: 3, 3: 4, 4: 5}
Is that normal?
based it on the perl sprintf
Jan-: yes
main problem would be to handle signed and unsinged integers
it's standard not to care about trailing ,s?
http://insin.webfactional.com/tumblelog/item/10/
console.log(function(){}.bind.toString())
Jan-: some does, some doesn't
Jan-: IE cares a *great* deal, try not to do it
function (object) { var __method = this; return function () {__method.apply(object, arguments);}; }
The reason I ask is that I just realised I did it by mistake and yet everything seems OK.
It definitely cares when definint {objects} but seems OK with it on [arrays]
so bind does theFunctionRef.apply(this, [this]);
How often should data be fetched from the server when using AJAX? 250 miliseconds, 5 seconds, 15 seconds, 45 seconds?
Jan-: don't believe it for a minute - I once had a script where the size of an array randomly differed by one due to a trailing space
s/space/comma
so that is just to keep the scope within the function when its called on a different level?
or from a different scope?
precisely
more learning being done today
has anyone got a good sleep() function for js?
You can't really do that, dools.
Jan-: you mean i can't pause my script for x seconds?
You can, but you have to write it with that in mind.
there's no way of saying "stop here and wait"
What you can do is say "do this after a certain period of time"
ooh found a pretty good one using Date
so if you can split your code into two functions and call the second one from the end of the first one using setTimeout, that's the way to do it
Jan-: yeah i think i might have to do it like that
Number.prototype.bound = function(lo,hi){if(thislo){return lo};if(thishi){return hi};return this};
Jan-: { lo: undefined, hi: undefined}
Number.prototype.bound = function(lo,hi){if(thislo){return lo};if(thishi){return hi};return this}; 100.bound(0,40)
Jan-: Error: Error: missing ; before statement at line 0: Number.prototype.bound = function(lo,hi){if(thislo){return lo};if(thishi){return hi};return this}; 100.bound(0,40)
Um. What'm I doing wrong?
100.bound?
Javascript != Ruby
What d'you mean
what is bound()?
do you want splice()?
Something I'm prototyping onto number.
you can't call methods on literal numbers, can you?
I thought you could
not in Javascript
the only language I know like that is Ruby
which is why you have
Math.round(15.3)
15
Math.sqrt(15)
3.872983346207417
rather than
15.sqrt()
Error: Error: missing ; before statement at line 0: 15.sqrt()
15.sqrt();
foo = function(){return}; typeof(foo)
Jan-: function
Will IE do that too?
15.sqrt()
Jan-: do what?
return "function" for typeof on a function
sure
why do people love to use foo as an example?
because bar needs a rest now and then
I should call my pseudo-events with entirely lowercase names to match IE style coding, shouldn't I?
doing for (k in createMyHash()) will only call createMyHash() once right?
num=0; for(k in (function(){num++; return [0,1,2,3];})()); num;
1
yes sir
that is the coolest bot btw =D
Yes, he is, isn't he!
*buff* *gleam*
Sure but what does jsBot do?
var num = 5;
jsBot knows everything
speak to me of the world
How many beans make five?
Aww. It's OKies, don't be shy.
where did I leave my phone? I haven't seen it for months
=O he truly is divine, he speaks nothing and conveys what the world really is
about Jan-
Jan- is known for dangerous (1), rude (1)
HEY!
ha, he does know everything!
about Woosta
Woosta is known for brilliant (1), excellent (1), right (1), wrong (2)
:-D
about GarethAdams
GarethAdams is known for clever (1), right (1), sarcasm (1)
where'd jsBot get THAT idea?
about Jan-
Jan- is known for dangerous (1), rude (1), sarcasm (1)
~[ jsBot ]~ about wymetyme
damn this script
Hang on a minute!
I was only dangerous and rude a moment ago!
WTF is the flying nick about?
how dainty, wymetyme
Now I'm dangerous, rude AND sarcastic!
Jan-: GarethAdams karma'd you in the other chan
shhhhhh
how do you do that?!
karma GarethAdams sneaky
Unknown karma type 'sneaky'. Known types are: dcc, xpost, bad pun, brilliant, clever, dangerous, didn't google, excellent, funny, homework, informative, insightful, interesting, loud, offtopic, pastewarn, pasting, right, rude, sarcasm, troll, unfunny, wrong
about god
I don't know anything useful about god
ha
haha, beaten by your own programming
about Woosta
Woosta is known for brilliant (1), excellent (1), right (1), wrong (2)
i forgot I removed the ability to add new ones
karma Woosta rude
about Woosta
Woosta is known for brilliant (1), excellent (1), right (1), wrong (2)
You don't have enough fu
karma Jan- dangerous
OK
Ahhh
it's your silly nick changing habits
Hey I have a question. So I've got a button that says onclick=myFunction(), and it's hitting myFunction. Inside myFunction, I've got this variable that contains text, and I am able to alert() the text and it pops up. Here's the question. I've got some p tags on the page with id=textOut. How
can I get my text into those p tags?
about Jan
I don't know anything useful about Jan
about Jan-
Jan- is known for dangerous (2), rude (1), sarcasm (1)
Jan-: for a moment I thought "Woosta voodoo" was a euphemism
*sigh*
sorry
It'd be easy to get the impression you are all total nerds who think about sex all the time because you never get any.
Except you, obviously, Woosta. And you, jsBot.
karma Jan- sarcasm
OK
OK, Jan- you should be OK now
about Jan-
Jan- is known for dangerous (2), rude (1), sarcasm (2)
Erm.. Did anyone read my question and know how to do what I'm trying to do?
Bwha mngh!?
Quitit, we're too busy being offtopic
what do you think this is? A help channel?
Hehehe
2 secs and I'll read it
Yes.
document.getElementById('textOut').firstChild.data = text;
depends on what you mean by text ..
Thanks, one sec trying that
empty(yourPTag).appendChild(document.createTextNode( yourText ));
`js empty // you'll need this
A function to empty a node of content: function empty(node){ while(node.firstChild) node.removeChild( node.firstChild ); return node }
I assume that by some you mean one, because you can't have more than one element with the same id
That worked, deltab. Thanks!
Well two p flags
Er tags
One with the id
elements, actually
Uh huh
tags are what mark the start and end of an element
is firstNode.data cross browser?
is a start tag, and is an end tag
Yeah, so they're tags
p tags
but it's the tags and everything between them that make up the element
Ah ok.
firstChild is
Jan-: heh
karma deltab insightful
OK
karma Woosta overweight?
Unknown karma type 'overweight?'. Known types are: dcc, xpost, bad pun, brilliant, clever, dangerous, didn't google, excellent, funny, homework, informative, insightful, interesting, loud, offtopic, pastewarn, pasting, right, rude, sarcasm, troll, unfunny, wrong
Bah.
Yes, firstChild is cross browser, but is setting .data cross-browser?
Jan-: maybe you shouldn't've started with a chess playing program
In my garage?
hi. any idea how to get a location.href='URL' to work with IE?
I don't remember that bit
Gr!
how doesn't it work?
how can i get my page to scroll when there are layers outside the visible area?
document.body.style.overflow = auto?
you need quotes around the value
right
but will that scroll my page when the layers are outside the visible area?
not by itself
right
but right now there are no scroll bars
and i cant see the bottom of my page
you can use the element's scrollIntoView method for that
i just want scroll bars
why is the new iphone so clever?
How did you get rid of them?
you get one?
they are just not active
they are disable because it doesnt read any content to scroll to i guess
in FF
Jan-: Security: it means blind people can't steal your phone coz they can't find the damned buttons.
nevermind
i got it
I understand.
….it doesn't have buttons?
Jan-: most of one side is a multitouch screen
Oooo.
(Everyone knows blind people are responsible for 84% of crime)
Yeah.
deltab, http://majorstuenzoo.no - the top navigation don't work in IE 6
It's to support our extravagant lifestyles.
Someone has to keep me in white sticks.
Yup
Those damned sticks must cost a lot
Bah
Actually they f'in do, as well.
If you want a nonsucky one.
I bet they're made of ivory from third-world-children's teeth
Ooh, a new type I haven't heard of!
I prefer the rhino horn myself.
It's an aphrodisiac.
As if I need one
Jokes aside, I'm not surprised they cost a lot .. I've noticed that anything that's truly needed costs a hell of a lot
Small market.
Also they're made of carbon fibre.
Licking you cane at the bus-stop must get you a LOT of weird looks ..
Yeah, I only do that when nobody's looking.
It's my best friend, you know.
Just like everyone's guide dog is their best hosting friend.
"Yeah, officer, she was sitting there, licking her cane .. yeah, that's what I said, licking her cane .. then suddenly she's like .. all over me!"
verkakte guide dog users
*spit*
Hahahah
"Oooh, Timmy is my Best Friend in the Whole World!"
"I don't know How I'd Get On Without Him"
so there's this huge rift in the blind community? the doggy people, and the non-doggy people ..
*mutter*
And the braille people and the non braille people
and the born blind people and the not born blind people
The one thing nobody ever thinks about with disability is how fricken POLITICAL it is.
wow
I know in the paralympics there's all this fuss over who is disabled enough and who isn't ..
I have heard of people who didn't want to get their sight fixed beyond a certain point or they'd be ineligible to play goalball.
Disabled sports, though.
What a fucking gip.
I mean this one guy has been the world champion blind runner in about twelve categories for the last ten years.
To me this implies that the field is not bursting with talent.
to input elements automatically return a new line if you put them next to something?
*do
no. But that's not a JS question
work with IE?
There are inline elements (input) and there are block elements (div)
sorry let me go to the HTML channel to make sure my question is related
usorry let me go to the html channel to make sure my question is related/u
Oh, on a similar note, Woosta, you wannaknow what someone said to me over coffee after a meeting today?
(1) it's not in the spec IIRC (2) It's IE, Duh!
#web
"Wow, I'm so impressed you're able to hold down a job."
hahahaha
Woosta, any idea how to fix this with IIRC?
Oh I love unintentional condescention
Just as I love beating people about the head with an aluminum baseballbat.
you have to put an onchange on the select itself
Woosta, how?
afk
hey everyone
how was dindins, MONO`?
Jan-: pretty good, i had spaghetti (not srue if that's spelled right though haha)
*sure
anyoen doin anything exciting?
*anyone
yeah, definitely
I'm creating a html dom class
hm?
it's for a bit of code, html untidy, that takes a perfectly validating document and breaks it
lol nice
*twang*
*dischord*
…and that playlist has been playing for almost 2 days
How many times has "Like a Virgin" played?
huh?
none
oh okay
nevermind
lol
It was a famous madonna song
ok, so explain why i'd listen to that? lol
I thought it highly unlikely that you would, so I thought it would be funny
But I guess that failed
good idea lol
is there a help chan for yahoo UI toolset?
oh no, no more turbo
how come I can't function myobj(){var Name="bob";} dude=new myobj(); document.write(dude.Name); ?
Ohhh man I wish WSH stdinput was nonblocking
i know i can in myobj have like this.getname = getname ; function getname(){return Name;}
_koft, when you declare a var like that, it's like making a private variable
i wish i had something that could play .mov files .
isn't there a way to get to member vars in an object withouth having to go through a helper function?
ya, it's sayin undefined
that's the thing - it's not a member var - it ceases to exist when the function execution terminates
function myobj(){ this.Name = "bob";}
ORRrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
ok, so it's making room for that stuff on a stack and exiting scope
function blah(){} blah.name='blahblah';
so i have to make the var in global space and tack it into the object?
ding ding ding we have a winner
(that's a yes)
i'm learning
it's conceptually a little weird for me
if you find js weird you probably dont wanna get to know me too well =p
i had this idea that java script worked in ways which it apparantly doesnt
although that will give you the same property for every object…
javascript = 1 word [just for future reference]
well, thanks for the tip
=]
http://developer.mozilla.org/en/docs/A_re-introduction_to_JavaScript
i havn't touched javascript in like 5 years, i don't remember all this DOM stuff from before
it wasn't there before i dont think
or JSON for that matter
but in the past week i've been doing the ajax thing, i never realised how much this stuff has grown up
Anyone know how to pick up a shift-click in JS? I've tried listening for the keyCode but it doesn't seem to come through. I'm using Safari, but it would need to be a cross-platform solution.
you have to say: "Hi, everybody!"
Have you tried looking at window.event.shiftKey?
I hadn't no. I did some googling but kept finding what looked like really old code so I was dubious about using that in case it was IE proprietary or something.
Well, window.event.shiftKey certainly is
but I believe there's a Firefox equivalent
Ah. Right.
It had that look about it.
Hmm. I might just use drag selection anyway.
hey everyone
Oh good.
Well. At least it's not my code.
:p
anti-safari4win http://tinyurl.com/yukj22
anti-safari4win a href="http://tinyurl.com/yukj22"http://tinyurl.com/yukj22/a
that's at least 300% gay
Yeah. And I'm not even homophobic.
exactly
My friend Major Eisborg is… well, she's into girls.
Her name isn't actually Major Eisborg.
Yeesh. I wish I'd just dugg it.
She's just about the cutest, sweetes, least obvious lesbian I've ever come across.
So obviously she's now named after the gigantic scary military character in "The Fifth Element"
bSo obviously she's now named after the gigantic scary military character in "The Fifth Element"/b
heh
Oh, you know who I mean?
Nobody does usually.
OK, it's official.
Mplayer is incapable of playing several files in a row.
It crashes, regardless of whatever way you do it.
All I can do is literally to launch a separate instance for every file.
This sucks like an open airlock./
well, I've seen the movie :p
how can i pass my object from one function prototype to another?
as an argument that is
"Major Eisborg will accompany you - as your wife."
Jan-: WORKS FOR ME.
huh?
Mplayer =]
Oh sure it works in an "open a file, play it back" kinda way.
But "open a file, play it a bit, then open another, play that a bit, go back to the first one, sit paused for a while, go onto another file and play to the end"
…..no way.
Weirdo.
who?
ey i'm outta here
peace
I just did a document.getElementsByClassName(some_class), but when I try to operate on the id (of some, I'm guessing it's not all) in an iteration (for element in elements), I get that element.id has no properties
(using Firefox 2.0.0.4)
are you sure that element.id is defined before you start calling methods on it?
oh, yeah they all have ids
I did a little prompt test with… one sec lemme pastie
(using Firefox 2.0.0.4) - update :p
http://pastie.caboo.se/75576
…. that's new enough
unless there's some specific error in that version
oh, nvm.. thought we were at 2.1 branch allready
the length was 16, exactly the same as my own count of the correct element, but there were a ton of undefined#undefined
I guess those are what I'm asking about
you don't give me what elements is
elements = document.getElementsByClassName (as above)
and that method is prototype specific?
I just pasted the test code… I can paste the whole function… one sec
I believe so
have you checked how it's done , and how it's surposed to return data?
http://pastie.caboo.se/75576 (i.e. refresh the page )
(and are you sure the elements returned got a ID at all ?)
http://wiki.script.aculo.us/scriptaculous/show/Document.getElementsByClassName
uhm… that's a world of difference from what you first pasted…
waaait.. http://pastie.caboo.se/75576
that wouldn't return the key, would it
shouldn't it be prompt_string += element.className + "#" + element.id + "\n"; ?
all of the elements selected with the className I specified do have ids. The undefined elements in my prompt were in addition to the sixteen supposedly specified by the the elements.length
nope… for requires elements[element]; the error is NOT in the debug stuff (prompt, etc.) the problem is when I do elements[element].id.someStringMethod
erm…. StringFunction
the first paste was just a demonstration of my debug code
that's the whole function
http://jquery.com/blog/2007/07/01/jquery-113-800-faster-still-20kb/ new jquery… allegedly faster… everything else raped it for me
the problem is in line 12 of the paste
why are you trying to stringify an element?
(I replaced the little id method for debugging after it didn't work the first time), I'll fix that (change it back to the original code) and see if anything changes
updated the paste, the problem is now in line 11 (deleted that bad line and switched the code back)
make sure that the id exists before calling a method on it. it's that simple
you're getting a bunch of elements by their class name, they might not have id
you may also want to try DOM getAttribute("class"); maybe?
is DOM another library? or is it in the javascript host base?
DOM is Document Object Model. that method is DOM level 1. you should really google DOM because working with javascript in browsers it's kinda useful…
(I know what DOM stands for)
sorry, that was supposed to go before you replied
DOM is a bunch of object prototypes implemented in the JavaScript of the browser
what do I call getAttribute on? I'm assuming document? I don't see it documented in the tutorial site I have been using as a reference
you call it on the element object
alright, but if I'm calling it on the element object, how will that help me if I can't verify that this function (getElementsByClassName) is passing me correct elements?
uhm… could you not use getAttribute to verify that the function is giving you correct elements?
okay, I got an error: elements[element].getAttribute is not a function, so I guess it's not passing me correct elements… O_o
it's not passing you Elements period
possibly it's passing me an object similar to an element, but not an actual element object
because I'm definitely getting ids on the sixteen elements that are supposedly in the array
but then, going on to the methods below, it gives me the .id has no properties…
my point is that line 5 and line 12 have the exact same code, (speaking of the elements[element].id), but I get output on the first, but not the second, whether I call the first or not
is there some kind of freezing that can occur on objects in javascript that I don't know about? We have them in ruby, but I haven't heard about them here
Was someone looking for me in here earlier?
AJAX/JSON question. Storing a JSON string in a database. should this string start with "var myvar= { prop: … " Or just with the object literals (i.e. "{ prop: …" )
I don't know if you're still here, but I want you to look at this: http://pastie.caboo.se/75581, the iteration stops when it gets to a psuedo-element with undefined id AND class
also, when I make the elements = elements.slice(0,15) (0,14)… my last element is deleted and an undefined element is appended to the end of the array
apparently, I only have 15 elements, but the #findByClassName appends that last element to make the length equal to 16
yay, that's great. that's also really fucking annoying to have to walk all the way to my computer because you keep saying my damned nickname
well then you should have said that you wanted me to stop. If you don't want to help me, that's perfectly fine. I'm trying to spot an error in the prototype code
hi, i have a quick question. With javascript you can't save the contents of a form in the clients pc?… i think the answer is no… i think it can be a security breach if was posible…
you can, in a cookie
depends on how much content, doable using a cookie as preaction said but there's no access to the filesystem, with the exception of …. IE ^_^
cookies, Flash local storage, Google Gears
thanks both of you… now three… yes, i know… in the cookies yes… but no filesystem acces
a economist friend want's to do some like that… i tell you i think wasn't possible… there are a lot of other methods to do what he wants… but… economist… you know…
if this is for his own Form material being saved for later retrieval on his browser, is doable with many extensions or plugins
in Opera you can use the 'Wand' for repetitive personal info, to have it autofill form fields
deltab… i don't know what google gears are… now a google and i know… google continues growing… they are inteligent…
CommandPrompt, they want's to send a form to other people, then the people complete it and send you the result
also HTML5 local storage
CommandPrompt, yes, i'm looking that url
….
sorry for my english… not "send you the result", "send him the result"
they want to send an auto-filled Form to people?
CommandPrompt, no, they want to send a normal form to people with questions, checkboxes, etc, , then the people complete the form and send him the results
…
and what part of the form requires filesystem access on the client?
sounds like a simple form submission
yes… i tell him that… put the form in a free web server host and get the results here… but he wants the forms saves the results in a file, then the people send this file to him
the server can do that
in the server you can use anithing else… php… perl… databases… save files… with this you do a very simple form who writes the results to a db or a file
the problem is he doesn't want to use a server
he want's to send the form in a mail to the people… not put it in a server… but i'm gonna tell him… put the form in a server and don't bother
tell him to suck it up and get some free hosting. www.ej.am has free hosting with perl and php as long as you post 10 posts. (and never have to again, just visit the forum every so ofter)
I have pound '£' character stored in the database and when I use xmlhttprequest GET object to retrieve this character, the respond is '?' character. Help.
and ruby on rails hosting is now as low as $4 bucks a month server side is the best way to go
the web server is sending back a bad content-type header
preaction, urmm.. what content type should I put?
well, what encoding are you using?
thanks jontec, www.ej.am looks very good… perl and php… there aren't many free servers with perl
I'm a RoR guy, but I used to have them host a forum. It's pretty stable.
preaction, to be honest, I don have any idea. none I guess or the default which I do not know..
the default encoding the browser uses is probably the same encoding the system uses.
i imagine the page's encoding and the encoding your ajax application is sending back are two different values
so i imagine you might want to use firefox's page info to figure out what encoding the page is in
why not just the £*, I know it'll store with the db, whether or not you can pass a * will be dependant on whatever's stepping down the data into the db
..
in Firebug, you can check the XMLHttpRequest() object and the http headers sent along with it, it'll show you what encoding type the webserver is sending as well as the content-type
erm.. nope, not £*, £
jontec, you're right. storing £ instead of '£'. urm.. how do I get other currency character like yen, dollar etc?
I was using a book, I can give you the values, but they're probably on the net someplace
what is this called? encoding ?
I have no idea, I just use it… this is a dated book, but I use it as a reference for colors and things like that… "The following table lists the extended charater set for HTML, also known as the ISO Latin-1 Character Set."
the Latin-1 would be the encoding, I believe
the yen symbol is ¥ and dollar sign is $
what CommandPrompt was referring to (Firebug) is a developer extension for Firefox. I have no idea where you find that information in Firebug, however, this is only my second day using it.
hehe
care to tell us, I'd like to know
oh, wait is it the Net tab?
[net] tab [xhr] section, clicck on the [+] to expand the request entry, it has 2 tabs, one is the .responseText and the other is the HTTP headers sent
or if it shows, in the [console] tab, just expand the [+] it'll show the 2 tabs too
that's pretty nifty
anyone here use jquery?
(I don't have any idea what that is)
pretty helpful stuff
www.jquery.com
but i have a question so if anyone uses it lmk
owkey, got it. thanks guys
Hey, I have a ajax call and I assign a function to my ajax object's onreadystatechange like so http://pastebin.ca/600931 how can I make it so I can assign the result to a variable outside of the function I assign onreadystatechange?
The paste 600931 has been copied to http://erxz.com/pb/3394
only way I presume is to store in a global document variable
what package do i need for wmv codecs? is this in the repos?
oops wrong channel
hehe
hmm
row: http://www.free-codecs.com/download/K_Lite_Codec_Pack.htm
….
peepsalot rather
ah sweet it is working now
anyone can point me in good direction for learning how to remove elements withing page using xpath ? ;$
ah I think I know what my problem is.
I submit a form catch form submission, do call in ajax it works so I remove the form via removeChild from parent node and then I can't stop the form submission
so just ends up submiting page anyway
bah
silly me
CommandPrompt, i'm on linux
on wmv?
mplayer, vlc?
… get vlc or mplayer
mplayer has wmv codecs
mplayer has just about every codec
it has a bundle called the 'Essentials'
wmv is in it
Hey how does one cancel a form submission from with in javascript? not via returning false to onsubmit or whatever that is?
ie form.submit(false); or something?
…
why?
just don't submit it
er, I call something via onsubmit="return !somefunc();" if func returns true it kills submission, but I remove the form itself in that function in one case and then it submits anyway.
in fact its submitting every time
.
onsubmit="return false"
no?
yeah but if can't make ajax call for whatever reason want form to submit
as all ajax related features fall back to normal form usage
so I return true if I can call ajax, false if I can't
so flip that true to false and it should stop submit
must be a error in my javascript stopping function returning
looking into it now
as I swear this always worked before
dude..
dude! you've got a Dell!
onsubmit="somefunc(); return false;"
:p
and "ajax" is such a annoying term
because.. it's a buzzword! not a technical term
lol !
more buzzwords!
fine, I make a http request via javascript to submit form in background.
why would you ever do that ? -.-
because it floats my boat?
I tried return false after function as one of first things.
while (sleep(TheDeathArt)) { touch; }
something in my javascript is killing it I think
if any error is thrown futher execution is stopped
and your form would submit
but any debugger should reveal so
apparently not, no idea why its doing this.
screw it
fix it later, its not important
jesus…. with IE sometimes the page works, sometimes I get an "object doesn't support this property or method" error and SOMETIMES i get "operation aborted"
wtf
worked 6 times in a row
this time "operation aborted"
well… IE :p
its pisses me off so bad that such a shitty browser has such a big market share
in time people will learn
hmm lets see if using output buffers fixes it
"you can buy a Ford in all colours you want, as long as you choose black"
will that load all of the nodes before it starts executing javascript?
*elements
oops sorry let me go to the PHP channel
there is some javascript hosting methods to check for the document is fully loaded
i know the problem is i cant find the code thats trying to access the DOM
just scope all the code
and put it inside a tigger
i tried wrappign the whole script in (jquery) if $(document).ready) {
should work then ?
didnt…
haha
maybe i didnt wrap the right script…
hmmm
dammit…. everything in all of the scripts are functions… nothing is being executed on page load
what is something that would cause "object doesn't support this property or method" AND "operation aborted"
but one or the other randomly… and other times the page loads fine
timing on certain created objects most likely
try delay it with 400ms or something
what do your script DO ?
the one that has a problem is my autocompleter that i stole from facebook
:p
fastest one ive ever seen
hey all
i ant to assign 'var abc = x.innerHtML()'
but i want a string to be assigned not the reference
that is i dont want the contents f abc changing when x.innerHTML is changed
w0t?
you do know there's no innerHTML() method?
innerHTMl , sorry about the () .
so
what's the Q?
innerHTML is just a string, not an object and thus it doesn't return a reference, just a string
when i assign a variable to innerHTML , and i chaange the contents of innerHTML
the contents of teh variable also change
i just want to store the contents of the innerHTML in a variable in such a way that it wontt change
i mena i want a string value assigned to the variable and not the reference
…
I don't think that is the case
yeah if you assign a var to innerHTML it wont change when you change innerHTML
it is changing .
then you're changing it
er… solar_ant
i will check the code
thanks
http://www.ameritime1.com/newsite/template.php
a href="http://www.ameritime1.com/newsite/template.php"http://www.ameritime1.com/newsite/template.php/a
hi, i want to define an object HEADER within another object INTERFACE (something like inner classes). How can do so?
how to insert an element for example a div or whatever by js?
DOM
`html2dom @ crolle17
html2dom: Woosta's (x)html to DOM convertor .. convert xhtml chunks to DOM scripting: http://rick.measham.id.au/paste/html2dom.htm
Woosta, ah. appendChild
Amongst other methods, yes
Woosta, or createElement …
you need both
you need the code produced by that page
nice page.
Put the HTML you wish to create in the top left, click convert, the code produced is the code you need
Woosta, yes. very nice and comfortably
how to get the final width and height properties of "div" and "a href" elements ?? i tried http://paste.css-standards.org/18227 but in IE i always get it as "auto" instead of the final px values. any ideas ??
offsetWidth
hi. if i want to create something using DOM in a script tag in the body to be rendered in-place in the body, how do i do that?
use document.write(new_element.outerHTML) or something?
hi
with http://www.ajaxtutorial.net/index.php/2006/07/07/ajax-generic-form-parser/
sendRequest is not defined
but is is defined
Is there no way with html DOM to assign a data stream to an image, in order to change its content… rather than changing the img.src property?
Something like img.data = datastream_respresenting_image
hiya
does anyone know why document.write("text"); puts the text in a new window when you have it inside a function?
noone?
i believe using base64 encoding that is possible.
http://www.google.com/search?q=img+src+data+base64
Interesting, thanks. Should that work also for medium-size images, you think?
var = new Array( 'key'='val' ) and var={key:'val'} ?
and var = new Array(1, 2, 3); and var = [1, 2, 3]; ?
well i don't think new Array( 'key'='val' ) is really valid, is it?
The first appears to be some crazy mix of JavaScript Array creation and perl hash creation and is garbage.
The second is almost an example of assinging an object to an array in JavaScript, but fails since var is a reserved keyword.
The third and final examples are, IIRC, just different syntaxes for the same thing (except they also suffer the issue that var is a reserved keyword)
and key=array is impossible?
In JavaScript, yes.
What can i use insted of it? Object?
And are objects slower?
var myObject = { key:'value' }
Slower then what? In JS everything is an object.
An array is just an object with a few extra properties.
but i can also iterate through these objects - {key:'val'}
for foo in bar
umm for (foo in bar) { } even.
but I don't know if it works in older UAs
And how to get user's language in JS file?
wtttttttttttttttf
how does this NOT work
function makeEl() {
var newEl = document.createElement('div');
newEl.style.width = '300px';
newEl.style.height= '300px';
newEl.className = 'contentElement';
newEl.innerHTML = "test test test test test";
document.getElementById('content').appendChild(newEl);
}
you would.
I've warned you about pasting before. Don't do it again. Next time it will be a ban.
uh huh
what's the easiest safe way of getting the text within an element?
.innerHTML or .data i'd say. but check out http://www.quirksmode.org/dom/w3c_core.html and http://www.quirksmode.org/dom/w3c_html.html
where the mouse is with an onclick?
i'd say use prototype's Event.observe, Event.pointerX/Y, and position: absolute the div at top,left px
do you have an example of this please?
any good tutorial on how to make a webring?
Don't multipost
ok sorry
:/
Hi. I'm using JSON as data format when requesting data via an XHR. I want to traverse this data in javascript, but i can't use the .length method (as in for(i=0; data.lengthi; i++) ) on json objects… have do you iterate a json object?
for (foo in bar)
thanks.. how's is that performance-wise compared to the "old" way of traversing an array…
who here has used overlib before?
I've never compared them. And the 'old' way is the right way of traversing an array. Looping over an object's properties and looping over an array are different jobs.
Okay, I'm considering combining json and "native javascript array" in my "data stream" to be able to traverse properly
hi all
quit
can somehow view all of the properties of an object?
for (foo in bar)
hey.. anyone knows whats worng here? http://rafb.net/p/FIR30867.html
krupa^: You are trying to use JS when a regular submit button will do fine.
kritical, as dorward said, you can use a form submit
but IF you want to use javascript
your problem is that you're getting the form element, then trying to use document.x.
you can simply do x.submit();
this is the whole script
http://rafb.net/p/7j1DZw66.html
once you have retrieved the form. You can even do document.getElementById('formid').submit();
check it out
your script login is just wrong
Thank you all !!
krupa^, you need document.getElementById
to pass arguments to function that I prototyped within an object, do I have to pass it through the parent object first?
guess not it sseems to work
Anyonw here has a clue on how can I send to a web server my DOM generated code using JS?
hi, I've made a php hosting script that parses alot of information from some xml files, and i'm looking for a javascript/function that could display a 'progress bar' while it's running.. any hints on that?