| |
| |
| |
|
Page: 1 2 3 4 5 6 7 8
<rajesh> simple xm nodeset <rajesh> xml <Craig_> why would u leave out the request header? <alexmacy> hi <Craig_> you* sorry :P msn has got to me <rajesh> no reason, i was setting the mimetype on the server-side <alexmacy> i want to capture the "back" event (when the user click on the navigator back button, or when backspace is hi) <alexmacy> anyone know how i can do this? <Craig_> yes but the header tells the server and the browser its a form post/get <Craig_> hence the url encoded <rajesh> Craig_: k, i added that line in. <Craig_> alexmacy, you can detect the backspace button being hit, but its not possible to detect the back button being clicked, sorry. <alexmacy> rf <alexmacy> there is absolutely no way to capture it? <rajesh> Craig_: http://pastebin.com/397534 <Craig_> nope. <Lebannen> I've got an xmlhttprequest question... a client with AOL (based on IE) experiences regular crashes which I've managed to replicate; it appears if a number of xmlhttprequests are triggered in quick succession, the program crashes. Is there a way to safely dispose of xmlhttprequest objects so that callbacks etc won't trigger (as I presume that's the problem)? Or does anyone know what else might cause this? <alexmacy> raah <alexmacy> this is a problem lol <Craig_> return d.addCallback(test); ? <Craig_> Lebannen, Umm callbacks? <rajesh> Craig_: umm, i thought that d.addCallBack(test) would call test() with the xml response as a parameter? no? <Craig_> well no, because your not actually returning the xml response, your returning the req object <Lebannen> Craig_: Well I've no idea what's causing the crashes, but I'd guess that it's something to do with a readystatechange callback from a previous request somehow conflicting with a newer xmlhttprequest <Craig_> rajesh, the xml document is p***ed within the object as req.respon***ML <Craig_> Lebannen, got an example of your code I can work from? <rajesh> Craig_: right. so, wouldn't the block inside the alert() pick out the <name> tags in the respon***ML that was p***ed as resp to test() ? <Craig_> no. <Craig_> use this instead <Craig_> alert(resp.respon***ML.getElementsByTagName('name').length); <Lebannen> Craig_: it's very standard... create an object, add a onreadystatechange function, do stuff in that function. zero errors thrown, works fine in ie and firefox, etc... but it's triggered on a onchange event on a textbox, and if five or six events trigger in rapid succession, AOL crashes. <Craig_> Lebannen, are you making sure to check the states id? <Lebannen> any processing happens after a (xmlReq.readyState == 4) check - should I do more? <Craig_> for thers four different states, if you dont add a conditional brace to detect if its "4" then it wil lfire 4 <Craig_> ah, so you ahve :) <Craig_> maybe try this too <Lebannen> and a (xmlReq.status == 200) to boot <rajesh> Craig_: thanks, but no go. <Craig_> ah, beat me to it :) <Craig_> Lebannen, no reason why it should be firing so many times, try alerting everytime it is fired, that way you will know if its being fired mroe than once <Craig_> rajesh, hmm <Craig_> what does addCallback to? <rajesh> ? <rajesh> what does it do? <Craig_> return d.addCallback(test); <rajesh> or what does it point to? <Craig_> what does it do, sorry, I've never had a use for it so never known what it does. <Lebannen> Craig_: it only fires once per change, I've checked... but say I quickly type "blabla" into the textbox, that sends six change events... I could add a delay/limit, but that would take away from the "instant response" feel normally - and it seems weird for anything to cause an application crash :( <Craig_> application crashes are normally caused by an inifite loop or multiple functions being fired. maybe its just your browser version? <Craig_> try getting another person with AOL to test it for you and see if it has the same effect <rajesh> Craig_: ahh ok. well, if im not mistaken, once the response is received, it triggers the method. <rajesh> i just wasn't sure how mochikit does it. <Craig_> right but, is the response p***ed as a paramter, or must you define it? <rajesh> which is what i don't know. <Lebannen> yeah, I set up an AOL issue and replicated it, so it's not just one machine... but it may well be just that version, namely AOL 9.0. Ah well, I guess there's no easy fix then :) <rajesh> prototype p***es it as a paramter to the callback function. mochikit, i don't know. <rajesh> am looking <Craig_> try alerting resp. <Craig_> that way you know if the parameter is defined <rajesh> alert(resp) only tells me that there is an object of type mxmlhttp... <rajesh> so, it is defined. <Craig_> go up in steps. <Craig_> then alert resp.respon***ML <rajesh> hmm, it's a null object. <Craig_> try responseText <rajesh> i did <rajesh> :0 <rajesh> :) <rajesh> interesting, i get back stuff <rajesh> ok, something to build on now. <rajesh> thanks a ton, Craig_ <Craig_> Is the document your querying an XML ? <rajesh> it is. <Craig_> because if not, respon***ML won't return anything <Craig_> it says .html <rajesh> oh, that's alright, i'm redirecting internally. <Craig_> does responseText get the right document? <rajesh> ahh, i know the problem. <rajesh> it's in how the paramis being p***ed. <rajesh> if i do 'url?lap', it works alright <Craig_> ah :) <rajesh> strange <Craig_> simple things are the ones that get you :P <rajesh> :) <rajesh> and yes, in mochikit, you have to the .respon***ML. <Craig_> ya, thats a xmlhttprequest object, so its in all scripts <rajesh> right. <rajesh> thought it would be shortcutted in mochi <Craig_> what is mochi anywho? <rajesh> mochikit.com <Craig_> ah :) <steve_> I have a div and when I try to do a div.innerHTML = ""; I get an exception with a failure code from firefox <steve_> the failure code is 0x80004005 <steve_> any idea as to what that might be? <steve_> It worked a little while ago... <rajesh> steve_: maybe you don't want to use innerHTML <TheXL> Can you serve me with the whole line? <rajesh> i've read in many, many places that it shouldn't be used other than for IE <steve_> rajesh: what should I use to replace the content of that div with other content? <TheXL> Hmm, works in Gecko most of the time in my experience <rajesh> if you're using innerHTML, i think it also means you're usin responseText <frb-away> it's always worked for me <rajesh> i just create the element, and append to it when i need it. <steve_> alert(div.innerHTML); shows me correctly the current contents of the div <rajesh> steve_: innerHTML failure code 0x80004005 <rajesh> google that <rajesh> i'm sure it works for most people <rajesh> but i wouldn't do it <frb> then how would you set the contents of a div? <rajesh> but then, i just started working with javascript recently <frb> don't just say to not do something without an alternative <rajesh> frb: document.getElementById(divid).appendChild(whatever); <rajesh> ? <frb> and what is the child if you want to just create text? <frb> or do you propose that if I wanted text with 4 images, I would append each of them separately? <rajesh> ahh, interesting. that would fail if it's text? <rajesh> why would it? <frb> well, what kind of child is text? <steve_> I have a whole bunch of xhtml to _replace_ the current code. So I also need to delete the old content... <rajesh> does innerHTML replace? or append? <rajesh> replace. <rajesh> ok. <Burninator> but you shouldn't use it if you can help it, rajesh <Burninator> use DOM! <rajesh> Burninator: that' what i've been suggesting. <rajesh> i was just wondering ... <rajesh> that's all. :) <Burninator> k <BarnacleBob> in firefox can i trap someone hitting the back button or backspace (navigate backwards in the history). i am using an AJAX style framwork for navigation and that is just detrimental as it kicks them out entirly <frb> Burninator: what part of the dom should be used is my question <Burninator> frb: to do what? <kosh[-1]> hi, I've got a page where I'm using a script block to find all the tags <textarea> and output them, it finds ONE tag, where there is clearly MORE than one, there is three <frb> Burninator: replace the content of a node <kosh[-1]> I've got the page source open and I can see three of them <Burninator> frb: nodeValue <kosh[-1]> so any idea why these textarea tags are "hidden" <frb> Burninator: and I can put HTML in there? <rajesh> kosh[-1]: getElementsByTagName('textarea'); <kosh[-1]> rajesh: i'm using that to find them <Burninator> you don't insert html via dom <Burninator> you insert nodes <kosh[-1]> except I'm saying "textarea" and not ' ' <Burninator> you have to create each node <frb> Burninator: so if I wanted to have text with 4 images interpspersed, I'm supposed to add text, image, text, image, text, image, text? <Burninator> yes. <frb> that's a pain the *** <Burninator> it's not that bad if you do it right <BarnacleBob> kosh[-1], objs=getElementsByTagName('textarea'); for(i=0; i<objs.length; i++){ print objs[i].value} <frb> and to replace the whole content, I have to kill all 7 nodes, and create 7 new ones <kosh[-1]> BarnacleBob: yup, again, I'm doing that <kosh[-1]> i'm preparing a pastebin with the entire page source, might help
Return to javascript or Go to some related
logs:
osdev brainstew irc trondheim math
|
|