if Im making a list from a AJAX database call should I build up some HTML and then use innerHTML or make DOM elements
I am pretty sure it iwill
Many things glitch in Opera
i've tried to implement simple benchmarking on this http://dev.byron-adams.com/jquery/plugin/appendDom/ by subtracting the start time ( new Date().getTime() ) from the end time but im not sure if i did it right, do those numbers
at the top represent ms?
thanks for the compliment on my little site
no problem
I'm just learning JS
all that, is it fetched from your comp or ?
I upload my music
it's only like ~20 gigs
jesus, all that is on the web?
you can stream it, too, which is cool
rsync ftw
I am trying to run some ajax with jquery that is simple calling an HTML file that also has some Javascript in it. in Firefox the JS gets executed but in Safari only the HTML is rendered. how can I get Safari to execute the javascript within the page I am calling? The JS contained in the script
works fine in FF but $.get("includes/shc/p2.php", function(data){$("#p2Div").html(data);}); doesn't work in Safari, the JS that is. any idea
folks…. are relative path names that i use in JS relative to my SERVER or relative to my js file? (in this case, i insert a js file that is not local to my server)
hey, can some one clear something up for me. what exactly is going on here… var onpostload = { _that: null, handleEvent: function(event){ this._that.onPosLoad();} onpostload._that = this;
i think relative to the js file
are u sure?
actually.. hrmm
frig can't remember, i fiddle with this before
anyone have any ideas about the code i just dropped?
that code is missing a brakcet
var onpostload = { _that: null, handleEvent: function(event) { this._that.onPosLoad();} } onpostload._that = this;
the idea is that you want to save your |this| context. when onpostload.handleEvent() is called, |this| points to onpostload, but this._that points to the object you were originally in
oh ok
how do I see the function definition from JS shell ? for example.. the definition of Array() function
thank you
Is the output of Array.from the definition of Array function ?
eh?
opena JS shell and type Array.from enter
nothing
What are *you* expecting?
it prints something…
what is the right way to set up a whole list, and each should do something when clicked?
onclick="" on each, or a listener?
i'm in an iframe, how do i reload the parent window?
I think that will kill your iframe
don't care about the iframe
actually
window.parent.reload()
but… I guess you just use a reference to the parent window
yeah that sounds about right
hi, I want detect the duration it took a user to press a mouse button on a link. basically, the time between mousedown and mouseup. how can I do that? by the time I calculate the duration, the link will have been clicked and the browser will leave the current page.
a href
onClick="yoursillycalculations(); document.location=porno.html;"
ahhh good idea
wait, but still how do I get that duration data on my server?
"document.location='porno.html?dur='+reactionTime();"
i dunno of that works
if*
make an AJAX call to your server before sending them?
k, I'll try deebo's method and if that doesn't work, I'll look into ajax
no, deebo's will work if you can record the link time on the next page
I thought you were sending them off your site
they are being sent to another page on my website
for example, mysite.com/page1.html will have a button. they click on the button and I want to know the duration of that click. they will be redirected to mysite.com/page2.html
sure
on page 2 record the referrer and the duration from the query string
ah, nice
any way to do this transparently? using POST maybe?
it's not a huge deal I guess
that timing might be tricky though - so I have to record the value of the mousedown, then record the value of the mouseup, then do the calculation in reactionTime() hoping that the value are recorded by the time it's called
just make a hidden field and input type=button onclick="document.myform.myhiddenfield.value=reactiontime();document.myform.submit();"/
then read myhiddenfield from the request
no, you're doing the link yourself
so you control when we move to page 2
but transparency is an issue
you could ajax, or put in a form and POST
I see
thanks guys
if I'm making a list from a AJAX database call, should I build up some html hosting and then use innerHTML or make DOM elements and keep appending them with appendChild?
which is better practice?
DOM
`innerhtml sucks @ trhaynes
innerhtml sucks: If you have events on elements that are rendered via innerHTML they do not go away when you empty the innerHTML area. They may even crash your browser. You cannot use innerHTML for building items like tables in IE. You cannot use innerHTML for adding options to selects
in
elements in innerHTML are not executed.
oh wow
glad I asked
so if I'm making a table, I have to make the taboe
and then put a thead in
and then put a tr in
and then tds in that
yes
etc. ? seems tedious
and add attributes to each along the way?
`html2dom // save yourself some time
Woosta's (x)html to DOM convertor .. convert xhtml chunks to DOM scripting: http://rick.measham.id.au/paste/html2dom.htm
yes
if you already have the HTML worked out, paste it in the top left and click convert
oh nice
thankss
is something.id better than something.setAttribute('id', .. )
IMO yes
anyone know if it's possible to get browsers today to do a filtered resize of an image?
(1) you *have* to do it for className
(2) you save a pile of chars
they'll either do it all the time or not at all. You have no control
browsers just interpolate, not filtering
thing is
the new zoom feature in IE7 uses a fully filtered resize
but
just make your own lanczos resize javascript!
heh
Hi, how can i get the page height, document.body.clientHeight gives me unscrolled height.
but anyway even IE7 although it has code for filtered resizing, doesn't do it, unless you're telling it to 'zoom'
could anyone tell me by some miracle why my mouseover stopped working on http://www.forgemodels.com/model_browse.php warning not work safe some of those overs… if they worked
you have to do it for class name?
yes
IE is stupid
`className
jsbot find classname
js ref classname, js syntax classname
bah, not in the bot
oh, IE doesn't like setAttribute('class
'?
correct
it expects setAttribute('className', ..)
But that doesn't work anywhere else
of course not
so foo.className is the only cross-browser thing that works
because className is not an attribute
ok, thanks
exactly
so what if I want to make a paragraph, add some text to it, and then add it to the dom?
use the tool
var p = document.createElement("p"); ??? mydiv.appendChild(p);
var p = document.createElement('p'); p.appendChild(document.createTextNode('text')); yourDiv.appendChild('p');
ah, textnode
how very obfuscated
hey, I have some code that's sensitive to resize and load events…in IE, a load event generates a resize event as well, is there anyway to prevent this?
how can i get the page scroll value?
what about getting things with innerHTML?
is that kosher?
don't worry, found the answer ( document.body.scrollTop)
how would i fix the quotes so that the src="" quotes dont interfere with the onclick quotes?… a href="#" onclick="$('large').update('img src="test.jpg" /');"test/a
yeah, I treat innerHTML as read-only
or write-for-non-markup-content
bold"
rather than creating a textnode, an I element, with a text node, then another text node
hi all. how to debug some javascript hosting code?
`firebug
Debug your Javascript in Firefox using Firebug: http://www.getfirebug.com/ .. Or use Firebug Lite for debugging in non-firefox browsers: http://www.getfirebug.com/lite.html
thanx
any ideas on how to fix the quote issue i have above?
preceding the img src="" quotes with backslashes doesnt work
The paste 255201 has been copied to http://erxz.com/pb/3962
jsBot, thanx for firebug again. all my problems disappeared
`bot @ iobit
bot: Hey! I'm a bot! I appreciate the sentiment, but you might want to thank whoever told me to tell you that!
)
Woosta, tnx
hmm, any easy way to check if a text areas content has changed from the original?
to like bring the users attention to the save button
if(yourTE.value != yourTE.defaultValue){…}
(Which may not be cross browser)
I can't remember
How can i have contents of some div tag hidden?
set its class to hidden
TE has a defaultValue?
ie. the one it was inited with
all form elements do (at least in FF .. as I said, no idea if it's cross browser .. but the defaultValue gets used when you reset() a form)
ah
hmmmm
have to look into that
moin
can anyone tell me why i get the flickering on the mouse over?
http://www.forgemodels.com/model_browse.php like go left to right, each letter of the name causes a flicker
www.thenextbyte.com/videos you can see what i am talking about if you cant get it to do it with your own browsers
hmm why wont a basic textarea format text with CRLF row changes?
what is the best way to work out what IE means when it says there is a javascript error on line 64? of which file?
Did MS change the designmode engine in IE7? Now it adds a generator tag that is strikingly similar to the one MS Word adds. And it behaves differently with styles
hmm anyone knwo a website that has test data in weird languages and character sets?
like chinese/japanese characters etc
lorem ipsum for businesslogic
Just do a search for Unicode test page.
utf test page, yes
http://www.columbia.edu/kermit/utf8.html
unicode OR utf-8 test
That ought to do it.
ah that'll do, thanks
learn utf8 test = http://www.columbia.edu/kermit/utf8.html
hello? jsBot?
I'm a talkin' to you
`js ref
You're not a talkin' t' me though huh?
How to delete element definitely? I know i can use removeChild() but the element probably still exists in RAM after deletion.
If there are no pointers to it, it will get garbage collected
Anyone living in EST?
does the unescape() function has a maximum string length?
near Estonia, me
no, EST - Eastern Standard Timne
time*
DD
sorry
hi i hv a prob
i want to reload a form by another form
both form has no relation
reload a form?
yes
explain..
from another form without using any parameter
what do you mean with refreshing?!
actually i hv a pop up window which parent window has two separate form i hv to refresh one form of them when any changes occur in popup window
another form of parent window should not be refresh
How do I check for if a variable is 0 or false?
if a == true
===
ok thanks
Is there a way to make onblur="value='please input something'" happen only if value='' ?
yes
How?
onblur="if(value='') value='please input sth'"
SlimG, 3
er du her ja
hehe jeg er overalt
I forgot to mention that the onblur is a html tag, not javascript, sorry
s/tag/attribute/
Thanks GarethAdams
yes, should work anyway