k thanks for the answer I am actually trying to create the textarea like I had been with my inputs I am doing
still no luck
what does innerHTML show?
table dosent have any innerHTML
or hmm.
all container elements have innerHTML
it shows the row (tr) that should of been removed
ah well that's good
foo p.innerHTML // foo
yah, but the inner elements of a table is not textnodes, isnt that what innerHTML returns?
no
(it isn't)
oki
http://msdn2.microsoft.com/en-us/library/ms533897.aspx (innerHTML)
MSDN
would rather read the ecma spec
anyone here still have IE6?
i have
but i dont use it
It's not part of ECMA. (And none of the DOM functions are either.)
could you take a quick look at one of my websites?
http://thijsvanderschaeghe.no-ip.com/projectX/
My IE4linux shows a flew hitches in the map
hi, I am Microsoft, I like grabbing standards, changing it and making it incompatible with other implementations.
its defenitly in my javascript book at least
So?
there is no 'so'.
whats the prob?
document.getElementById('myNode').click(); ) This works in ie, but in ff it expands for a millisecond and then collapses again. Anyone got a clue on how to keep it expanded in firefox?
gpy, the map had a few hitches, a few spots where the map didn't match. If it looks fine, I guess it's just a bug in my linux IE
didnt see that i think
ok, it's probably just an old cache he didn't want to refresh
i saw a little man pissing under one of those trees though
hehe$
but wait
i didnt check ie
i have so many windows
wait a sec
610 items remaining
hah
hm, I thought I already fixed that bug
does ie download the same image file multiple times?
yes
if i move the map
im back at 253 items remaining
but hm, looks like pieces missing from time to time, think you should check that yourself
gpy js h4×0r
check the /plain again.
hovers! and links!
sweet!
and found my bug aswel.
its unbelivable how much u can achieve half naked in the bed
with the lappie
hm gpy any idea why it would do that?
Is it possible to simulate a click in firefox? It works in ie, but it doesn't in ff
can ie simulate a mouseclick?
document.getElementById('myId').click();
That works in ie, but it doesn't in ff
how can you automatically escape single-quotes? in other words replace ' with \'
hi.. anyone on?
I made this site by use of prototyp.js library http://test.replore.com/youtube/
The problem is that rows counts the number of rows in table sections (tbody, thead, tfoot) and Fx doesn't generate those implicitly when you add tr elements via script.
see http://www.benjaminhawkeslewis.com/test/phix.html and https://bugzilla.mozilla.org/show_bug.cgi?id=255381 and http://ajaxandxml.blogspot.com/2007/01/firefox-15-bug-tablerows-property-is.html
and http://developer.mozilla.org/en/docs/DOM:table.rows
I solved it by adding an id attribute to each row I generate
and keeping a global that has the next value to append to the id base name
probably not the best way to do it
using thead and tbody would be better
more economical, plus somewhat more semantically correct
I will look into it
hi there!
is it possible to check if a window, is a popup window or not?
if it is, window.opener will point to the parent window
ahh thanks!
not sure what happens if the parent is closed before the popup though
is that cross browser?
euh, I thought if (scroller) was good enough to check if a variable is defined?
it is, and opener is set to null (in ff at least) if you close the parent
no, use typeof scroller !== "undefined"
although it can't tell apart an undefined variable and one with its value set to undefined
thanks!
How should I compare two strings?
Which are in variables
Danker, if (string1 == string2)
do you maybe know how to center a popup when one has multiple screen?
having problems dynamically setting div width when in display is inline … it only stretches as far as there is content in it (i.e. can't make it any wider than that.. any suggestions?
in other words it doesn't stretch, it only accommodates the content
that's how inline works, there are no "width" / "height" with inline elements.
is there a way to handle the "close" button?
… right.
of a popup window? .. when I use the unload event, it's no good because a form post causes this as well
i'm trying to make a poll, with images on both sides of the bar to make rounded corners (sort of going through the dhtmlgoodies ajax poller and trying to learn/recreate it)…
struggling with space between the img and the div with bg-image, it works in FF then not in IE, then in IE but not FF etc.
you can position crap using float css attribute instead of making stuff inline to get block content next to eachother
for example, in IE , if you were to type in the code (and not generate it)… it makes a difference whether img and div are in the same line.. stupid thing parses \n\r as part of the page content
well, i have an example that works in both browser, but am struggling to nail it down since not all the containers etc are present..
so probably something isn't cascading down
is it possible to disable the close [x] button of a popup window?
If I do foo = new Array(1,2,3,4,5), foo will be an array of 1, 2, 3, 4, 5… If I do foo = new Array(2), foo wil be an array of length 2, but what if I want to have array that contains only 2 (I dynamically create define the array with php, it can have 1 or more elements, so how to correctly
define such an array)?
foo[0] = 2;
is foo[] = 2 also correct?
try it..
let me know
no, error.
it doesn't? didn't think so
You have to include an index as well.
(this is not php crap)
tho there is a push method that could be use to add stuff to the end of the array, i.e. foo.push(2);
hi!…
Hi.
somebody here uses or used spidermonkey?
hi fatbrain
btw, if you do new array(2), will it throw an error if you try to add a 3rd element?
skr1, no
k
skr1, wait… I don't know
it wouldn't make sense
if you can add a property at will..
i'm using spidermonkey to work with javascript code… but i want to work with dom objects embeded in the javascript hosting code…
why doesn't this display the paragraph?
var p = document.createElement("p");
p.innerHTML = "adfadf";
document.body.appendChild(p);
because this i'm looking at gecko sdk…
and?
It should append the p-element at the bottom of the document. Try document.getElementsByTagName('body')[0].appendChild(…) or window.contentDocument.body.appendChild(…)
i don't found any good documentation about the gecko sdk…. and i don't know how to start to use the spidermonkey and the gecko sdk to work with javascript and dom
no luck..
ok…
window.contentDocument.body.appendChild(p);
document.getElementsByTagName("body")[0].appendChild(p);
document.body.appendChild(p);
all 3 throw an exception
for now… i'm looking at mozilla source to try to figure how the browser do it (parse the dom and execute embedded in the javascript code) but isn't too straightforward…
any ideas about this?….
you'll have better luck on a c++ channel, maybe someone else is looking at the same thing you are
how to use the gecko souce to parse dom content using spidermonkey?
fatbrain, are you asking to me?… no… did you mean to ask this question in other channel?…
in all 3 cases i get typeError - document body has no properties
yes, that's what i meant, you'll find people here more involved with js and dom on a user-level..
maybe there is a group or another irc channel for mozilla developers
hi
irc.mozilla.org
thanks skr1… yes, i was looking a mozilla channel or something like that but at least here in freenode but the channel mozilla was almost empty
i'm a javascript neophyte will someone help me with that? http://pastie.caboo.se/78836 i've to avoid the effect of an onmouseout effect ,thanks
thanks Raevel, i'm gonna try this server
onmouseout event
onmouseover ,onmouseout ,and when checkboxes are being checked,i've a problem with the two last events
http://pastie.caboo.se/78836
http://paste.sharewonders.com/Default.aspx?fv=cc2af916-038d-473a-8b74-1ef672329665
I wouldn't need a switch statement if I knew how to declare an object with a dynamic class name
is it objInstance = new main["objMain"](); ?
er
objInstance = new main["className"](); ?
actually window.main["className"](); maybe
What's main?
yeah no kidding
window["className"]
indeed, but that's still ugly in my eyes.
is there a better solution?
Why do you need "dynamic" class-names?
because otherwise I'll have a long switch statement
and the only difference
is one digit
objInstance = new layout1(); case2: objInstance = new layout2();
that's really horrible
omg
yus
so dynamic would make that better right
Your implementation of multiple layouts is fubar
no
it's not
how would you do it?
var layouts = [layout1, layout2, layout3]; var current_layout = new layouts[index]();
hrmmm
how is that different really
Either that or a LayoutManager, which support addNew or registerNew (whatever you wanna call it) and then a createLayout(byName/byIndex) (whatever you prefer)
hrm layout manager
If you dont get how that different then you shouldnt code
*rooooar*
I like that latter one
then stick to it
uhm
it's loads better than creating instances based on class-names in global scope.
how so
how does it 'load better'
no, what I meant was, it's alot better.
why?
hey i've tags nested in this was trtdinput type="checkbox"….//tdtd…/td/tr
Because it will prevent you from creating an instance of some type that isn't a layout class. With what I said, the user/coder will only be able to create instances of the layout-types.
how can i refer to the input tag from the tr, thanks
new window[some_generic_name]() could create an instance of whatever type, and you dont want that.
oh
well it would have been
also you can easily register a layout that's named "MySpecialLayout" and register it with the LayoutManager or the array and create it using an index, even tho it doesnt follow your strict layoutX naming-convention.
new window["layout" + layoutNum] or something
I like the layout manager idea
I'm going to do that
It's still not good enough, with my examples as well, your layouts doesn't have to be global types.
nice nice
I do js and css as a living btw
http://tipling.dyndns.info:3030/ — what I'm working on currently
personal project
fatbrain, will u help please?
With what?
ii've tags nested in this was trtdinput type="checkbox"….//tdtd…/td/tr
?
way not was
use an id
Why would you need to refer to the input from the tr?
then access via document.getElementById("myCheckBox")
fatbrain, because of that http://pastie.caboo.se/78836
tags
you can't edit your server side code?
Never use javascript:
remove "javascript:"
fatbrain, why?
It's not requird, even so, it's plain wrong.
javascript: is used in the location bar to tell that the content of the url is javascript code.
ok but this is not the problem here
onclick is an attribute and the user-agent wants javascript host code in it, not a url.
- is the url protocol, like http: or ftp:
it breaks accessability too
only to be used in href attribute of the a element.
even there I wouldn't recommend using it.
ok thanks i've got rid of it
heh he's not using it in a Anchor?
you can browse the children elements of your TR via the DOM
no.
but I don't recommend doing it that way
I recommend fixing your server side code
s|k, but i want to access a specific child
that's fine
you'll have to find it via the DOM
I would give all elements that needs to be controlled/used by JavaScript an unique ID.
I assign id's for form elements, I never use form[0] etc..
:/
tag because of my php host code
CZE
JEST TU JAKI015a POLAK?
i speak polisg
English only.
hehe what in the
Can't you include more IDs from your php code?
Otherwise the only way to get the elements in to traverse the dom.
my_tr.getElementsById('input')[0].checked
erm, my_tr.getElementsByTagName('input')[0].checked
fatbrain, but the input isn't a child of tr it's a grand son of the "tr"
i mean a child of a child
fatbrain, what does the "0" between [] stand for?
getElementsByTagName get's all children regardless of depth
how would it work on document otherwise
ok and the zero?
the index
ok :/
if you had a second input box inside your tr somewhere
it would be index[1]
er
input[1]
erm
('input'][1]
gggggrrr
you get what I mean.
i can put a variable inside the [] to do a for loop?
you can yes
is it a good idea in this instance? I dunno
if it works why not
because just because it works doesn't mean it's the best host way to do it
neophyte don't look for a best way
just a working way
I can show you ten different ways to assign the string "hello world" to a variable
but I'm sure we can all agree that var myString = "hello world"; is the best way
show them :p
let me write an enterprise version!
jk
hehe
s|k, will u check that ?i've given it a try but doesn't work ,i've just tried the first row http://pastie.caboo.se/78836
uhm
is that all the code farrel ?
I see a couple of functions
but I don't see where you are using them
yes ,all what i need to do
s|k, look between the line 20 and 30
line 21 ,onmouseout event
yes
I don't know what 0.style.backgroundColor is supposed to be
:|
maybe try
whose id is 0
that's not how you get an id
document.getElementById("0").style.backgroundColor = color;
try that
ok
that's not going to work for tr with an id of not 0 though
so I recommend
just doing chang(trElem) and then calling it with chang(this) and then doing the this.getElemen… in side the chang function
i'm just trying for the first tr, step by step
inside*
erm
but trElem.getEle instead of this.getE obviously
I'm abbreviating in the previous line
bye fatbrain
s|k, it works for the first row thanks!!
hey everyone
Hello.
what's up, fatbrain?
0 isn't a valid ID. http://www.w3.org/TR/html401/types.html#type-name
s|k, but have a serious problem when i want to loop ,
Not much, coding crap, almost omw to get something to eat
webben, it's not a variable name though
it's an id attribute, yes?
sec
k
You need to execute your JS on page load.
sorry, window's load event.
You have to wait for onload.
since div#test doesn't necessarily exist when that script gets executed.
adding window.onload=test() (after i encapsulate the above code into a function called test() ) — produces the same error
ie, your div reference is null.
window.onload = test;
not test();
s|k, any idea plz?
uhm
that worked… sigh
can you paste your current code?
test and not test()
Hi !
ah yeah
test() will invoke the test function and assign the window.onload with whatever test() returned
s|k, http://pastie.caboo.se/78836
play with it, lookup the dom on MDC I'm sure you'll figure it out
this isn't hard stuff
yes, it will take me some time to learn JS and get used to the way it works. haven't really been around oo much
ty
ok you're right s|k
element in the document head ? I only can with Firefox and Opera
IE6 or Konqueror seems to refuse that…
headstyle id="addonstyles" type="text/css"/style/head
I can read the innerHTML of the addonstyles… but I cannot write it
join #web
and it works perfectly, however I am now trying to add a 2nd dropdown menu that does the exact same thing, however it doesnt want to work. Anyone know some good docs on this?
even if I use layoutManager, or even the array, I still have the problem of either using the switch or grabbing the class from the global scope
because that's where it is declared initially
I'm using dojo.declare :/
no
what am I not getting
does document.getElementById() work in IE 5.5 and greater?
I don't know about dojo, but using the layoutManager you will add the layout types to it.
layoutManager.addLayout(Layout0); layoutManager.addLayout(Layout1); etc.
ohhh
yes
thanks
hrmm
ok the problem with that fatbrain, is that still, at some point, I need to either write 'Layout1' statically, or dynamically, even if I register it that way
bok the problem with that fatbrain, is that still, at some point, I need to either write 'Layout1' statically, or dynamically, even if I register it that way/b
ok thanks for your help
Yes, you will always at some point do it once.
so I can't avoid the switch
…
If you'r accessing them through index, you should put them in an array.
I agree
Then you dont have to use a switch.
If you want to access them by name, then you supply a name when you add them, and you put em in a an associative array.
layoutManager.addLayout('fanzy_layout', Layout0); later at some point, layoutManager.getLayout('fanzy_layout')
addLayout = function(name, layout) { this.layouts[name] = layout; }
I guess what I didn't explain is that the layouts aren't loaded until they are called
s|k, it works very fine now xD http://pastie.caboo.se/78836
cool
yeah thanks
np
do u think that an id musn't begin by a number?
I don't think identifiers should begin with numbers
and many languages don't allow that
it's not very descriptive
yes but in my case i don't have choice
if you wrote the server side code then you do have a choice
what is strange is that tutorials say that we cannot have an id that begin by a number whereas it seems to work fine with a number at the begining
try and validate your code
Is there an easy way to extract GET parameters from window.document.url? (I mean a way to access the param hash directly, not parse it with a regex)
you don't need a regexp
you can just create an array from the string by splitting via ? and then &
Okay, that's the easiest way?
Hello people.
it's how I would do it
I'll just do that then, thanks
i can add a letter before the number but i don't need since it works with only number s|k
there might be a better way? in dojo there are easier ways
Yeah, I'm not going to load dojo into the page just for that though :p
:P
just because it works, doesn't mean that's the way to do it, you should follow standards
especially if you're going to want to ask for help a lot
because other people will look at your code and go crosseyed otherwise
ok thanks for help
np
s|k, i think that javascript is the most difficult script language i've ever tried!!!
it's not easy
a lot of things!!!
just wait until you have to deal with asynchronisity or closures
heh
nicity*
what can u recommend as book or tuto? s|k
the Oreilly book
Javascript, the defninitive guide
also the mozilla developer center
that's a bible s|k
yes
but JS is a must
Is there a name for the method of adding or removing things from a page using like removeChild or appendChild?
yes
this seems simple enough but i can't seem to fix it.. suggestions? http://pastey.net/70814
parentNode.removeChild(nodeToRemove);
which version of IE?
7
margin:0px; padding:0px;
no good
heh
and imgclass
not sure i follow you
why would that matter
imgclass="imgclass" src="graph_left_1.gif"/
oh
?
there should be a space in img class
I see a space
that broke it up (i.e. didn't know i'm trying to specify className)
IE6 downloads every image again… any ideas how I could fix that?
I have found if you want things smooshed together in IE you have to put them in the same line with no space between the tags, otherwise I got an odd little space
did you check http headers? most likely you're getting 304 back (but yes, it still verifies images that should be already cached)
304?
IE sees some of the whitespace and sees it that it needs to leave some space at that spot in the end product
yes, but that's only good if i'm typing the lines, and not creating objects dynamically…
so we need a better solution
besides, in this case that wouldn't have helped
My appologies
border: 0px ?
space between images?
vertically or horizontally?
skr1, ah, yes. But the whole point is that I use the same image about 1200 times and somehow IE6 downloads it 1200 times… or at least requests it
firefox and IE7 don't seem to have that problem
erm, you mean it doesn't used the cached version?
i noticed that but haven't gotten around to trying to fix it. .. this is probably ajax-created content ?
yep
does it manage to complete one request before sending the other requests?
maybe because all images are added within a few miliseconds?
like i said, it's not downloading them, only checking them (http 304)
304 is forbidden?
hm but even then. Checking 1200 images takes a while aswell
ah, not modified…
no, 304 = not modified
yes it does
you set appropriate expiery headers?
not at the moment. this is regular apache-sents-png stuff
ok, sucks
You'r only experience problems with IE6 user-agent?
newer ua works fine?
yep.
how about this one re: IE and spacing http://pastey.net/70814
everything is floated, as simple as can get.. but there is space between elements
what if you just use a background
is there a space?
a backgroundimage*
background for the div?
yes
because you have space in your markup, most likely
well i have to at least also float it
give the surrounding div a style float: left as well.
that solution won't help me with dynamically generated objects
why not?
and besides didn't help me this way either
ohhhh
because I'm not coding the lines in the html file
you're using an img
hrm, put the img in a div
that didn't hlep
help
Available Plugins: oeis jeval spell cpan shorten rt topic squeeze rbeval acronym change managementspeak reverse join translate bibleit core imdb insult tv help echo eval convert jseval mangle restart quit deparse part pyeval reload_plugins goobooblink heap_test rss
i can't need it as bg
besides, as bg it should affect div's properties even less
skr1 not s|k
space where?
between the image, the div, and the image
horizontally or vertically?
it looks as if they were in table cells with border=2.. but they are all floated
they are all in line
it's a bar graph for poll
images are rounded corners
hi
middle div is where the % is displayed
what I didn't explain earlier was that I'm loading the javascript for layouts (via xmlhttp) as I need them, so there's no instance in which I could easily create an array
I'm trying to save people from having to load 100% of my applicaition if they are only using 10% of it or something
application*
if i want to find out surfing behaviour of a user through his cookies… and then put it onto a central server can i do it using javascript or should i develop an addon?
sounds smrt (sic)
so I have to use a switch or something
It's somewhat illegal to track users
how abt if the user wants to?
and you can't control the html?
On websites in EU you have to explain that you use cookies and what it's for.
then it's ok.
eventually, after I figure out which set of css properties get images and divs next to each other without space, the images and the div will be generated by javascript, not typed by hand (i.e. html will … look like this body/body )
is the div in the middle intended to be resizable?
exactly
i want to put a chat plugin so that for eg if somebodies watching a youtube video… he can see which users are watching it and then can chat to that particular user to discuss…
CSS can suppress elements, but not just text between elements
meaning yes, otherwise i had found a solution.
does the div in the middle need a background image?
yes, it's a bar graph
the images to left and right are rounded corners
if the HTML contains whitespace, then a space will be rendered, unless the whole element is hidden
or for eg see what particular users are seeing a particular website and other users can discuss with them..
i already mentioned this, even when i put the 3 elements in line (i.e. without a line break in the code) the result is the same.
can you show me?
tracking, as in, I want to know what my site-users do, so I can target their adds better == not-allowed.
ads*
it works fine in IE (no gap), but in firefox the div floats above the paragraphs
!!!!!!!!!!!!!! WORKS when put in span instead of
at least so it seams
seems
fatbrain:k how abt if the users want to .. for eg in last.fm case… if the user wants to publish what music he plays..
i've lost all day to this
try something like: http://pastie.caboo.se/78848
a href="http://pastie.caboo.se/78848"http://pastie.caboo.se/78848/a
k let me see
i'll try it now on DOM, see whether one of the two solutions works.. for the record here is what i got to work: http://pastey.net/70818
when do we need to use ActiveXObject instead of XmlHttpRequest?
Is there some javascript forum where I can state the "keeps reloading" problem,
?
it could be related to the problem of rollover images being continually reloaded
try searching on it first.. maybe you and i aren't the first to come up with this
deltab, yep, that sounds related…
"This was an oft documented bug in recent versions of IE, but it's the first I've heard of it happening in Netscape. The graphics actually ARE stored in the cache by IE, but for some reason, the browser still calls out to the server on a rollover script, and ignores the cache." http://www.webmasterworld.com/forum21/6679.htm
hm it looks unsolvable
try delaying the other images until one has completely loaded
hm that's almost impossible
hmz
http://swik.net/Ajax/Ajax-Development-Gotchas
IE doesnt use cached images when Javascript inserts HTML with images.
Maybe I could add all possible images in my index file and "preload" them that way?
one thing you may want to try is to load images as background with no repead via css…..
would that change something?
instead as img children
not sure, but that would be my first next try
let me know how it goes i have to finish up another thing now
skr1, same problem
hmm
you should be only assigning class name to the dom object, not an image.. can u paste your code somewhere?
hello!!
can someone help me out here /really easy
how do i join more than 3 strings
like
fsdfdsf();gdfgdf();gfdgfg();
in one
????
"One" + "Two" + "Three"
OneTwoThree
["one", "two", "three"].join()
one,two,three
["one", "two", "three"].join(" - ")
one - two - three
can i do this?
var string1 = fsdfdsf() + gdfgdf() + gdfgdf();
skr1, sorry, I was away for a few minutes. http://projectx.daedeloth.be/js/gamemap.js
processMapSquareJSON is the function that handles the drawing
that's some serious recursion
the best way to join strings???
and how do i call them
please
can i do??? var string1 = gdfgdfgf() + fdsfsdfd();
and then call string1()
??
anyone who could help me with javascript? about arrays?
eigentone:
var typenumber = new Array();
typemumber = ['0','1','2','3','4','5','6','7','8','9'];
alert(Number(typenumber[1]));
I get undefined
yeah actually I could try making a css that has a class for every image in the game
typeMumber
anyway, I'll give that a try tomorrow. thanks for the tip cu all
Drevor oh, thank you!, so typenumber was a reserved variable?
you mistyped the name in your 2nd line
oh
i c
but thanks for the help Drevor!
what a simple mistake i made.. :$
what is your issue?
i want to join some fgjhfdjfd(); with gfdgdfgf(); fdsfdsf(); … into one hgfhgfhgf();
eigentone:
but i wouldnt like to try in the dark
try explaining with real function names
code.toggle();codeu.toggle();coreu.hide();infou.hide();designu.hide();
into one
how can i do this?
does each of those mehods return a string?
i pasted pv
How do i replace 0000 to 0001,0002 etc by inserting 1,2 etc ?
Codler you're working with strings
so first of all, define var str = "000"
ok, what functions do i use?
then do str += "0", str += "1" etc
you will get 0000 0001
start with a string not an integer
then simply concatenate
ok ty
np
I know Number() function converts to int, whats the function to convert to string? is it string()?
hi
String("0000")
0000
can i send a function as a parameter to another function??
yeah
mickky_ yes
var somevar = funcName (without brackets)
mm
but you have to be careful about the context in which your functions execute
thanks
otherwise variables you expect won't be there
read up on namespacing
skr1, thanks
for your help
whats the function for counting a strings length?
"ABC".length
3
ah ,ty
who is buubot?
var ComentarioCargando= {alert('hello world');}
AnotherFunction(par1,par2,ComentarioCargando);
is it wrong?
the function ComentarioCargando is executed into AnotherFunction if a write it?
var ComentarioCargando = function(){ alert('hello world'); }
is the response from jseval
ok
and it works perfectly, however I am now trying to add a 2nd dropdown menu that does the exact same thing, however it doesnt want to work. Anyone know some good docs on this?
if i make a function inside a function will the inside function work outside if the function or do the inside function only working inside the function as it are in?
The paste 618934 has been copied to: http://erxz.com/pb/3580
functions defined inside another function are available inside
unless of course you return the function you created
eigentone ok ty
tags
… but how about my question?
how about it, what is your question?
if anyone would like to help me with basic javascript, please open a session with me
well.. just some silent dudes up here :/
state your problem and error *pastebin* if any…. then everyone has a chance to help
ustate your problem and error *pastebin* if any…. then everyone has a chance to help/u
or not
consulting.toggle();consultingu.toggle();coreu.hide();infou.hide();codeu.hide();designu.hide();servicesu.hide();
how can i join all this into one???
anyone???
skr1 eigentone cya and thanks for the help
what do you mean by join ?
in one decalration
like alltoghether();
put them all in a function
how?
can you help me?
function(){ consulting.toggle(); consultingu.toggle(); … }
hmm
ok ill try it thanks
name=function() {…}; how can i send parameters into my function??
name=function(param1)
??
function(paramA, paramB) { return paramA + paramB }
and if a call my function name??
name(param1)
yeah
it is wrong?
"kaneda" at 71.6.194.243 pasted "Does this look right? Code does not seem to change input button status" (8 lines) at http://erxz.com/pb/3583
not sure if savebtn.disabled is best way to address it
why are you trying to check a .length property on it?
wasnt sure if that was the best way to check if I was getting a result back at all
getElementById returns null if an element can't be found
ah, so just check for null instead
or a if (!savebtn) return; ?
i need to send a function as a thirth param of a function, a define my function var func1=function() {…}, and a need to call from func2; but i have to send various params func2(param1,param2,func1), can i write func2(param1,param2, func1(params) ) and not func2(param1,param2,func1)????
yes
func2(param1,param2, func1(params)) will invoke func1 and pass the result to func2
func2(param1, param2, func1) will pass the func1 function to func2 so that it can be invoked within func2
sweet, thanks insin
eigentone, it is logic
?
How can I get a list of an object's properties?
hi
in an event, is it possible to detect the up/down/left/right arrow-keys?
event.which gives me 0
you can iterate over the objects properties with a for in loop:
for (var propertyName in object) { var propertyValue = object[propertyName] }
meh, okay
I'm so used to Ruby's huge standard library
javascript is like, have to do everything myself :/
dabear event gives you what?
hello all
guys, simple question, let's say I retrieved a page in ajax, that's page contains a new javascript function enclosed between script tags.. I need to call that function when I load that page, how can I call it because I tried but the browser thinks it's undefined
hihi
the function let's x, is not defined in the originally loaded page.. but after retrieving some contents that define this function, I want the ajax callback handler to call but it fails because it can't find it
any ideas
hi Jan-
sooo ?
are u pretending that you are away because u r so stupid you don't know what ajax is or you just don't get the damn question ( I bet now someone of you will be awake )
go do it coward kick me!!!!
…
you idiot
…
jinx!
wow now u r awake
and i'll be afk in a few short moments
so in the meantime, i highly recommend that you GFO. With an attitude like yours, no wonder people don't answer you. Do people avoid you at work or something?
blah
do you really think you're gonna be helped by people you've insulted?
actually, here you go maennj; http://tinyurl.com/3dg
*gone, afk*
do u think that I think I'm gonna be helped by those people, I asked the question from like half an hour
kaneda, thanks
How can I set the rows and columns of a textarea using javascript
textarea.rows = 4; textarea.columns=80; ?
hmmmm, k, let me give that a go
so you come here without even TRYING anything?
I didn't even know how to address that
best way to explore properties, have a look at the DOM Inspector in Firefox
I have been working this script around textbox's, and didn't need that
are there any tutorials recommended by this channel?
DavidHKMrPowers, figured it out, just used event.charCode || event.keyCode
and set Javascript object
everyone's patience has limits especially when someone is in hurry and the question is really simple
guess what? we're volunteers. you're coming here free of charge to ask a question from people who get no compensation. as such, we do what we want. your job is to make us want to answer your question.
I appologize for not looking that up, this channel has been very helpful to me in the past, so long as my question has been phrased correctly. I wasn't sure where to start with that question, or where to look. Again, sorry.
acting like a spoiled, whiny child is not the correct way to go about making us want to answer your question. because it encourages bad behavior
and it works perfectly, however I am now trying to add a 2nd dropdown menu and change a radio button list so that it does the exact same thing, however it doesnt want to work. Anyone know some good docs on this?
? Was I whining?
or is this not about me/
?
this is about someone else
most elements have their HTML attributes exposes as object properties. if all else fails, use DOM methods. if that fails, textareas don't use rows and columns as much as they use width and height these days
k, thanks for the answer. I am actually trying to create the textarea, like I had been with my inputs. I am doing a var li_input = document.createElement( 'textarea' ); and need to set the col's and row's the same as the original one that is hardcoded. CSS doesn't alter it so I need to
address it when I am creating it. Am I correct in assuming that the above hint won['t work in this instance?
I wouldn't say that - aren't the rows and columns sizes character-based?
yes
if you're creating the element with DOM methods, use the DOM setAttribute method to create the attributes. but your best bet is to change the style height/width
AHHHHH, right!
I forgot about that. Have had my head in PHP all morning
gross :p
that's sort of like having my head up my …
yes, or some Mexicans…
it's an asshole, not a clown car
precation, you mean that I have to beg u to get an answer
heh
Ok, thank you guys for the help, and Hi reisio
Wife is yelling at me that I have to get off the computer now. Later.
yes run along and do as you're told :p
which is the typical response of the people who don't know how to ask polite, respectful questions and wait patiently for a reply
lol, shush
What's worse? Declaring a JS var twice or using an undeclared var?
calling Milli Vanilli cool
\o/
I want to create a multidimensional array with dynamic content… which means I have to declare each 'inner' element fir– wait a minute.. varname = [[a, b, c], [a, b, c]] is valid syntax, isn't it?
correct
Hurray for less mess
Hi, why does encodeURIComponent() translate swedish characters different then escape()?
maennj; so, you haven't quit yet?
escape works in my code and I can easily convert it back to swedish characters in server php code but encodeURIComponent seems to screw them up
"göran pe" with escape = "g%F6ran%20pe" with encodeURIComponent it is "g%C3%B6ran%20pe"
Why do they differ?
different encoding types
encodeURIComponent is probably using UTF-8 (depending on what encoding type is given to the browser)
ok, so i should play with the html hosting document encoding header?
i don't know. your best bet is to get php and your document both using UTF-8
encodeURIComponent uses UTF-8 always
and escape is not standardized
ok, I'm reading on how to get php's rawurldecode to understand it is UTF-8 encoded
hmm
php deals in byte strings, and doesn't remember what encoding they're in
just use urldecode or rawurldecode and you'll have UTF-8 strings
*scoff* *munch*
*namnamnam*
how does js virus work?
uhm… js virus?
like any virus, but with js
deltab, if I just echo the rawurldecoded string to a html document which uses utf-8 as encoding, garbage shows up
did you use encodeURIComponent?
what OS can execute JS code? unless you target a specific JS interpreter (FF, IE, some program that's decided to use JS over Lua or Lisp or etc…)
preaction FF and IE
can't really call JS a virus, a trojan, sure
reisio heh
deltab, yes
anyone for my above ^^
where did the string come before then?
^come from before
looking
an url, $_REQUEST['str']
str has been created by encodeURIComponent
ty, I have pastebin snippet of the current code attempt if needed
preaction rather
in the javascript, I mean
alert() or console.log() the string before using encodeURIComponent on it
deltab, it has been fetched like this str=document.getElementById(readThisElement).value
from a form element type input
ok, I'll alert it, w8
deltab, characters looks good in alert popup
okay, what's the result of encodeURIComponent?
"göran pe" with escape = "g%F6ran%20pe" with encodeURIComponent it is "g%C3%B6ran%20pe"
your showEl method has a bug: no matter what display is set to table-row (there's no "else")
it's also good to fix your indenting and to always use curly braces (it makes the logic easier to follow)
hmmm, thats the only one that works properly *other than the radio button style one which I want to change to a dropdown*
Hey guys, what's a 'DSLAM'?
your browser detection thing will fail, that's what i'm saying
Jan-, I think it is the operator side of a dsl connection
Ohhh.
OK
Digital Subscriber Line Access Multiplexer
connects a DSL line to the Internet
i'm also not seeing the IDs "advertQ1" or "rbQ1"
whooops, I see that you mean *for the else*
they do exist, this is a small snippet those ID's are large
you may have to work out a minimal test-case so i can actually play with it and see what's going on.
you have two radio buttons with the same ID (you are not allowed to have two elements with the same ID)
deltab, find something suspicious?
(id = "gamechoice")
They obviously encodes it differently and encodeURIComponent uses two characters for ö
may I pm?
yes, each character representing a byte
as the the radio button ID, it wont matter in the end as I plan to change that to a dropdown menu instead
two in utf-8?
s/the/for
give me a URL where i can actually see this in action. use paste.css-standards.org if necessary
right
so the problem's not there
what are the bytes written into the new page?
"göran pe"
seems like php code interprents it like two different characters, byte by byte
ö=ö
I can do str_replace("ö", "ö")
Just kidding
okay. the weirdest thing seems to be that if I have firebug open and actually step through the referralchoice() function, it works.
as you can see the radio button hide/show works, the referral choice *last two options in the list only* works, but the following question doesn't
my goal is to change the radio button section into a dropdown menu, and for the next one to work as well…. etc
you mean this choice in that menu? 'option value='Yes' showit(this, 'prevclanQ1');"Yes/option'
correct
that's the result of sending UTF-8 through a UTF-8 encoder
what's wrong with that element?
as it should
I had the same problem when I changed the radio button list to a dropdown as well
Does anybody ELSE see what's wrong with that element?
something in your page generation is encoding it as if it were Latin1
or the browser is not decoding correct UTF-8
is this site on the web?
you might want to get a markup validator on your page
oic
ok so I fixed that up, but still a no go
deltab, yes it is
may I see it?
can someone point me to info on how to draw arrows between divs?
with another element
deltab, check your pm
I didn't receive anything: have you identified to nickserv?
nope
w8
anyone here?
deltab, received them now?
yes
Bah. Why is there no http://en.wikipedia.org/wiki/Jan_Hogevold
I don't know who that person is
http://www.imdb.com/name/nm0389694/
or production executive, etc.
Jan-: You know how to fix that!
heya guys, i have a problem with an iframe… the contentDocument doesn't seem to contain anything!
It's *me*, you dimwit
And that IMDb page is not mine. Though I wish it was.
oh okay then you can't fix that
cool, I can "Buy Movies Starring Jan Hogevold"
like, anybody know a quick way to display available methods for an object?
inspect it with firebug
is there a quick way to pop one char off the end of a string]
bis there a quick way to pop one char off the end of a string]/b
s = s.slice(0, -1);
"Jan-".slice(0, -1)
Jan
Owww!
my -!
oh, sorry
Jan- are you trying to get hold of the character, or remove it?
"Aankhen“".slice(0, -1)
Aankhen`
you could also do foo[foo.length - 1] if you just want the character in a variable
you could also do foo[foo.length - 1] if you just want the character in a variable
"Jan-".slice(-1)
-
Jan-: heh
can someone tell me if confirm("Are you shure?!"); gets a cancel click from the user return falsE?
correct, cancel returns false
aannnd
form action="bleh" method="post" onsubmit="return checkform()"
function wich has confirm are you shure in it would not submit if you click cancel
?
insin?
I never really got firebug to work, and i'm at work now, can't use it…
Jan-: hehe
var s = ""; for (var p in x) s += p + "\n"; alert(s);
Does javascript have anything like PHP for enclosing variables in quotes? i.e. PHP: echo "This is ${uselessFactor}% useless."
uDoes javascript have anything like PHP for enclosing variables in quotes? i.e. PHP: echo "This is ${uselessFactor}% useless."/u
jimi. No.
no
No, even.
ok, i'll try that out
Thanks
you can make your own though :p
I'd rather not bother
It's just for convenience.
foo = 1; foo++
Jan-: 1
foo = 1; ++foo
Jan-: 2
Is there an indexOf for arrays?
hmmm, it doesn't get to the alert at the end of the loop…
any thoughts on how to load a script onLoad when the page is generated in a php class, and the entire thing is sent to the browser in the end. i was thinking it shouldn't matter (since everything is still sent at once and loading is… loading), but, the script isn't working
and everything else
only in JS 1.6+
Thanks
not even if i try to change the content of the loop for like alert(p)
foo=[1,2,3];foo(0)
Jan-: Error: Error: TypeError: object is not a function at line 0: (null)
foo=[1,2,3];foo.pop()
Jan-: 3
I use eval, though some will tell you it's evil. This and my script to create a multidimensional array (each inner set with a bunch of default values) are the only place I use it.
someIframe.contentDocument.hasChildNodes() ?
not sure i follow you. don't think we're on the same page
Possibly not.
for example, an object of class html_page is created, then to it i add sections to which html etc is added. at the end of a php script then p-print_html() is executed which sends all output to browser. in this case, the window.onload=someFunction doesn't execute
Centralized Baggage Managementapplication supported by APLCSAP
lol, sorry
I would use window.frames['foo'].document.body.hasChildNodes()… not sure how well contentDocument is supported
damn easy copy&past in putty!
how does one attain multiple "window.onload" functions that perform *almost* the exact same thing ?
document? mkay, but what about compatibility?
Full, as far as I know. Full for frames anyway, and an iframe is essentially the same.
not sure, i'm getting an undefined object as the document
Have you given the iframe both an id and a name?
Jimicon, not a name no
window.frames works by name.
ok, i was searching by id though, is there a prob with that?
Frames are best addressed by name for compatibility reasons. As far as I know, the id methods aren't fully cross-browser.
Though id is best for CSS.
frames died years ago
And good riddance to them
I don't quite like the idea of abolishing iframes though… they still have some (though diminishing) purpose.
ok thanks, i'm going home i'll check it out over there
is it possible to access bookmarks from javascript/greasemonkey?
bjorninge, i don't think that's possible. It would cause some big privacy issues.
via greasemonkey?
yeah, that's what I thought too, but considering this is a privileged script..
I don't see why that wouldn't be possible
you can access a lot via a chrome://
url
I would check the MDC documents
foo = ':'; foo
Jan-: :
s|k, mind pointing me in the right direction?
hi
http://developer.mozilla.org/en/docs/Chrome_Registration — bjorninge
which is the best way to format numbers like excel does? (round to 0 decimal places, 2 decimalplaces…)
Math.round(number, numDecimals) ?
round only takes 1 parameter, iirc
the only problem I have at the moment is, how can I format to 0 decimalplaces
number.toString().split('.')[0] ? :p
Math.round(2.42); will round to 2.
deltab, did you find anything strange?
Oh how I hate when putting alert()s in my scripts makes them work the way they're supposed to…and without them they crash IE.
round(2.42); is the right thing thanks.
nope, sorry
deltab, I think I will store the value in a session instead. Thanks for trying to help
I used (Math.round(x * 100) / 100) for 2 decimal places but I didn't realize how I can do it with 0 ^^
var num = 0; num.toFixed(2);
0.00
true = false;
in a for loop do I need to use var to declare the variables used for each iteration?
for(var i = 0; i someVar; i++) { } ?
unless you want to create global variables, yes
bha, the closest I get is chrome://browser/content/bookmarks/ but what to do with that url?
phix, no, but you should
insin, bjorninge nice
reminds me of other languages
var test = 0; function f1() { for(i = 0; i 9; i++) { test += 1; f2(); } }; function f2() { i = 29; }; f1(); test;
bvar test = 0; function f1() { for(i = 0; i 9; i++) { test += 1; f2(); } }; function f2() { i = 29; }; f1(); test;/b
Error: Error: invalid assignment left-hand side at line 0: true = false;
1
hah
I'm refreshing a div on a page using ajax, and then trying to call a function on its elements. It doesn't seem as though all the elements are present before the function gets called. Is there any way I can wait for the div to be fully refreshed before the function is called?
basically, if you call out to a function which uses a global variable with the same name as your non "var" loop counter, you're screwed
slidge, setting yourdiv.onload= function(){/*code here?*/}
There is no onload handler for divs
hm, onchange then or something :p
Only (in the spec) on the window itself, and (in practice, in most browsers) on images
the weird thing is, if I put an alert() before the function is called, it all turns out okay
I tried just setting a pause for a few seconds, but that doesn't work
that's because the alert() pauses the thread
You can't pause in JS
(alert etc., breaks rules)
how can I pause the thread without the user seeing anything?
Whatever function you're calling should be called from the XHR handler
getDiv(); doStuff(); should be: getDiv( doStuff );
Otherwise you'll always have race conditions
And, with XHR, you'll always lose.
at the end of your body. That way it will only be called after all other elements are created.
hmm, thats kind of hackey
im trying to run it on a setTimeout
doesn't seem to do the trick
okay that did it, with a 300ms delay
thanks for the tips, dudes
slidge, to remove the delay you could possibly do something like while (document.getElementById("element-you-are-waiting-for) == null) {}
[T] i'm not sure I follow
Also, the problem with a 300ms delay when waiting for an ajax response is that you can't guess the server load at the time, or the clients bandwidth, etc
so 300ms might be too much, it might not be enough
I know what you're saying there, but I don't understand the code you gave
does that just do nothing while that evals true?
that's a lot of thats
you're right you might be better with a repeating timeout at 10ms intervals
or higher, then stop the timeout when the content has fully loaded
hi everyone
function timeout() { if (document.getElementById("foo") == null) { setTimeout("timeout()",10); } else { //do whatever with element "foo" } }
[T] this matter is complicated further by the fact I don't know what the elements id will be
[T] its supposed to do something on all the elements with a particular classname after the elements are loaded
oh, hmm
i'd like to stay away from global count variables, as well
will there be a known number of elements?
no
its basically something where you drag/drop an element onto a div.. that element is then put into the database as being part of the div, and the div is then refreshed via ajax with the new element inside
so what do you need to do to the element after it's been refreshed?
make it draggable
here
http://rafb.net/p/9tuR6K89.html
i've commented the problem area
i see, how are you putting the elements back onto the page? innerHTML?
report/add calls a server side function, the ajax updater just takes what the server returns and pops it in place
whats a closure
how does ajax.updater put the content back in?
hmm, thats kind of hackey
That is NOT hackey
That's how you're supposed to do it
I don't want javascript tags floating all over in my html partials
Setting a timeout, or trying to use a loop is a hack
Eh?
tags everywhere is horrible :p
Whatever library you're using will have the ability to set a callback
Erm .. that's a completely different topic ..
We're talking about his div not being complete
its a style thing, I am trying to keep this as clean as possible
On my site ( http://fusend.com/demo/signup/ ) when you click the down-arrow ( next to Home ), it slides down longer than it should, and the kind of 'pops' back to it's right spot- why does it do that, and how should I fix it?
When he wants to do somethine else
you're loading a div via XHR right?
yea its an ajax call
PseudoPlacebo, clicking the link is giving me an error
Then once it's loaded you want to call some function on it right?
on the elements inside of it, yes
ajax call == XHR
yea..
[T]: How so?
OK, so whatever XHR library you're using, it will have a callback parameter
If it doesn't get a different library
That callback function is where you put what you want to happen *after* the XHR completes
you mean like onSuccess?
PseudoPlacebo, the down arrow is giving the error "Object Expected" line 119 in IE7. Works fine in Firefox.
that sounds about right to me
onreadystatechange ?
weird
thanks for the tips
[T]: Well do you see what I mean in firefox?
yeah, i can see what you mean, it goes down too far
[T]: Any idea why'd that be?
no, I'm just looking at the code for Effect.BlindDown
Ahh.
Thanks.
what's the property name for margin-top?
I'm betting it's a math problem inside blind down caused by having such a short timespan. Try increasing it and see what you get
Okay
Thanks
Yeah looks like that helped
Thanks a bunch Woosta
BTW, put a 'return false' on the href's onclick handler
'kay.
That way the page doesn't try to go to signup/#down
I usually do, I must of just spaced it up.
er
spaced it out
man I am losing it tonight
lol
you're spaced out
to print out some js.. how can I do that
so far I have for (var i=0, rows = jsDates.tBodies[0].rows, row; row = rows[i++] jsDates being a table reference
?????
okay I tried doing this with the onSuccess callback. But it seems to be going too fast to register it
the function gets called onsuccess, but it doesn't register on the newly added element
tried doing what?
can has stdio?
Oh bum
wrong window
p'oh
Never come across LOLCODE, eh?
you'd get a syntax error with that lowercase code
crap, forgot to let the cat in
meow
tag?
why are you needing that?
well bsaically someone wants a featured products
to scroll at the top of their page
there are flash solutions, otherwise your best bet would be an animation with a div, left/top, and clip
so like a 400px div that has certain products with their image and a caption scrolling
sounds stupid to me, how do you stop it? you'll have to program that. why not just display 1-5 random featured products on that page?
let me show you somethign real quick
"source" at 71.6.194.243 pasted "Several similar functions need to unify to a single (setTimeout prototyping?)" (157 lines) at http://erxz.com/pb/3577
help what?
Available Plugins: oeis jeval spell cpan shorten rt topic squeeze rbeval acronym change managementspeak reverse join translate bibleit core imdb insult tv help echo eval convert jseval mangle restart quit deparse part pyeval reload_plugins goobooblink heap_test rss
remake
huh? you're asking me to do this FOR you?
Heya folks
$100 / hr.
Anyone see a website I've been working on for a few weeks?
err want to
just hint
I'd love it if I could get some feedback
from fellow coders
http://www.telparia.com/solitaire/
looks like a homework assignment, or something you're getting paid for. in order to get my help, $100/hr.
haha
sembiance
what'd u improve on it
Sembiance, looks good. I don't like that it changes the cursor to a text cursor though
last time you shut it down
for upgrades
bastard
i was playin too
oh hehe
well, it's back to stay
BETTER.
implemented a nicer menu, deal new cards option, options to turn off animation, a new deck, decreased loading time a great deal, added auto flip of cards, and other things
preaction, I'm sure you help me by wrong way/
moreover, this script you've posted will not work. there is not a single semi-colon in the entire thing
[T]: It's not supposed to change the cursor to a text cursor. What browser/platform and what part is turning into a text cursor?
hey whats up
it works fine in Firefox, but in IE7 anywhere over the wood texture, the cursor is changed as if you're hovering over text
http://skylinece.com/test.html
[T]: ahh, IE7 is the one thing I haven't tested in yet.
[T]: I've tested in Safari, IE6, Konq, Opera, FF. But IE7 I don't have anywhere yet except for at work
thousand helpers did help me having bad understanding of the task
okay, so what's wrong w/ using that?
http://www.skylinece.com
has the same code, yet it isnt scrolling
argh
i can't win this
damn you sembiance
any ideas?
give me time to look at it?
I was thinking about implementing a feature to deal cards in a fashion more likely to win. but that some how seems wrong
without the challenge, without losing a lot, winning won't feel as good
cool, ill be here
Sembiance, very nice!
thanks did it run okay for you?
okay im having this problem where I am updating a div with Ajax.Updater, and then onSuccess trying to call a function that does something with the elements inside the div based on their class name. The function is called after the ajax update properly, but it doesnt seem to properly get all
the elements in the refreshed div. anyone run into anything like this?
Sembiance, the dealing animations were really jerky for me, but I get that a lot with this terrible graphics card
otherwise, it works very well
awesome, glad ot know there was no big huge bugs
the different deck styles are nice
did you create those images?
I'm not the artist I intend to add an 'About' section where I credit where I got the cards from
http://rahga.com/svg/ two of them came from
the other two came from gnome games package and the latest bleeding edge KDE games package
heh, funny i was thinking about writing my own game in javascript today.
was thinking pong though,
pong could be fun
don't see too many javascript based games, it's all flash out there
aye, we need to change that! one game at a time
yeah, i think it would have to be only single player though, not sure how I could make it multi
considered a server based AJAXY multiplayer, but latency would probably be ridiculous
would be cool if there was some way to connect directly to other players
turn-based games.
oh, pong. hmm.
?
hi people
'lo
what's up?
el nada
et tu?
el guitaro [spelling?]
i think it's la guitara
yea
i think so
but yea, that's what's up lol
more specifically, trying to record myself playing it
guitar is feminine, yes.
ok, thanks
who from you did pay to preaction for a help?
recording in javascript? wow!
nope, but i did ask about it before!
hey wait, it is actually masculin i think.
now I'm confused.
ahhhhhh
I'm only French, in which case it is feminine.
most likely the same.
so, anybody can try to help me with prototyping a function that doing setTimeout?