Ive been reading some code and I saw someone do thisname = getName and then rigth after they do name = thisname
for saving values on the page, i use hidden_fields. but is there a better possibility to save the values in js-variables?
how do you save values on the page?
narcissist, it might be possible to use a transparent div with gray borders, and then applying transparency to it, only need to calculate borders sizes…
border sizes can be 99999 in that case, right?
but how do i set transparency on a border?
but that’s true. don’t want all the site to be semitransparent. hm.
narcissist, yes, theoretically, but a bit of calculation probably makes it neater..
using in IE the filter object
and in ff?
hmm, I think it supports rgba colors
a as in alpha (255 value transparency
okay
does concat() also join arrays or does it just add one array to the other?
join as in creates a comma-separated string
Greetz. Is there somehow I can store an entire HTML page into a variable without adding slashes in front of every single quote or replace them with pings ?
slashes = backslashes
Is there an onClick which not only checks the cursor click, but also the keyboard press?
In DOM.
Combine the use of onclick and onkeydown
Hrm.
That requires html host bloat.
Isn’t there a common one?
Like onFollow.
Nope
That sucks.
No it dosn’t – it keeps JS a simple and small scripting language
Hehe… JS simple and small…
you probably heard this before but… how to get rid of the dotted rectangle? and don’t tell me I don’t want that
can I make a JS button without an in-body img that steals focus?
Coppershade-org^, onfocus=”this.blur()”
that easy? cool!
thx dabear, trying it out
the element will lose focus though
well, for these buttons it’s cool since they load another page
:p
hehe
Coppershade-org^, it worked?
still there
it was for the img tag, right?
hm, for the a-tag usually
yep, worked.
thanks!
btw, do you get HUGE text when you go to bitbrain.se
?
nej, det gjör jag inte
swedish? heh
good, just a persistent FF cookie then
what’s gjör by the way?
he means gör
yeah :p
gör=does
and this is what?
my first webpage
anyway, gonna fiddle with it later
now I’m going fishing with my bro
so “nej det gjör jag inte” means “no this does me not?
no that do I not
“no I don’t”
oh right..
swedish is the Shit
funny, I deleted the cookie and cleared the cache and pressed ctrl+f5, still there
prefer norwegian tho.. 0o
heh why is it better?
Coppershade-org^, ctrl+o
because it’s my native tongue
mothers tongue*
ah, so that’s why you wrote gjör!
cool
yep
didn’t see the error before after I posted ^^
!paste
SamuraiDio, hey my love! 3
“SamuraiDio” at 71.6.194.243 pasted “elements.each is not a function” (12 lines) at http://erxz.com/pb/3898
can someone gimme a clue
?
you need to load prototype?
thx guys, bbl
dabear, as i know its loaded, but may be an old version
its version 1.4.0
morning everyone
SamuraiDio, upgrade
and use $A around elements
dabear, how do i use $A?
rtfm, please
dabear, cannot i use the same loop without using prototype?
you can’t
hi.. i think i am getting strange behaviour when posting a value to the sever.. i do $(‘mycheckbox’).checked in and call a php method with ajax using this value json’ified by prototype.js. … if it is indeed checked, it seems to be json translated to the string ‘1′ and if its unchecked, its
translated to empty string ”.. why are these not translated into ‘true’ and ‘false’ strings ? bug or am i just doing it wrong
you can’t use endsWith either then
var val = ($(‘mycheckbox’).checked) ? ‘true’: ‘false’; equex
or the equivalent php host true and false objects
hehe nice thanks
“SamuraiDio” at 71.6.194.243 pasted “elements.each is not a function” (12 lines) at http://erxz.com/pb/3899
this way?
ahh,. lemme change it
no..
just use elements = $(document.getElementsByTagName(‘a’));
Is it possible to split a string on multiple lines like in PHP ? var myStr = “data [linebreak] more data [several linebreaks]“;
.. without using myString += “data” on every line
“SamuraiDio” at 71.6.194.243 pasted “$(element).src has no properties” (12 lines) at http://erxz.com/pb/3900
Jemt, sure, please epxlain a alittle better what you wanna do
forget what i said
I would like to place some HTML in a variable directly in my JavaScript – like this : http://pastebin.ca/645361
But without adding a ‘\’ in the end of every line and so forth
not sure it’s possible
you could use a wrapper function though
as the “(” and “)” in the function would limit the string so js understands where to break
The paste 645361 has been copied to http://erxz.com/pb/3901
Ah, great! Good idea
Thanks, dabear
dabear, i wanna add the highslide class and method to all image links of my page
“SamuraiDio” at 71.6.194.243 pasted “$(element).src has no properties” (12 lines) at http://erxz.com/pb/3902
The paste 645365 has been copied to http://erxz.com/pb/3903
Yep
is there a property of the string object that contains the number of characters contained in the string? or no
k0rso, ‘abcd’.length // yields 4
woot it works. thanks
my nameservers are down so there was no looking it up for me
I’m so excited!
My first ever game, written totally in Javascript, is getting really close to being ready to call it v1.0
there have been days I’d never thought I’d reach this point rofl
there was just so much stuff I wanted for a 1.0 release and the list kept getting bigger hehe
sweeeeet
it is sweet
I’m excited
I’m still not too happy with how it ‘looks’ though.
you’ll have to show when its all done yeah
Maybe I’ll implement some sort of ‘theming’ system first, so other people who don’t like how it looks can choose from some different themes
you can take a preview look, if you’d like. http://worldofsolitaire.com
wooo
thats sweet hah
did it load okay for you? which browser?
firefox
looked/worked great man
tag, what is it represented by?
its called image host something or another
you mean the Image() object?
i just cant think of the word
tag are represented by image GAAH
i need my net
heh
i hate quest
Sembiance, what’s the total size of the js?
“SamuraiDio” at 71.6.194.243 pasted “$(element).src has no properties” (24 lines) at http://erxz.com/pb/3904
According to YSlow, about 680K
why does the return false does not work?
When gzipped though it’s less
the hs.expand() function returns false
looks like 147K when gzipped, 680K expanded.
SamuraiDio, because an element may have multiple even handlers. if multiple handlers return different results, which should decide?
Sembiance, yeah, seems so, i installed YSlow too, never heard of it before
SamuraiDio, event.preventDefault or Event.stop
dabear, im using Event.stop
man this game is addicting i haven’t played it in forever
how do you chace an image?
cache*
dont you create a new image usnig image()?
k0rso, I believe so, but it’s been a while
I’m trying to use window.setInterval() within a class; how can I have the callback method be within the class as well? code: http://pastebin.ca/645379
KNY[yawn]: The paste 645379 has been copied to http://erxz.com/pb/3905
I used to create image() objects for each one
but that was too slow, loading images one at a time
So now I create HTML text with all the images, add it to an offscreen DIV with .innerHTML, I have oncomplete/onerror/onabort events for each image so I know when they complete loading
this technique is super fast, as the browser will load several at once.
in an HTML select name=”NOYES” size=”1″? I am trying to make a drop down menu that connects to points in the page a name=”NO”/a
anyone know of a more refined version of “lightbox gone wild” ?
how can you get the XML result of a post form? I’m quite sure it is possible? Can someone point me in the right direction please? I have not succeeded in finding any info about this on Google.
how can i include a string in the name of a function?
hi
I have a question:
how can i enable the iframes?
how am i able to check the filesize of an image. fileSize only seems to work in IE
moogalyn I believe you can’t, since javascript are not allowed to read files. You’d have to check the file size server side
how do you createa javascript hosting url
thanks
anyone?
js ref
`js ref
http://developer.mozilla.org/en/docs/JavaScript , http://devedge-temp.mozilla.org/central/javascript/index_en.html , http://phrogz.net/ObjJob/ , JScript@MSDN: http://tinyurl.com/9pk3l , www.crockford.com/javascript/
what are the two types of css classes?
regular and is there another one?
where is the error? im trying to change a td background color
document.getElementByName(“under”).style.backgroundColor = “yellow”;
TD.style.backgroundColor = ‘color’
right
error
how would I detect that a user scrolled to the bottom of a text area ?
arrrggg, what method can i use to unencode cookies
like if the cookies were encoded before being written.
Is it possible to download the result page of a post form? Using javascript of course.
look into ajax, check out mootools, then the demos, ajax.form
m308 thanks alot. I’ll do that!
your welcome
Hi, I want to change some text on a page depending on what item i select from a dropdown
any links to a example?
or ideas?
i tried a function on the onchange with document.write but didnt produce the expected results.. it just made a whole new white page with the text
Isn’t it possible to add some javascript to a page and access it from the page afterwards? I have added an onlick event to a text field like this: onclick=”test()”; – and I have added the test-function to the page too – but when I click my text field, it states the test function is not
defined
Jemt, no
No? Bugger!
you mhavbe to use addEventListener
why not?
And I can’t call functions in my User Script from the page ?
you could assign a function to window. scope :p
not sure
sure to reach m from there
window.custfunc = func;
Oh, interesting..
Thanks, xorc. I’ll give it a try
hope it works
I get : window.custfunc is not a function
hmm
maybe in an window.onload = function () { alert (window.custfunc); }
Jemt, in disregard to the prior statements it’s totally possible… wouldn’t be much of a use otherwise
im pretty sure its a race condition
why?
I agree. Just dosn’t work :p
where have you created the function
Ah, BRB
greasemonkey runs in the same scope as your original page
js domref
it just modifies the current page
`js ref
http://developer.mozilla.org/en/docs/JavaScript , http://devedge-temp.mozilla.org/central/javascript/index_en.html , http://phrogz.net/ObjJob/ , JScript@MSDN: http://tinyurl.com/9pk3l , www.crockford.com/javascript/
`js domref
w3.org/DOM/ , http://developer.mozilla.org/en/docs/DOM , www.mozilla.org/docs/dom/domref/ , www.zvon.org/xxl/DOM2reference/Output/index.html , www.krook.org/jsdom/ , http://phrogz.net/objJob/languages.asp
what method do you use to enencode a cookie that was encoded before being written
im not finding it anywhere
HAH!
Give me a sec to construct a small example so we have something to work with
dont we need greasemonkey? :p
hmm
How do I make a form submit with JavaScript?
goooogole
I bet you could just type in what you just wrote and press “I feel lucky”
lol
I’ll try that
see it says submit( )
and I tried that already
who’s doing it wrong, you or googles top-page?
probably me
yes.
0-1.
hehe
bastard
^-^
I have made this small example: http://pastebin.ca/645498 Yes, it’s a UserScript so you will need GreaseMonkey or similar. But it might just be a JavaScript error somewhere. Suggestions ?
The paste 645498 has been copied to http://erxz.com/pb/3908
yey
i got it to work
:p
You did ?
My example ?
nope im not that fast
hehe
Oh :p
so
that’s a model of my code
what was your objective again before i make a fool out of myself
hehe
Hehe
and I’m getting the error: “f.submit( ) is not a function.”
greasemonkey to access a local function?
or a localfunctin to access greasemonkey’s
?
I would like to add some JS to a page using a UserScript. The idea is to add new functionality to a website. In my example ( http://pastebin.ca/645498 ) I add an OnClick event to all INPUT elements so they alert a message when they are clicked
The paste 645498 has been copied to: http://erxz.com/pb/3908
ah oke
i have this in my greasemonkey:
Actually it would be just fine if the page could access a function in the User Script too
unsafeWindow.custfunc = function () { alert (‘a’); }
unsafeWindow.gsinit ();
and in my page i have:
6window.gsinit = function () { window.custfunc (); }
shows at least communication from the page and greasemonkey
Oh, the unSafeWindow – I read something about it earlier today. Obviously I didn’t read it carefully enough
box)? I just want to submit it… And then use httpXML to download the resulting page.
from this point you could do anything with the right logic
That’s just great – thanks
you guys develop javascript with a ide?
putty+screen+nano ^^
I’m quite happy with Zend Studio
hehe, yeah great editor cept of the constant crashing
I found one called aptana its open source and js orentated
I’m not having problems with my installation (on Debian Etch)
What version did you use ?
i used m all till the current version at the office
since a particular version ofcourse, not all of m
Odd. I’m using 5.5.0 and it’s quite stable
xorc:
hmm, well pray yourself lucky ;P
If you were using Windows, then let’s just blame Microsoft :p
using svn / cvs capabilities?
Everybody else does
nah using linux
Nope
ah, bugger
ah, maybe they’re flawed
I’m using ZS “as is” without any extensions
Yea, could be
Ah, GreaseMonkey is so great. Now I enjoy it even more
but got alot of times, the editor wouldnt highlight my code, or complete functions proper
general crashes telling me to restart it
and with 2 monitors, the popup windows go in the middle of the both screens, instead of the middle of One screen where its maximized
:p
I have expirenced no such incidents at all – but again, it’s a pretty simple setup I’m using
LOL
i kinda do full day stresstests each day, bound to find some bugs hehe
How come you don’t use vi(m) ? I prefer Nano too – mostly because it’s easier to use
Haha
but i really want a decent c coded IDE for php/js/the works
vim is for losers
Auch, be carefull – you might start a flame war :p
this aptana has code completion, ajax libraries the works
i dont want to type 4 shortcuts before i can actual make a change
hehe
if i wanna see a document, they should use ‘less’
^^
haha, I totally agree
less to nano is amazingly, 3 keypresses
beats out the vim users
We use SSH quite a lot our office, so nano and less is vital to our work
“at our”
hehe true
tail -f is awesome too
realtime tailing logfiles is to die for hehe
Yeah, absolutely. We have a php-error file which contains all errors reported. I always have a tail running on that file
find . -name “.svn” -exec rm -rf {} \; to remove the nasty svn files (or cvs)
^^
You gotta love your shell
yea, no point in getting a mouse arm tbh (:
dunno if thats a correct word though, simplified translation from dutch
Too late – I blame Counter-Strike (yea, I’ve been a young, wild teenager too
We call it a “mouse arm” in danish too
Wow, look at the time. I’m supposted to meet a friend at the cinema in half an hour, and I havn’t even picked up the tickets yet. I’d better run. Can’t wait to see the new Simpsons Movie
hehe, currently im thinking of playing wow
Thanks for your help again
all the events can be triggered by typing / commands
I’m not really into that stuff
np (:
Ah, that’s why :p
I’m off. Later
do you know a possibility to simulate class-heritage with javascript?
what method can be used to display debugging niformation in a seperate browser window??
anyone?
hey nobody never ever tried to use OO-approach in js?
most things in js are OO
they’re just not class-oriented
toretore, yes. i meant class-oriented
toretore, i had some experiences with c++ and it looks quite strange to me…
creating “classes” isn’t difficult, but inheritance is kind of problematic.. i don’t know too much about it, so take that with a graiin of salt
c++ looks strange, or js looks strange?
toretore, some kind of trying to simulate heritage, but i can’t catch it nice.
toretore, js-inheriting looks strange to me.
maybe http://dean.edwards.name/weblog/2006/03/base/ will work for you
i think there are lots of different approaches to inheritance in js, but not everyone agrees
toretore, ) i read this page some minutes ago…
i have an address field on my page, next to a google map. as a user types in an address, i want the google map to show the address. any ideas how?
hey everyone
hiiya rockerserver
what’s up, Sembiance?
not much, just getting closer to finish my javascript game
you?
0pm yesterday, i have 3 computers
AND! they all work
congo rats
haha
windows 95 doesn’t like CD drives too much apparently
is there a way to move an object from somewhere in the object to the end of the object?
e.g. if the object was {one: 1, two: 2, three: 3}
how do I move two so it becomes {one: 1, three: 3, two: 2}
?
anyone have any idea how to detect when a user hit the bottom of a text area?
please?
dmitrig01, why do you need them in some other order?
d I am not sure exactly how you are refrences them
*refrencing
because I am iterating over them and the order matters
I am creating a system with windows, and it matter what order I set the css z-indexes in
so the proper one is in front
how about a simple c=a a=b b=c ?
or hold them into an array and push/unshift it
push/unshift ?
it could be anywhere in the object
splice?
does that work for objects?
I would use it, but I’m not sure if it’ll work
dont know, but i thought you could use an array of objects
p
anyone know of something similar to this with visual effects? http://www.dynamicdrive.com/dynamicindex17/virtualpagination.htm
I’m looking for it to slide out and the new one to slide in
Similar to the effect on www.panic.com/coda
what do you mean by an array of objects?
it needs to be pretty quick, because this is going to execute quite a bit
that would! thanks!
fast response, np
does it work in IE?
never tried, but i guess it does
good!
hey
can I put default values in functions?
like function bla(ola = “blsaasd”)
no
http://parentnode.org/javascript/default-arguments-in-javascript-functions/
It’s a short read.
thanks fatbrain
np
hello guys, I have a (simple) javascript question
I have a form with submit button. The button has an attribute onclick=”javascript return function_name()”
The function function_name is an ajax call. If if returns false, the form should not be submitted, if true, it should be submitted, right?
michuk, you should use the onsubmit event on the form tag
or… you submit the form thorough ajax?
or just have a checj with ajax then submit the form classicaly?
the form should be submitted clasically in 2 cases:
- when JS is disabled
- when the AJAX function returns true
then you need the onsubmit event on the form tag, the same way you used it on the submit button
then you need the onsubmit event on the form tag, the same way you used it on the submit button
Amenthes, ok, I think the onclick should work as well
when the function returns false, the form is not submitted, so it’s fine I guess
anyway
the problem is different — this was a kind of long introduction
where can I paste some code?
oh I see the subject
http://erxz.com/pb/3909
here it is
this is the function that is called in onclick
now, in handleDiggResponse I’m changing the variable “result” to “false” in the cases I don’t wont to submit the form
but it doesn’t always work — it seems it works sometimes and sometimes it doesnt
I know almost no javascript so it probably is something trivial, but still I would be very glad to know where I’m wrong
Amenthes ?
looking right now on your piece of code
diggxhr is an XMLHttpRequest object if this is impotrant
var bla = new Array(4); will bla[0] equal to “” or to null ?
or undefined?
anyone?
michuk, how does handleDiggResponse look like?
Amenthes, http://erxz.com/pb/3910 –whole code
Acs, it will be undefined
dabear thanks
dabear do you use prototype.js?
I am trying to create an array inside a class
but it doesn’t seem to work
Acs and undefined == NULL
cool, thanks
so it would be equal but not identical to null
this.celulas = new Array(3) — is this wrong? I have this the initialize function of the class
michuk, i think i know why sometimes works and sometimes it doesnt
Acs imn using prototype yes
Acs what are you trying to do?
Amenthes, what’s that?
create an array inside the class
michuk, it is because your function might return before the ajax call has completed, so, the function catches the result variable before it gets changed
ah
it may be
yeah, bu you could just use this.celulas = []
how do I fix it then?
less code :
yeah
but it has to be an array of arrays
so I have to do new Array inside of that
..
what?
this.celulas.append([1,2,3])
anyone have any idea if you can send parameters to a google map with javascript?
a new array inside another array
Amenthes?
right
johnny5, no
michuk, thinking but aparently no idea right now
so the best way to have an input field alter a map is with an ajax replace of the map div?
isn’t there something like “synchronize” in javascript?
so that one function needs to wait for the other to finish?
javascript is single threaded.
michuk, what if you return in handleDiggResponse ?
no need to synchronize anything in javascript.
fatbrain, oh, i see
Amenthes, I tried that before and it worked the same
but I’ll try once more, maybe I did sth wrong
dabear
I am doing this
for (var n = linhas;n = linhas;n++)
this.celulas[n] = new Array(colunas);
but in another line of code I do this
if (typeof(this.celulas[i][n]) != ‘undefined’) and I get a this.celulas[i] has no properties
linas = 5 and colunas = 5
never paste code in the channel.
Use a pastebin like everyone else.
fatbrain I know, sorry but it was these lines
just*
and never ask for code help using non-english variable names
probably because this.celulas[i] – points to an index where you don’t have an array stored.
??? what’s the problem? it’s just the name of the variables
right
which others don’t ujmnderstand
understand
fatbrain but I do, in the loop I go through all the array and place a new Array
I am not helping people who dont write englkish var namnes
is it the same loop you do the if-statement?
if not be sure you have the same condition as the first for-statent. i.e. n = linhas
Amenthes, ok now I see how this works and indeed this is not as simple as I thought
Amenthes, I cannot just return something in handleDiggResponse because that’s not just ajax request works
found the problem
fatbrain thanks
np
should be var n = 0
how can I place in the CreateTextNode, but make it not appear but just the space it is suppose to appear
anyone?
Acs, probablu encode & as &
so…
aa cool
no
doesn’t work
now I get
lol
I just want the space
is it possible to, within a div, select all images and reload them if they’re in a specific folder? getelementbytagname + set new src if src = …
will it automatically reload if i specify a new src?
narcissist, i guess i would
it*
how do i access the src once i’ve found the img-tags
getAttribute(’src’)
hi
im looking for a script with ajax that lets you edit data tables while clicking on the cell and changing its content
is it possible to get the backgroundImage from a div or is it write only?
with getComputedStyle and currentStyle should work
`getstyles
Wrapper function to retrieve computed styles of an element: http://www.quirksmode.org/dom/getstyles.html
hey, how can I include the contents of a variable in the actual name of a function?
you don’t
The correct way to do it is using ’switch’
the hack would be to assign functions to an object and call the keys using the var
i want to construct various objects dinamically based on what the user chooses…
and they would have to have different names..
well im looking for an editable datagrid using ajax, something simple
why does the name matter?
because if i create functions dinamically i need to have a way to differentiate them, and then to be able to reference them
phpAdam, try ExtJS
i want a regexp to match /[a-z]\/[thesamea-zagain]/
how do i accomplish that?
…
you want to replace a letter with itself?
oh, the same letter again
no, i want to replace that whole string with another string
/([a-z])\/\1/
ah!
{3-5} is 3 to 5 chars, right?
{3,5}
okay
thanks!
it’s times, not chars. rather occurences.
what’s repeated isn’t necessarily a character; it could be a group, or an anchor (though that’d be pointless)
Does anyone know if it is recommended to use the Dean Edwards scripts for IE6? Or will I encounter more problems than solutions with it?
okay, guys
it only replaces the second part of the string, ie the \1. any idea as to why?
no, but I don’t know which regex you mean
cstr.replace(/([a-z]{5,50})\/\1/, “asd”)
test/test becomes test/asd
what’s the input string?
because “test/test” isn’t affected at all
http://localhost:3000/tailor/shirt/images/white/white_0001.png
oh wait. think it’s working
hellp
hello*
I am using prototype’s class object to create a class that creates a few rows in a table. Is it possible to pass to those rows a reference to the class?
like I add an onlick event to those created cells and then I want to add a reference to the class
is there a way?
anyone????
I’ve been reading some code and I saw someone do this.name = getName(); and then rigth after they do name = this.name; can someone explain what is happening here and why name would be declared again? does it have to do with scopes?
I wrote something very similar today, actually. The first assignment sets a property of the object; the second a local variable, probably just to save typing
hello, can I run 2 functions onmouseover ?
foo.attachEvent(‘mouseover’,function1);
foo.attachEvent(‘mouseover’,function2);
I think the event name needs an “on” in front of it in certain browsers
also you don’t get any control over the order in which they’re run
it may be easier to wrap them in a custom function and just attach that.
hmm
can I do onMouseout=”function1(),funtion2()” ?
or something like that ?
No.
well, you can inline
div onmouseout=”function1();function2()”
aha
okey let me try it
hmm
I guess I got a problem
it is an img
but no href or something for it it runs a function
I tried to use document.src=’bla.jpg’
but it didnt work
Jan-: Thank you anyway
I’m sorry for my newbie questions
no problems
Jan-: can I paste a code?
2 lines I guess
If it’s more than three short lines, use the pastebin in the channel topic
menu1[0]=’a href=”http://alkonouz.com/mp10.html” onmouseover=”document.mp10.src=’images/v6ova.jpg’”
onmouseout=”document.mp10.src=’images/v6.jpg’”img src=”images/v6.jpg” name=”mp10″ border=”0″ hieght=”25″ //a’
how to fix that?
the ‘ thingies I guess
right?
Um.
Why are you putting HTML code into an array as a string?
its working but when I added the onmouseover thingie it screwed
You’re using innerHTML, aren’t you
Don’t. Especially when doing event handler stuff.
You will cause yourself a lot of grief.
hmm
hehehe
completely newb question, but what exactly is the difference between mootools, prototype, dojo, etc? is it simply a matter of preference for the most part?
Yeah. There are differences. I know Dojo has a reputation for being slow.
But frankly, it’s mainly a religious argument.
Go read some independent opinions on them all.
Jan-: *nod*, I was just curious if for the most part they’re wrappers that have the same end goal.
I hear prototype this prototype that, but only recently have heard of mootools .. so was just curious.
I haven’t used any of them in anger.
it’s a religious argument.
I suspect it also depends exactly what you’re trying to make it do.
*nod* makes sense, thanks Jan-
sorry I can’t be more help
plenty of help you’ve been
hmm, I just pulled a yoda with my subconcious mind
Like speaking Japanese, it is.
Hungry, I am.
Backwards, my syntax is.
hey guys … how to search for some text on page and if it matches to make link of it ?
with regexp
Hey all.
hey
I’m trying to work on the children of a specific element of Id X.
I can get the element.
However, then I try to get the children, it doesn’t work.
For example, alert(elem) gives “[object HTMLUListElement]“, whereas alert(elem.firstChild) gives “undefined”. However, if I look at the innerHTML of the elem, then it shows the HTML of the two children in the element.
you got firebug?
Firebug?
the extension for firefox
I don’t use Firefox, I’m afraid.
your developing with javascript and dont use firefox
?
Um, well, I don’t want to do a lot in Javascript.
Haha, it was kind of forced on me, and it’s a minor script, so I didn’t want to go out and do ALL that for just a little script. :-/
ah, well i would still suggest just checking it out, use it to debug simple problems like this
http://paste.lisp.org/display/45635
That’s all I’m trying to do. :-9
Alright, I have firebug, but this is still not making any sense.
elem.firstChild.style has no properties??
How do I sleep for a given amount of time?
setTimeout doesn’t seem to work really well, as it returns and execution continues.
you cant
cant do that in javascript
you just gotta use setTimeout the best you can
Hrm.
Okay, so if I wanted to change something (like color) every X seconds, is there an idiomatic way to do this?
hmph. If I wanted to give the user an option to add an option to a select field, would a library like prototype/jquery already have that featureset to make it easier?
oops
well
what you might wanna do
is something like setInterval(changeColor,seconds*1000);
setInterval calls the function every arg2 milliseconds
anyone have a link to a nice slide function?
slide?
of what type?
www.animepaper.net – like they have when you click the login button
How can I send a command to my flash video?
Hello
I was wondering, is it possible to inspect an image to find out the color value of a particular pixel in javascript?
Is it better to get web pages validated as xhtml 1.0 or html4.01?
HTML 4.01
I really don’t know the difference, just some syntax it appears
There are some big differences, but most browsers will try to treat your page like HTML 4.01 no matter which you use
So it’s best just to use real HTML 4.01
in your document, since the validator doesn’t always point out the errors (for some complex technical reasons I can get into if you want)
I wrote an article on the subject of HTML vs. XHTML you can read here: http://www.webdevout.net/articles/beware-of-xhtml
what about
is fine
xhtml wants me to br/
is bad in HTML
character in the page)
Although none of the major browsers treat it the way they should.
But the W3C Validator sees it as
I did a short site with xhtml, just to see if I could be compliant.
Ill check out your article.
There’s no point in being compliant with XHTML. It’s a dead-end standard. XHTML 2 isn’t even compatible with XHTML 1.x, and XHTML 2 may never see the light of day anyway. Everyone’s focused on HTML 5 right now
dead-end my ass
?
who has a dead ass?
Why does Opera, but not Firefox and MSIE, understand “if (anchor.rel.match(‘nofollow’))”?
Safari doesn’t get it either.
What am I doing wrong?
I’d have to see the rest of the code
nanobot I sorta assumed since I was using an xml file that I should write it as xhtml
But no major browsers are going to treat it as XML. They’ll treat it as HTML.
And you’ll encounter some big differences between when user agents treat it as HTML and when user agents treat it as XML
I am trying to disable radio button clicking. At present, I use cancelBubble and stopPropagation() and still the radio button shows up clicked.
What is the right way to disable a radio button?
“anchor” is a var of type… a.
disable or uncheck?
disabled=”disabled”
reisio=”fat”;
*squish*
Why does Opera, but not Firefox, Safari and MSIE, understand “if (anchor.rel.match(‘nofollow’))”? What am I doing wrong?
try anchor.getAttribute(‘rel’)
You mean anchor.getAttribute(‘rel’).match(‘nofollow’)?
yeah
You really need to give us more information. The line you posted should work in all major browsers unless you have a problem elsewhere
That caused Opera too to fail.
Hrm.
What’s the exact value of the rel attribute?
rel=” dfdfd dfdd nofollow ddfd”
Or rel=”nofollow”.
It could be anywhere inside it.
Try .match(/\bnofollow\b/)
With quotes, I assume…
No
Not for regular expressions
Really?
Well, once again, Opera is the only browser who gets it.
Ah, according to the ECMAScript spec, the parameter for match *must* be a regular expression, not a string. That’s why the browsers were failing; you were giving it the wrong kind of parameter.
(And yeah, I update them before I try.)
Hmm…
i have td and text in it ( You are a capo and your members made a profit of $ 58,989 for you. ) … and i want to remove ‘You are a capo and’ from it … any way to do it ?
I was wondering, is it possible to inspect an image to find out the color value of a particular pixel in javascript?
Well, 1) Why do regexps in JavaScript lack quotes around them? 2) Like I mentioned, only Opera still seems to get this.
In JavaScript, the / character is sort of the “quote” for regular expressions
Well, I know that you have special “quote characters” in regexp, but still…
In PHP, you still have to quote the regexp that you send to the engine.
option set
In PHP, you’re including the regular expression as a string which gets sent to the regexp engine and parsed as a regular expression. PHP doesn’t have “native” regular expressions
Try if (anchor.rel.match(/\bnofollow\b/) !== null)
Same…
Well, we need more information. It works here.
How are you testing it?
http://www.webdevout.net/test?04
My server returns ‘Content-type: text/html’ for html documents and ‘text/plain’ for xhtml documents
So your webserver isn’t configured to serve XHTML documents properly
If I embed an image from another domain, and that domain sends a 302, can i use javascript to get the new src url of that image?
Not AFAIK
I have found the error… the regexp seems to only check for rel=”nofollow”, and not rel=”whatever nofollow” etc.
I have no idea how to fix that, though.
It works both ways in my test case
Wait… hmm… yeah.
I think your error is somewhere else
How did you set the anchor variable?
Let me pastebin.
Someone at 71.6.194.243 pasted “if (!document.getElementsByTag” (12 lines) at http://erxz.com/pb/3913
That looks okay to me
Where is this script element?
Apparently the browsers don’t.
It’s an external .js file.
Is this inside a function?
It detects only links with rel=”foo nofollow foo”.
Not rel=”nofollow”.
Yeah. Inside a function.
Which runs onload.
Okay
tag where it doesn’t work?
a href=”http://www.example.com/” rel=”nollow”parrots rule/a
…
nollow?
Sorry. I mean nofollow.
Is that the *exact* code from your HTML?
Yes, but I changed the URL.
The page with a single link like that on it doesn’t show the alert.
The page with four links on it with rel=”foo nofollow” show the alert four times.
Can you please paste the *entire* HTML exactly as-is into pastebin or something?
Preferably the whole JS too
?!
I thought I had given all info.
I don’t see any problem in the code that you pasted, which means either the problem is on your end or it’s somewhere else in your code
Does my test case work for you?
Konqueror doesn’t interpret xhtml files as xhtml. The examples in your article didn’t make sense till I used firefox
Yeah, Konqueror and Safari have especially bad XHTML support. IE has no XHTML support at all
Konqueror is going to dump their engine and replace it with Safari’s WebKit
(WebKit was a fork of Konqueror’s KHTML and they still share a lot of the core code)
WebKit has come a long way from Safari 2 to Safari 3, at least on the CSS front
However, the Safari team officially recommends using HTML instead of XHTML.
hey im stuck. what method has two arguments, ad starting index number and an ending index number, and can be used to remove the question mark from a query string?
i know there’s one out there but i cant find it anywhere
i think it has two arguments…i’ve used it before but i’ve drawn a blank
Yes, Nanobot… your example works for me.
I must be doing something wrong. Sigh.
Time’s just running away.
slice maybe?
If you’d paste the entire contents of the webpage and JS, I might be able to find the error
I dont think that’s the one. let me look that one up now, it could be!
I find those colorful buttons on your Web test clickable and attractive.
It’s kind of complicated… I think I’ll just drop it for now before I go berzerk in my room.
Thanks
The test system was rather ugly when I first made it.
I gave it a visual overhaul when I implemented the save system
thanks! slice() worked graet
great*
I believe slice was renamed to sierra mist.
indeed
wait it was renamed?
I never new that Sierra Mist took the old name :O
slice…hrmmm
squirt
I’ve been craving a fresca for some reason
fresca is good!
Power to the lolis.
Yeah, Slice was Pepsi’s competitor for Sprite and 7-up, and they started making a bunch of different flavors of Slice, and then renamed lemon-lime slice to Sierra Mist
Speaking of lolis…
that’s weird
isn’t Pepsi the main 7up distributor?
Damn its a good thing I asked, when I open my file as xhtml on my computer it is an xhtml file, but it has problems. Even though it validates.
And when I open it as an xhtml file from my web host it is read as plain text
Pepsi doesn’t have rights to 7-Up in the U.S. It has rights to it elsewhere
In the U.S., Cadbury owns 7-Up :/
rights?
yeah I know they don’t own it
they still distribute it
Rights to the brand
dr. pepper is done similarly
7-Up was originally called Bib-Label Lithiated Lemon-Lime.
I think the name change was a good marketing move
…
im stuck again i know Navigator has some method in the Layer object to move a layer a specified number of pixels from it’s current position
but im not finding it anywhere either =/
Eww.. this anime has English dubbing
Navigator?
Layers?
What year is this?
It’s called CSS
element.style.position = “relative”; element.style.top = “2px”;
i know but im just trying to remember what method in the layer object in navigator is used to move a layer a specified number of pixels from its current position
not css
“b0nn” at 71.6.194.243 pasted “function pullLever(){ imageArr” (29 lines) at http://erxz.com/pb/3914
In modern browsers, that would map to CSS anyway
erm. Im trying to rewrite a table cell, but it doesnt work
How do I troubleshoot it, or whats wrong with it?
oh i get what you’re sayin
What function can I use to escape quotes?
\”?
is there a property of the window object that write debugging information to the browser’s status bar?
By default, Firefox doesn’t let scripts mess with the statusbar text.
Generally, though, you would do window.status = “whatever”;
…if you were a vagina
Don’t hypothetically call people sexual organs
lol
don’t be a crazy border-line pedophile :p
grr whats the first step in caching an image
Oh, don’t worry, I’ve seen my 8-year-old 200-pound step-cousin in a swimsuit. That’s enough to convert the most incorrigible pedophile into a MILF-banger.
For rollovers?
for any image
rollovers sure
You should probably use a CSS background instead of an img. Put each state of the image in the same image file (one above the other) and crop it with CSS so only one state shows. Then, when the state changes, just shift the background-position appropriately.
oh yeah i know, im just curious as far as caching an image
oldschool
stupidschool
Oh, I don’t know about any of the oldschool stuff
creatre a new image using the image() somethin or another
lol
I just came upon the horrible revelation that Haruhi Suzumiya season 2 is going to have Lucky Star references in it.
When two series both have blatant references to each other, does that cause dimensional rifts?
Perhaps that’s how they travel to the dimension where Haruhi never existed (and Asakura makes an appearance! 3 )
is document.writeIn() not even supported by modern browsers (including ie6) anymore?
You mean whiteln ?
*writeln
what?
L N?
Yeah
line
oh.
lo.
pwned by l337 custom fonts
I337
i was lookin at this guy’s design on some css gallery
i thought it looked like a de dust 2 map
rofl
after playin dust2 forlike 15 hrs
My professor asked me to write a 10,000-character essay on international standards bodies. Here was my submission: T9998e
?
ignore him; he’s stoned off of animes
always
script language=”JavaScript” src=”filez.js” type=”text/javascript”/script
There’s something missing in my life… …. …. maybe ice cream
dun hav 2 yewz language atrubute
what theGZA said
LOL
it’s also thoroughly deprecated
Never use language
Use language
If someone like Nanobot has a gun to your head asking you to use language
But IE won’t load more than one script if Idon’t use it.
=_=
?
bullSHII
The language attribute doesn’t exist in HTML 4.01 Strict. It was replaced by the type attribute.
Nanobot
You should argue with deathshadow
HTML 4.01 Strict vs XHTML -_-
so should I use ‘type’?
yez
type=text/reisioscript
Oy. I’ve had enough of those arguments. People who know the facts and still stick with XHTML do so for no logical reason. They just “like” it better.
meh
deathshadow is very technical though
how to search text for element and if matches to cut it off ?
probably the most knowledgaeble guy ive ever met
as fast as html and shit
Well, ask him to read my article and then come back with reasoned arguments.
*far*
what method can be used to display debugging information in a seperate browser window?
likke
this guy goes as far as using points for fonts
saying they’re the most consistent
across diff resolutions/dpis and what not
Uhh
But not accessible, unfortunately
There’s no way he can say that XHTML presents the best compatibility
I don’t know the context and already I’m laughing.
.?
is there an ‘unobtrusive javascript’ way to pass parameters to a function on a per (html) element way?
err?
Your question is far too abstract.
what does the function do?
What are you trying to do?
onclick=”destroy(reisio);”
Inline attributes for event handlers are so passé.
hey Nanobot
I am building my own form validater that does both client side and server side validation
http://www.sitepoint.com/forums/showthread.php?t=402650
my form is generated by my code, which also sets up the validation rules (this stuff is written in php)
:p
how’s #css reisio
-_-
the same
I want my javascript to receive arguments like the regex for that element, the min and max length, whether or not it can be empty, etc
is Zoffix gone yet
“EM=current font height… but you are setting the font height to EM, so if EM means font height… Norman, coordinate… Norman. BEEP BEEP BEEP BEEP BEEEEEEEEEEEP.” – Is he retarded or something?
lolll
em != current font height, as he would know if he were to actually read the CSS spec
size?
or wugeva
or the letter m shit
the height..
whatev
dn0
em *usually* equals the current font height, *except* when used on the font-size property
Then it’s the inherited height
His reasons for not using em are completely false
I’m not going to read the whole thing, but I don’t think his premise is correct
so is there a way to do that (see above) and still be unobtrusive?
I’m getting some ice cream
I guess I could generate some cached json file that stores that information and query for it
but that seems ugly
and possibly unreliable
anyyyyone?
my head hurts reading that whole thread
jeez
what method can be used to display debugging information in a seperate browser window?
sepArate*
separate windows…
sepArate*
whoa
what the fuck
someone is using absolute position on body {}
http://webkit.org/css/main.css
webkit :p
!?!?
why would they do that
what’s the process of converting special characters in a text string, such as spaces, semicolons, etc., called?
urlencoding ?
dn0
on click. How should i go about that?
onClick=”this.style.backgroundImage=’images/bleh.jpg’;” doesnt work…
I think that absolute position thing has something to do with and IE bug
can’t remember which one, but I remember writing similar code
what does h1+p mean ?
p after h1
or somethang
night.
what ie bug
don’t remember, has something to do with getting relative positioning working correctly under some situation
eh?
but I might be wrong
the fuk
or sorry, most likely fixed, not relative
what are the rules under which javascript programs operate called?
or nothing
functions?
no no
like
hmmmm nvm lol
Three Laws Safe?
can anyone recommend a good javascript book?
heh. AI
1. A JavaScript application may never screw up for no reason, or through not working, cause a web developer to smash the keyboard repeatedly.
? :p
that reminds me
I should sue Mozilla over Firefox’s stop button (ESC key) being utterly fucking useless
I’ve broken the feet off two keyboards by kitting the ESC key over and over brutishly
Lool
Whats wrong with it?
it just will not fucking stop loading until it’s loaded it all
you’d lose.
if I actually did it, I wouldn’t
but I’m not really going to, so it’s academic
yeah you would.
nope
ok tnx
That reminds ME. My new $60 keyboard arrives tomorrow.
$60 wtf :p
let me guess
My current one has all the labels worn down and is ultra loud and sometimes non responsive.
logitech
Nope.
hacking keyboard deluxe ?
lol
AUD$60.00
ooh I se
e
https://www.techbuy.com.au/p/62239/KEYBOARD_ALL/FlexiGlow/KEYBK.asp
labels :p
uch
that is a ugly keyboard
no offense
yeah I hate lights
It just adds to the list of blue-light-emitting devices in my room.
like numlock
its the blue on the black
numlock should be on most of the time
so the light should be off most of the time
the light being on should indicate that numlock is off
:p
lol
I want some blue lights for my room
I put my deodorant in front of my external hard drive
to cover the light
Is JScript just a subset of JavaScript or is it full implementation of JS?
I am doing Windows Script Host programming and I have the manual with it, it says “JScript is the Microsoft implementation of the ECMA 262 language specification (ECMAScript Edition 3). With only a few minor exceptions (to maintain backwards compatibility), JScript is a full implementation of
the ECMA standard”
That must be it.
what’s it called when you examin individual statements in an executing program
e.x. using the alert() method
debugging
one more question. the two types of CSS classes that can be defined in an html document are regular and what else?
I imagine you’re talking about pseudoclasses, but you don’t define those.
no not pseudoclasses….
its something else
whats the method of the document object that cannot be used to change page content after the page has been rednered?
or is there one
anyone have any suggestions on using ‘unobtrusive javascript’ and also passing per element arguments?
I’ve googled it, and all the suggestions I’ve seen are limited to anchor elements
(or major deviations from the standard)
you want “closures’
http://www.jibbering.com/faq/faq_notes/closures.html is pretty good
I’m sorry I don’t see how this helps
it does, I’ve used it for that purpose
you just need to read, yes, that’s right, read
it looks like I would need to maintain a separate file to do what I want
anyoen
nope, although all my js is in a separate file anyway
I was hoping to find a simple way to have it intrinsically associated with the html element, and not clobber some other attribute
set an id on the element
then use getElementById
how about the class attribute? e.g. input type=”text” class=”required” name=”…” /
yes I understand that, but then I am maintaining the element in two files
then use class
not flexible enough
why?
Do I get it right that the official (stanard) name for JavaScript is ECMAScript?
not exactly
ecmascript is ecmascript
javascript is javascript
they have a lot of overlap, but they’re not the same
typically the only people that call it ecmascript a lot is Opera, because they like to pretend they’re some magical only-standards-implementing magical browser
I think a combination of class and id will do the trick
even if they lie about it 95% of the time
what can’t you achieve by using class?
ah, i see.
it’s not that it can’t be achieved, it is just that it isn’t as flexible as a name/value pair
As far as I understand it ecmascript is just what the standard defines, nothing more or less.
Do I get this right?
the ecmascript standard, yes
you shouldn’t really think of it as ‘the standard’, even though it basically is
ah.
‘javascript’ actually predates ecmascript
it’s wicked convoluted :p
I am wondering if I can say that programming in JScript is the same as in JavaScript.
Of course you can
But you’ll look a little ignorant to those in the know
hey someone i need help. whats the electronic identification that the creator of a js program ataches to a signed script is called?
i see
signature?
digital something
i know digital is the first word
gaah i cant think of it!
hello all
hey
I am after a function like, setTimeout, but instead of have a string of javascript as a parameter, it accepts a function
…PGP?
you can pass a function to setTimeout. e.g. setTimeout(function() { alert(‘In timeout’); }, 1000);
header?
indeed
I’ll give it a try, thank you
np
When you pass a function around, the value of “this” changes, whereas the values of other variables stay the same
at the moment I am doing, var self = this; and using “self” in the place of “this”
is there a more common way to do what I am doing?
I realise that probably didn’t make a lot of sense
this = self is a reasonable way of getting round that. most of the JS libraries out there have something to help…the Prototype library has the bind() function, for example: http://prototypejs.org/api/function
bb in 10
what are the permissions that are granted to allow a js program to access features or information that is not normally available to the program?
do they have a name
are you taking a test?
no im reading my book
oic.
from the library
good
but i dont like it lol
it asks all these questions in the “problem set” that it doesnt even have the answers too
it must be the worst book ever
yeah well i want to buy a good one but i dont know where
but i dont know what one*
howdy
hopefully there’s a pretty obvious solution to this
but if anyone is willing to help, I’m having some trouble
Shoot
alright, well I have a bunch of mouseover functions for this image map
and they all work except for three
I double-checked the code on the three that don’t work
it’s all exactly the same as the others
http://celluloid.sourceforge.net/Screenshots.html
the Script toolbar item, preview button (magnifying glass), and… ah… what was the third one
oh yeah, the Filters pane
they just don’t mouseover
you can check the code
the functions are all there
and it’s not the images to be loaded that are messed up
those are fine
I can’t figure this out for the life of me
unless there’s something too obviously wrong to notice
anyone knows why its not working? http://rafb.net/p/TZkZeQ38.html
this has me stumped…. ‘this’/'element’ not working for array items within a loop http://pastie.caboo.se/85020
hi
how can i run a script on the begining on page? the fastest i know is onload, but its too late for me…
…because onload runs when all flash animation get loaded and i want to do it before it loads compleatly.
because flash animation starts to play before it is all loaded.
you want ondomready. it is easiest to use the mootools library.
ondomready, thanks
it’s not a standard function, afaik only mootools has proper support (??)
works well, though.
tag at the bottom of your page with a call to some page initialization function
window.addEvent(‘domready’, function(){ my function}) Mootools conflicts with prototype, although prototype has scrappy support for ondomready, too.
window.onresize = function() {…}
window.addEvent(‘domready’, window.onresize) ?
you need to add the mootools library to your page first. it’s quite small, 30k compressed.
how to do that?
does it work on all browsers?
be aware it will conflict with other frameworks… go to www.mootools.net and download it, easiest to select all the features… it’s very small regardless.
ok i see
ty
well
i got better idea
you have?
how to start playing flash animation after it loads compleatly?
window.onload?
http://www.catonmat.net/blog/learning-javascript-programming-language-through-video-lectures/
http://asaguroi.site.voila.fr/blog/images/vergil.jpg
right.
^ what anime is that from
oh devil may cry
the mI think window.addEvent(‘load’, function(){}) may be more consistent corss-browser than the default window.onload… don’t know though, but if you want to have this flexability mootools can help.
isnt it the other way around
?
for the custom add event function, theres the w3c add event listener method and theres a seperate one for IE (attachEvent).. but for window.onload it’s the same for each browser.. that would just be a function with other functions in it?
I don’t know if mootools ‘load’ is just the standard onload function…. but it certianly can’t be any worse.
Is there a simpler way of adding a whole heap of HTML to the DOM than calling createElement over and over? ie can I insert a block of text somehow?
innerHTML?
I think on advantage of the mootools ‘load’ event is that you can have multiple functions on one page. iirc, more that one instance of window.onload can cause probs.
*one
you can do that with window onload, that simon willison function
addloadevent
but i use dean edward’s addevent function personally
if the op just wants ‘onload’ than mootools would certainly be overkill.
this has me stumped…. ‘this’/'element’ not working for array items within a loop http://pastie.caboo.se/85020 REPOST ;p
is that mootools
are you using mootools?
he was asking about DomReady before you joined…. that’s wht it went off at a tangent.
yeah, that swatch of code that’s giving me probs is mootools.
don’t most addevent custom funcs have 3 or so params ?
you try #mootools ?
you’re braver than me… they don’t like questions in there!
lol
if by brave you mean getting banned from everywhere but #mootools/#js then ye
s
the function half works, in that each element in the array has a function added… it’s just I can’t get the ‘action’ property, or use this/element etc.
my derriere hurts from sitting.
ie the onclicks for each submit are added to the dom… I just can’t reference the array object itself.
Can somebody recommend a pop-up menu script that works in at least IE6, FF1.5, FF2, Konqi, Opera, Wepkit and others?
A simple solution is preferred
Anyone?
lalala
hi
hi there