I am updating a certain div on my page and adding a select form to it Immediately afterwards I run a javascript

which library do you use? ZK?
http://www.filedorm.com/out.php/i5296_xxx.gif
do i have to register to log in or there's a guest account?
can you really play AoE with this?

d237a8d225e8063
no, it's not really age of empire
it's somethign based on age of empire… Well actually it's more based on the settlers
but it's far from finished

that would've been mega-cool

is it possible to turn XMLHTTPRequest.open off on a server so you can not use xhr at all ?

anyway, be right back, food

can't produce buildings
core.js, line 71, win is not defined alert ('Window not found: '+win);

csaba, back, and checking
hm, are you sure, csaba? I don't encounter problems

with opera? Well I use opera 8, maybe that's the problem
anyway i'm going to lunch as well

anyone know what you call the feature you see on many websites now, where they show a picture, and when you click on it, a black 'veil' falls over the site darkenin it out and then shows the pic in the center of the screen?

ok, I'll install opera ;-)

hmmm
an iframe that covers the entire page with opacity set to 0.5?

i have a table with 4rows each row have 2columns, how can I list all first column of each row?

Why not make a single table with two columns and 4 rows?

its what i say

http://www.huddletogether.com/projects/lightbox/

yes!!!!
thanks

np
take the second version

Actually it wasnt. Anyway, iterare over the rows collection and return the first cell from that

for (i=0;i=table.rows.length;i++) alert(table.table.rows[i].cells[0]); but its dont work

table.table ?

wrong typing
table.rows
FF say that rows has no property

url?

2s

any idea how do I get the document's width in pixels, even when it's resized into a small window with horizontal scrollbar? (I get only the window's size and not the document's size)

i'm looking with firebug

Hi. I'm looking to make quite a complicated (as I see it :P ) menu with javascript. It would have a horizontal bar with, say, 4 items. If you click one, a vertical menu drops down below, on the left. If you click an item in the left vertical menu, it opens another vertical menu on the right. If
you don't understand, see this: http://cbg.sh.nu:10000/menuexample1.png
http://cbg.sh.nu:10000/menuexample2.png . Can I get any advice, help, whatever to do this? If someone has already done something similar, a link would be fantastic. Thanks!

Measure the offsetWidth of body
CBG`: You have never actually done any interface design before have you?

I've designed websites before, just not with javascript.
not that you "design" with javascript, just not used javascript before.

CBG`: That menu is an abomination to usability

It's not up to me.
I suggested many alternatives, I was told that this was MUCH easier to use.

By whom?

And, after all, the "customer is always right", even though I'm doing this for free for my brother.

In webdevelopment "the customer has no clue" is more fitting

Yes, but they won't pay (or "accept" in this case) something they told you they don't want instead of what they said they ddi want.

You are the expert. If the customer thinks they can do better, let them do it themselves

You have never actually done any business before have you?
"Give the people what they want!"

wow

CBG`: Actually I have. And I do on a daily basis

nothing but a lot of preachers this morning

Looks just like what I was looking for… 10x

Then you must realise, Munter, that to make money, you should give people what they ask for.
Rarely will you get what you want if you don't do as you were asked.

CBG`: To make good quality product you need to teach the customer so they want what is best

no, make a crappy product, just like the client wants it… then make $$$ on maintainance

And if the customer is too stubborn to even listen for more than 30 seconds?

In the long run that makes you less money. You can only maintain so much crap at any one time

people will pay for more than just what they ask for :p

as the amount of maintainance grows, so does your company… what do you think Microsoft makes money off, quality products?

but they will probably not pay for something they told you they "do not want".

it's never a problem to hire 100 more programmers to maintain bad software

Actually you are wrong there. It's quite hard to get programmers here right now

CBG`: they don't say what they don't want that often

where?

Denmark

ok i don't know about denmark, maybe you're right… still you can outsource your project to india or russia

I do alert(tblRefBiblio.rows[i].cells[0].textContent + '|'); everything works fine but if I do "msg += tblRefBiblio.rows[i].cells[0].textContent + '|'; " firefox says that tblRefBiblio.rows[i] has no properties :/

DANMARK WOOOO
take that, Arabia!

and nothing else!"

Which takes me to my other point. I dont make bad software. Period

I didn't say bad, I said "what the customer wants"

CBG`: I would tell him to make it himself. Especially if it's free work

CBG`: yeah I don't treat my brother like a consumer whore

I need to load XML, but I don't care if it happens on pageload or later. Is there any way to do this besides using xmlhttprequest?

I'm happy to do it and I'd love to stop the argument over whether it's a good deisgn or not and just see if someone can help me make it at all. :|

one of our clients wrote specifications for us… then later we found out it was the janitor who wrote those specifications… and this is a huge huge bank… what do you think they would do if we told them that their specifications are crap?
Instead, we just do our jobs, it turns out crap, and they have to pay more to fix it

If they are retarded you might be okey, but if the retard in charge gets kicked and somebody with brains comes in they will hate you. Doing a shitty job just because your clients tells you too is just stupid. You take away your own competence. Clients with brains are likely to not work with
you. As a client you want to hire a specialist that knows the stuff better then yourself, otherwise you have no use of them.

What you say has nothing to do with reality. We had this project for 3 years and we have contract for 2 more years. During that time 4 project managers changed, so obviously someone must've noticed that something is wrong. The truth is they like it this way. Yes it is a crap job, and they pay
extra to fix their mistakes, but in the end it actually works… they are happy and we are happy

textContent dont work with IE, someone have an idea for compatibility with ff?

innerHTML?

Well, it be something good, I don't know. But I don't see it that way, and had I been manager I'd want to work with a firm that actually corrected us when we were wrong.

but in innerhtml i have other tag
it return me spantext/span

use prototype or a similar library, takes away most of the hassel

that's politics… if we tell them they are wrong, it looks bad, and they give extra job we have to work for free

but for now I can just use pure javascript hosting :|

wG (there will still be enough browser compatibility issues left for you to have fun with anyway)

span.childNode.data should return "text"

yeah
thanks
( tblRefBiblio.rows[i].cells[0].childNodes[0].innerHTML )

instead of childNodes[0] you can use firstChild I think

yes

I'm trying to use scrollBy for an external R
I'm trying to use scrollBy for an external URL but get the error "Permission denied to get property Window.scrollBy". Is there a work-around for this?

df
heh

…maybe an iframe within the frame?

frames…. USE CSS!!!!! FRAMES ARE DEAD!

was that humor?

how can I remove the ID of an element?

.id = ''; ?

how can I hide option elements in IE and Safari? (display: none works in FF, but not IE and Safari)

I've been reading bash too much lately.. I read normal conversation and I expect it to be funny and when it's not I'm sad =(

line

ie?

ya

what a surprise

Anyway I should put DOCTYPE in any case
but it'll be a little headache

standardization leads to headache

agreed

but…

afterwards it feels good.

it's a bad for a good

I'd like to see the code for IE, it totally beyond logic how that code base can be so incredibly inconsistent and unpredictable.

(bad expression translation
sandstrom i blame backward compatibility,
and i blame Justin Timberlake.

heh

compatibility? what compatibility? if they just stuck to conventions they wouldn't have that problem.

but that would make all the websites designed for IE6 to malfunction

has no effect

MarGarina of course not

why is that? (total newbie question)

hi all

you say "this is 100% height"… 100% of what? your div is in the "document" the document is the body, and the body fits what's in the body, so if there's only your div in the body, then the body is let's say 100px high, then your div at 100% will be 100px high
absolute;" that will extract it from the document, and then you'll be able to fit in the window/viewport with a 100% height

i have a page with multiple forms. how can i submit by pressing enter onlt the form the cursor is on one of it's fields?
*only

Yeah, this makes sense.. but it behaved differently without DOCTYPE

alexbodn technically this should be happening, but, it might be that it takes the first submit… then i suggest you enhance with javascript you can check onkeydown event for your input and check for key character "13"

I guess I'm on the way to learn the right way of doing things. oh well.

MarGarina yeah quirksmode is wierd and unpreditable
you have more chance on getting similar rendering cross browser if you have a doctype

i'll do it. thanks a lot.
how could i condition submit on char(13) only? i mean, where can i check the actual key pressed?

well the event keyword carries that
try some googling on "handling key event with javascript" you might find some links

`js events @ alexbodn

js events: http://onlinetools.org/articles/unobtrusivejavascript/chapter4.html www.quirksmode.org/dom/w3c_events.html www.quirksmode.org/js/events_tradmod.html

onkeydown: if (event==char(13)) {form.submit()}
StaZ|Workthanks again

alexbodn yeah if you say so

first time, sorry
i'll be back soon, bye and thanks again

i might be wrong on some syntax keyword but you get the picture

i have obj = { info: [['a','b','c'],['d','e','f']] } — how can i iterate over the arrays ?

im not sure if this is possible, but hopefully someone here can help. i want to display images on the left hand side of my site, but i want one image displayed and then when the user clicks next or previous, i want the image to slide out and the next one to slide in

wanderingii i suggest making it nice looking and easy with Flash
caus with JS, you'll pull off your hair soon

would prefer to stay away from flash if at all possible
is there an js libraries for this type of thing?

throw new OutOfKnowledgeScopeException("JS Libs");

wanderingii, it's definitely possible with js

ive seen some moo fx thing and wondering if its possible to use that

well all you need to do is set a repeating timeout and move the image to the left 1px until it's off the screen

http://www.groupemelior.com/pages/nosComplexes/quebec/domaine-du-chteau-de-bordeaux/clin-doeil.aspx?lang=EN-CA - flash makes Media websites interactive and nice :P

then change the images, then slide it back in
Flash has problems though
accessibility and compatibility problems

http://www.dustindiaz.com/javascript-carousel

well if you say so

i really want to stay away from flast
flash*

Screen readers have problems with flash websites, users can't copy text/images, they cant link to a specific page in the flash site

dont like it at all

thats not flash. here another prototype lib. http://prototype-carousel.xilinus.com/

i wasnt referring to that i was just saying

var hash = { noinfo: [1,2,3], info: [['a','b','c'],['d','e','f']] }; — how can i iterate over the arrays for the key info only

Like you normally would any two dimensional array

but i only want to iterate over the arrays for only the info key
canu give me example

If you use the object literal notation, then I am sure you know how to access it's properties as well

foreach( a in hash.info) { array = a[0][0] } array would contain ['a','b','c'] ?

foreach is not a JS function

oops
for( a in hash.info) { array = a[0][0] } array would contain ['a','b','c'] ?

And you dont use for(x in y) to iterate over arrays

mod in Firefox you can also use obj.forEach(function(){});
else use for in
var hash = { noinfo: [1,2,3], info: [['a','b','c'],['d','e','f']] };
for(key in hash) {
if (typeof hash[key] == 'object')
for(a in hash[key]) {
if (typeof hash[key][a] == 'object')
for (b in hash[key][a]) {
alert(b+'|'+hash[key][a][b]);
}
}
}

STOP
NOW

ups, forget paste

www.rafb.net

sorry

leobm you could use a recursive function

yes, but for the first steps it's easier I think .

my god. You huys certainly have a lot of excess code for a simple task
for (var i = 0; i hash.info.length; i++) {has.info[i]}

can you use javascript to capture video or a still image ?
I'll take that as a no

hi guys, is it possible to using (ajax) to drag an image and drop it into an area to create an editable text area?…

[M]ax{WK}, I dont see why it wouldn't be.

[T], im the preverbial n00b where javascript/ajax comes into play… could you give me a pointer in the right direction on how to acchieve it?

Once you have a draggable element (just google, theres plenty of examples for this) you can check the area it's been dropped into and if it's where you want it created the text area using DOM.
Once you have a draggable element (just google, theres plenty of examples for this) you can check the area it's been dropped into and if it's where you want it created the text area using DOM.

ill start with my friend (google)

http://www.panic.com/goods/ might help you, you can drag the items into the shopping cart

in Firefox it's possible (for still images). look e.g. at the "Viamatic foXpose" firefox extension js code.

myFunc(vehNum) {…} and I call it like this: myFunc(0); I want to make sure that vehNum is in fact a number. However, if (!(veh_num instanceof Number)) {/*throw error*/} doesn't work, because I guess 0 isn't an instance of Number?

isNaN

leobm, that appears to be a screen shot utility… I need to capture a web cam frame, and store it in a mysql table.

use isNaN(vehNum)
will tell you if vehNum is Not a Number

if (typeof vehNum != "number") { // not a number }

use isNaN

your best bet is to do something using Flash

you can make a signed Java applet that can do that

as online web application ? than it's not possible. but if you want automating do screenshoots of webseites. e.g. as offlien app. than you can use the code in foXpose example.

it will be on a local network for a "payroll check cashing"

[T] the images are fine, they are working, but i would like to create a div class=
"text_area"something here or whatever/div

oh. yes, applets is a good idea too.

you will need to use something external to the browser to access a webcam. A Flash file or java web hosting applet will both be able to and can be embedded in a web page
but Flash will almost certainly be nicer

yeah Flash is better

both languages I am unfamiliar with but thanks for the inputs

[M]ax{WK}, you have drag and drop working? All you need to do is use document.createElement('div') and add it to the page

you can also create an ActiveX control with C# or Delphi

google shows lots of flash for webcam caputure P) perhaps I can find source code & learn
shoot don't need to write one.. this one is freeware and will do what I want I can call flash from php huh?

elements in a select?

none only work in Firefox, not Safari or IE)

I would remove them from the select.

I tried, it works.

is chosen, and one cant change.

du har hjälpt mig förut, har du någon aning om varför det inte funkar?
nm, solved it.

hehe, was semi-sleeping

im trying to use this carousel javascript stuff, and i keep getting an error message saying yahoo.extension has no properties
reisio, you there?

yup

hello all

'lo geb

i have little question:

neat
shame we can't see it

element and a function called like td onmouseover=function()

i want to list all rows from table
like var table = this.parentNode.parentNode.parentNode ; for (var i= 0;i length; i++) { }
but it doesn't work
any idea ?

var table = this; while (table.nodeName.toLowerCase() != "table") { table = table.parentNode; } var rows = table.getElementsByTagName("tr"); for (var i = 0, rowsLen = rows.length; i rowsLen; i++) { // do stuff }

arf thanks Maggi
and also sorry i find the solution only few seconds ago

you could also just give the table an ID and reference it using getElementById

yes but i want to modify an existing script
http://cross-browser.com/x/lib/view.php?s=xTableCursor

you could go with a pure CSS solution for that one if you don't mind IE 6 and older
tr:hover {background: green} td:hover {background: blue}

is it possible to change the properties of a div using javascript?

yes

wanderingii,like GetElementById.style.display="block";

yea ive got it but im trying to develop it further
http://pastebin.ca/622037 - thats what ive got so far, but i want it that if the user clicks next and the current pic is pic3 that it goes to pic4 or the opposite with previous but dont know how to do that

The paste 622037 has been copied to http://erxz.com/pb/3606

I have a div and span, if I click the div I want to do one thing, and if I click the span I want to do another. Right now, when I click the span both execute, and I need just the span to execute. How do I do that?

I'm making countdowns and I need a way to store the counter somewhere
can I do something like

?

element - and ideas?

window.event.cancelBubble = true; in IE and e.stopPropagation() for the rest

I'll try that. Thanks

so what I'm basicly asking is if there is a way to attach an invisible value with html

either place the value somewhere in a script (if you need to get the value from the server side). Otherwise you could add a property to the span programatically, if you don't mind mixing up presentation and data

e.g. refToSpan.setAttribute("counter", "65");

hm I can't really access javascript host at this point
well I could but I'd rather attach it with html

alternatively you could use a global variable or a custom property of an object
e.g. document.myCounter

so this won't work? span counter="54"

what event is triggered when a page is navigated away from ?

no, counter is not a html attribute so that is very ugly

yep, it's ugly, but can it work?

I know but it'll do

element.counter = 10; is acceptable

is not?

no

counter is not a valid attribute
resulting in invalid markup

e.stopPropagation(); window.event.cancelBubble = true; return MyFunction(); did not work

I'd use a custom property of an object

element.counter = 10; assigns a property to the object, it doesn't make it a html host attribute

^

k, I'll try to work some javascript in there…
actually there is a system that triggers javascript, but I don't really like to use it

how can i get the value of a variable into a string, so i have num = 1; variab = 'url(/image/pic *num in here* .jpg)';

window.event is only defined in IE and e is only passed as the first arg to the function in the other browsers, take that into account
"a" + x + "b"
what i'm saying is, make sure the property/argument is defined, otherwise you can't access it

e.g. refToSpan.onclick = function(e) { /* stuff here */ if (typeof e.preventPropagation != "undefined") { e.stopPropagation(); } else { window.event.cancelBubble = true; } /* more stuff */ };

thanks

hey what if I assign a value? span value="441"?

there's no value attribute for the span element either

Thanks

you're welcome

hehe.
hm oh well actually I oculd just use innerHTML
hm what's the best web hosting function to get all my counters? on class or on name?

class, there's no name attribute for the span element ;p

hehe, okay I'm a noob
euh… is there a function or should I use a library?

you'll have to create one or use one of the plenty that are out there

hm. is it me or is looping trough all elements a really bad idea?

a lot of people get away with it, so it's probably not too bad

not really a bad idea
but there are better options which are not widely supported tho
using XPath for example
with JS together

probably a better idea, blazingly fast, and there's JS-XPath for IE

URL?

http://js-xpath.sourceforge.net/

ty
I'll definately check this out

i haven't dug deep on the browser support yet, but i imagine that at least opera 9 and safari 3 support it

hey
hi
hwo do you add javascript to a webpage dynamically?

but once i do that, it doesnt seem to run

it gets addded to the HTML but nothing happens

how do you add its contents?
you have to append it in a text node iirc

hm I already got a getElementsByClassName function in my libraries

i append a script element as child of div element
wont work is it?

not sure, but i would think that it'd work

oh wait..i figured just now
it only works if it is in the head tag
then the JS will be executed after u add it

upon converting a html to xhtml, I get javascript errors that I never had before… is this normal?

why convert to xhtml

what object.style.foo property contains the anchor/anchor hover properties? i can't find them in my reference

http://paste.css-standards.org/19467

You may need a CDATA
And I don't think you need a "break;" for the default case

is CDATA not required in html4.x ? cuz before switching the document to xhtml, this error was non-existent?

Correct.

ahhhh

It's not REQUIRED in XHTML either, but you'll have to use special chars.

ahhhh, gotcha, thanks greatly

I don't really know why showE2 is written the way it is…
if(document.all) { el.style.display="block"; } else { el.style.display="table-row"; }
Does IE not support table-row?
….actually, you might be right. I'm buggin' out.

well, there are 4 — showEl - showE2 - showE3 - showE4 … all sharing the window.onload
from all ym past experience it is not supported by IE
s/ym/my
if it is written weirdly, forgive me, I'm still new to js, plus this was the only way I could get the 4 window.onloads to work together, as they all perform the exact same function, just that they "unhide/show" different tr
s/unhide/hide

I suggest using a good framework.
Try prototype out, or ExtJS
That way you could just do $('elementid').show();
or $('elementid').hide();

http://rafb.net/p/f84Fpf95.html

It's smart enough to tell if the element is a TR, and use table-row.

could you point me to a url/doc so I can read up on that

My script acts funny sometimes while calculating .counter

Prototype is here, http://www.prototypejs.org/
ExtJS is here, http://www.extjs.com

tyty

http://papernapkin.org/pastebin/view/1002

Try using parseFloat
Rather than using parseInt

why? I want ints

Just give it a try for me, mmm'kay?

hi all. Is there a way to grab the first key of an associative array object without having to loop through the entire thing with for…in?

hm one of the problems it that I can't reproduce the error

anyone catch my question? what's the anchor property called in the object.style object?

The anchor property?

0, the script went down to
or somethign like that

oh yeah… speaking of properties, is there any way to get access to the querystring within a javascript?

anchor color
link color

i.e. say I go to http://somewhere/somepage.html?p=v&p2=v2

for a specific element?

is there any way to get access to p and p2 as a set of properties?
or do I just have to parse out window.location myself?

i.e. for links inside a span

element.style.color / element.style.textDecoration

element.style.color does not change the links

Prototype has helper functions for parsing the query string
http://www.idealog.us/2006/06/javascript_to_p.html

parseInt(value, 10);

isn't that standard?

BradleyB, thanks

it only changes regular text

var query = window.location.search.substring(1);
I don't understand that line, though

no, it "guesses" the base by the value

what's .search

js ref

oh

`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/

nevermind, .location is an object, thought it was a string

how the heck can you see the difference between base 8 and 10?

js onclick

anyway, I don't seem to be able to reproduce the error so I'll just guess it's gone

`js onclick
`js onclick()

08 would be considered an octal number (0-7), so it would return 0

http://papernapkin.org/pastebin/view/1002

use break; in the loop

yeah, I figured, but there's no better way to do it?

not that I know of
well, if you knew the first key
:p

heh
okay, thanks for your help Maggi

you're welcome

thanks, you were 100% correct about needing the CDATA

hmm, how do I get element.nodeName to return without a namespace prefix?
without resorting to substring

Damn then, I'm on a roll.

uhoh, lol…. ok so I added the CDATA, and the el error went away, but now…. suddenly it is erroring on another el that didnt error before the CDATA….
weird, lol…. I wish I hadn't been asked to change this page to xhtml, lol

you could try element.tagName
havn't tested it tho

Maggi, yeah, that also returns the ns prefix

mm

Why on earth does it HAVE to be XHTML?

it is long, but should I pastebin the "entire" js code?

I never understood people that demand that shit.
You can, but I'm kinda busy believe it or not.

one sec. might found something

I'll try to help you though.

xhtml is kinda silly…

I agree, and I even warned them, that I don't know squat about xhtml, but they didn't care

*shrug*
pastebin it

hm I must admit that I don't know the difference between html and xhtml either

so i guess no one knows the object.style property which sets hyperlink hover color?

vs. img src="blah.png" alt="blah" /

That's the difference.

daedeloth, XHTML uses the XML syntax

color

element.localName

http://paste.css-standards.org/19468

fedx_, duh, object.style="a:hover { … }"
Maggi, ah, I missed that, thanks

[T], okay, but what does that mean for the pc?

that should work

And whats the problem again?

that won't work. it only works for non links

You only need to use "var" for the first use of the var

daedeloth, It means very little unless it's actually served as XHTML. Most XHTML pages are actually served as text/html so it makes no difference

you need to make the rule's selector more specific

can it speed things up?

daedeloth, no

And if you're only using it one, just do document.getElementById('element').onchange = …

xhtml has some stupid "rules" if you want to serve it as text/html
e.g., you can't collapse empty elements

daedeloth, in theory it should make it easier to make the page look the same in different browsers

el has no properties hideE3(null) onload() el.style.display="none";

can't be collapsed as textarea/

as span/

Well, there you go.

there aren't special properties for hover; instead a different rule is applied, which can have different values for properties such as color

Add var checking into hideE3()

hm well I'm using xhtml for my page, served as text/html What should I do to repay my sins?

if(el) { el.style.display='none'; }

ooooohhhhhhhhh

Because someplace in that script, its obviously calling hideE3() with NO element

daedeloth, use html 4.01 strict

but everything is written in xhtml already
http://thijsvanderschaeghe.no-ip.com:81/projectX/

hihi

Is there a function which will return the string representation of an object type? For example, if, while working with DOM, I do element.objectType() and it would return 'HTMLOLObject' or something like that?

is there a method for getting the first element in an "associative" array in js similar to key() in php?

cool stuff man!

*prod* *prod*

element.constructor.name

BradleyB, thanks.

for (var i in myArr) { var Foo = myArr[i]; break; }

444edf17ade93ae if you want to check the counter ;-)

no, not many languages use that approach even modern PHP doesn't

thanks

its just an iterator

There's no such thing as a "first" element in an associative array, is there?

but it's stored internally in the array, right?

Since the "key"space is unordered

there is in PHP
it stores the name-value pairs in a list

I'm assuming based on which was the first element inserved into the ass. array, correct?

hash keys are (should be) in a random order to prevent algorithmic complexity attacks

unless they're rearranged, yes

TheoMurps: if the array is an iterator, you can get the first element but js does not have a "iterator" or even a real hash so we gots to make due.

it's getting them in ES4

well that is good news indeed

can some one look at http://aidan.homelinux.com/websites/dwl/ the pictures on the left, when you click next if you want to click previous, you have to click the button twice to change direction, anyone know how this could be fixed?

when I have an element a and do alert(a) I get "localhost: [object HTMLDivElement]" popped up, but when I do a.constructor.name, I get "undefined." The first instance is my browser telling me what I've "alert"ed was not a string, but rather an object.
a is indeed a pointer to a DIV element within the DOM

what browser?

using JSON format, when i grab the data the array of arrays are in string format, how can i get that into array of arrays format

deltab Opera 9.5
I mean 9.2

function Foo() {} var f = new Foo; f.constructor.name

Foo

function Foo() {} var f = new Foo; f

{ }

function Foo() {} var f = new Foo; f.toString();

[object Object]

hmm

ii thought the eval converted the string into its array hmmm

Uhoh. Woosta's site says he's sick

"[[']"
sorry

eval is how you convert json to a data structure

i'm looking for a "set" implementation, i.e. something i can add and remove things from that wont have unique elements
i was just using somevar[uniqueName] = "x" for add and somevar[uniqueName] = "" for remove, then i coud do if (somevar[uniqueName])

"[[1,2,3],[4,5,6]]" and on the front-end site I have
var response = request.responseText;
var jsonObj = response.evalJSON();
var array_arrays = jsonObj.info;

to test for inclusion, but it seems a terrible hack

Raevel, how come it's not array hmm

you can't make it work that way in IE

um you sure?

actually, it might not work in other browsers either since accessors are defined per property
you'd have to use methods

i'm not following you

like mySet.add(key, value)

but it works, at least for the "add" part
and the inclusion test

Raevel, see what i mean ?

if you want the info property you have to do send ({"info":[…]})
s/do//

{info: "[[1,2,3],[4,5,6]]}} — have that
{info: "[[1,2,3],[4,5,6]]"} — have that
{info: "[['1','2','3'],['4','5','6']]"} — have that

don't put quotes around the array

is that not correct ?

that would make it a string

let me try that

hi
is it possible to make a scroll bar on one html frame, but to scroll the text in other html frame?

is there a way to define a global variable from within a function?

Raevel, that worked, thank you

omit the var prefix

dont use var and if its a global function i think it makes it window.whatever

hi everyone

raevel and vinse, thanks. i'll give that a try

along the line of the global variable… how do i make an object a singleton?

actually, it might be best to always use window.foo to set globals, that way you know that a variable in an inner context won't be modified instead

i've been using a module pattern i got off YUI blog

such that var myobj = new myobjConstructor(); var myobj2 = new myobjContructor(); but myobj2 is really just another pointer to myobj

um
if you new something, its a different instance

exactly the thing i want to resolve

well, i guess you coudl do some trickery to avoid it, but seems wierd … thats what new is supposed to do
http://yuiblog.com/blog/2007/06/12/module-pattern/

if you need a singleton, just use an object

that achieves a singleton with its private vars
*its own

var myObj = {/* properties */};

is it a requirement that you be able to new it?

i have two scripts - each are dependant on an object method - i don't want two objects in order to use that one method
vinse - no

the module pattern can give you, if you know java, what java calls "static" methods, which i think is what you want

i was thinking of a factory function that either finds an existing instance and returns that, or creates an object and returns that

the html2dom url doesnt convert closing elements, wonder why

you don't have to

there's no such concept in the DOM

you create the entire element, beginning and end, and then add stuff inside of it

var tr_0 = document.createElement('tr');
myTable.appendChild( tr_0 );

hmm, does javascript have a string formatting function, a la printf?

there no closing tr tag,

no :/

oic

bummer

is that alll I need for new row ?

yep
it'll be empty, but it's there

i want to have a button next to a form input field that opens up a window and the user to click on one of the links in the window and it automatically gets put into the form field, how do i do this or what do i need to search for on the net

bye friends

- but is there any solution if I want to run my func1() as well as anything else that might already be set to run (and I don't know the names of the functions)?

in other words you want to add an eventhandler to an elemetn that may already have that handler defined, and you want the new handler to not overwrite the old handler?

I think so, yes

i hacked a solution together that was pretty ugly for something like taht, i'm gonna wait to see if anyone tells you a better answer before i burden you with mine
wait, an onload handler?

yes, onload

um
ok i dont understand what you're doing

your redefinition of my problem sounded accurate

yeah but it doesnt make much sense to do that with onload

I have a script that highlights keywords, it works fine on html pages, but if they already have an onload event it ignores my script

cuz how can you add an onload handler? you cant get the body element before its loaded, and once its loaded, hasnt the handler already run?
how does your script add the handler?
use a pastebin
and technically, its not "ignoring" your handler, it overwrote it

well, it just has a function that search and replaces the dom, function is start, last line of the script says "window.onload=start", works fine but not together with other scrips that use the same method. I'm looking for ways to modify my approach so it will..

you have to check if there's an existing onload handler, save it as a var in your script, and change your script to call it inside its handler
and you may have to call it using call() or apply() to make sure you preserve its scope

ok at least I know it's possible now, I'll need to go lookup the syntax though, thanks for the pointers

hi all. anyone familiar with lowpro or event:selector libraries?
I can't grok how to pass arguments into a behaviour object

what's the ALT code for a copyright symbol?

169 iirc

how can i iterate over array of arrays ?

a loop in a loop

with nested loops

with an iteration of iterations?

with the same answer three different ways!

use a recursive function if you have N dimensions

always have 3 elements per array

but only 1 is right!

want to assign the 3 elements to variables

thankies!

Raevel, you have example ?

hi guys
how can i convert a responseXML to text?

It is text. Or at least, it's a string.

outter for loop { inner for loop assign the 3 elements to 3 different variables} } — an example of that ?

You can alert it, try it.
Is the HTML Entity for a copyright symbol © ?

hey people

Jan-, When I try to alert it's say that is a object XML I'm guess that my XML is invalid and i would like to test it

Jan-: yea, it's ©

Hmm. Sorry, no idea then msetim.
thanks

Jan-, thanks

Jan-: you can use the ascii code as well, ©

Raevel, could you help me out with the array of arrays please

why would you do that when you can use something easy to remember

I think I can just use the literal character in a JS string.
….can't I?

Jan- bookemark this : www.lookuptables.com

nah, just thought since he knew the ascii code but not the name
Jan-: you can

lol ok

how can i move a scrollbar max to the right side of screen?

but unfortunately, it's illegal in XML.
Nrgh.
And even more unfortunately, Woosta's XML.Simple library doesn't know that.

is there a way i can update a form field value on a different page by clicking on a link

Guys, I find the problem, my XML have a duplicate attribute. This XML go from a 3 party application and I cannot change it,, someidea of how I can fix it?

how can i move a scrollbar max to the right side of screen?

I can to load a string how a XML object?

i figured out the array thing cool

There's nothing illegal about a copyright symbol in XML

so to rebuild a table, i need to clear out the children nodes and rebuild it with dom ?

Jan-: ^^

If you're sick, you shouldn't be online :/

The problem you may be having is if you're declaring one character set and using another
Yes, I know
Not going to help much :-D

It's traditional

A much more likely plan of attack :-D

You know what, you're right
Although actually… hrmn.
It may be some other character.
But I don't think so.
Either way I am doing something here which is causing xml.simple to output invalid XML.

is there any way to move a scrollbar????

obj.scrollTop = whatever

ty

actually… is that readonly?

somebody knows how convert a string to a xml object? I have a valid xml put in a variable and I would like to use it how a xml

Anyhoo - I'm using xml.simple to produce XML containing metadata about a quicktime movie.
If I use a sample movie which has a copyright field (containing the © character) the XML appears to be invalid.
If I use a sample movie which doesn't, it doesn't.

i'm looking for a technique to "fix" the first (leftmost) column of a table, but scroll teh rest … i can do this "row-wise" but column-wise seems to be a different beast

IE complains "The XML page cannot be displayed/An invalid character was found in text content"
If I display the XML in Firefox, where the copyright symbol should appear, the line actually reads:
? 2006 Warner Independent Pictures. All Rights Reserved

It's obviously improperly encoded.

encoding problms …
jan

xlogic?

That error is due to bad encoding

iframe.scrollleft = 0; does not work.

No idea. GIYF.
Oh scrollLeft

guys, my English is understandable?

Imperfect, but comprehensible.
That should have been "Is my English understandable?"

if I merge two DOM documents together, is there any way to merge the namespace prefixes?

Jan-: you're serving utf8 but declaring it as ISO8859-1 or something similar

e.g., in one document, I have XMLSchema prefixed with 'xs', while the other has 'xsd'
is there any way to unify the prefixes?

Jan-, what a shame :P Thanks..

I'm doing what now?

(1) how on earth do you have XML in text?

What I'm doing is to put the output of XML_Simple.XMLOut into window.clipboardData(…) and then pasting it into a text file.


Where's the error comming from then?

hi I'm updating an image src with javascript, but sometimes IE doesn't display it. The user has to right click and 'show picture'… why would IE do that??
hi I'm updating an image src with javascript, but sometimes IE doesn't display it. The user has to right click and 'show picture'… why would IE do that??

Woosta, I will try to be comprehensible. I have a valid XML in a string. e.g: var a = 'aaaahello/aaa' and I would like to convert it in a Object XML to work with childNode method….

Jan-++
yes. I got that.

How was I supposed to know that?!

How on earth did you end up with it in a string?

Now I have to figure out what sort of encoding is used by the FileSystemObject.CreateTextFile method
Urgh

Someone at 71.6.194.243 pasted "not sure why this does not work" (25 lines) at http://erxz.com/pb/3608

Jan-: because you ask someone who already knows. Then you impart that knowledge to someone else one day. Then they say "but we finally got rid of all the stupid charsets when Microsoft went bankrupt!"

not sure why the code does not work. any help is grealy appreciated: http://erxz.com/pb/3608

Jan-: it's windows .. it will be ISO8859-1

Microsoft make kittens die.
Hey, do you have Pizza Express in .au?

I think the evidence is still out on Microsoft's involvement in the kitten killings.
No, but it scares me. Factory pizza always scares me.

We toss 'em, they're awesome!

It's not factory pizza.
It's made in the restaurant.

I saw "frozen pizza" on "How it's made" last week. I'll never believe one of those "just like mamma makes" adverts again
Jan-: factory pizza doesn't have to be made in a factory
Pizza Hut is factory pizza

I always go and have an American Hot with extra spicy beef, chillies, onions, and chilli oil, when I have a cold.

Woosta, I know that XML is text Thanks for you help

Slam! Squish! Flop! Shimmy! Splat! Ding!

raevel and vinse, thank you for your help earlier. i was able to finally get the script working using that method for global vars

eh? Do you not understand the question?

Woosta, I think that you answer to me if I know that XML is a text. Sorry if I don't undersand

anybody

Is there some way I can append a chunk of XML onto an existing XML document?
Is there some way I can append a chunk of XML onto an existing XML document?

Deep-merge the two objects ..
Of course, that ain't necessarily a simple task

de-eep me-rge?
I am suspecting, not for the first time, that Woosta is considerably better at this than me.

hello everyone
how can i get access to an specific element of a select box?

?

Jan-: I don't have any deep merge code lying around. Someone else probably does, or google will find it.

i've tried doing document.getElementById("mySelectBox").options[0].text but it didn't work
it says undefined (altough it exists)

Jan-: do you have code accessing the existing XML?

fokker, you can probably use document.getElementById("mySelectBox").childNodes[0]

no, don't do that
Use the options object
just like he did already

great. But how?
because i'm doing that already and it doesn't work

No idea why 'text' is showing undefined .. but try the more generic textContent

is that compatible with all browsers?

no
you'll need innerText on MS

so i can't use it

eh?

innerText?

text should be working
I doubt it's write-only
So something else is wrong
See what textContent gives you

the rest of the script works just fine

guys!!! I found how to make var xmlobject = (new DOMParser()).parseFromString(xmlstring, "text/xml");

So?

Tks

I could have told you that ages ago .. plus that it won't work on MS browsers
But you never answered my questions

how would I go about recreating a table with DOM ?

`js html2dom @ mod_cure
`html2dom @ mod_cure

html2dom: Woosta's (x)html to DOM convertor .. convert xhtml chunks to DOM scripting: http://rick.measham.id.au/paste/html2dom.htm

i used that

i've tried doing innerText and it's still returning undefined

pretty neat

Put a (simple) table in the top-left, click convert

but not working

that's what I thought

Woosta, sorry I don't see. You is cool! Tks

sure it is .. you're doing something wrong

it gives me back the code
but how do i clear out the exisitng table and recreating it withthe code it gave me ?

See, that's a TOTALLY differenet question

theTable.parentNode.replace(newTable, theTable)

`js empty @ mod_cure

js empty: A function to empty a node of content: function empty(node){ while(node.firstChild) node.removeChild( node.firstChild ); return node }

im using that

bah, insin's is much better

it works for my select

replaceChild even
theTable.parentNode.replaceChild(newTable, theTable)

sorry to bother you mate, i can see that you are quite busy…but, any clues then?

http://developer.mozilla.org/en/docs/DOM:element.replaceChild

none. It looks like your first option has no text. Does the page validate?

yes, it does
and it has text too
ok, i'll keep looking then

table width="100%" id="calendarinfo" border="0" align="center" cellpadding="0" cellspacing="0" class="calendar_small"

trtdTEST/td/tr/table

thanks for the help anyways.

check you DOM inspector

i get no warnings whatsoever

http://erxz.com/pb/3608

the only error i get is when i call the function that executes that line

cellpadding, align, cellspacing won't work .. but OK
that code didn't come from my site :-D
You're appending td_0 to the table

hi, how can i dynamically include (end evaluate) a javascript file?

`js include @ rafsoaken

js include: Include another Javascript file in your Javascript .. http://www.phpied.com/javascript-include/

thx

Woosta, the site converts it but how do i attach the code form the site to my table ?
myTable.appendChild( td_0 ); — no good ?

that code didn't come from my site :-D
You're appending td_0 to the table

Did my site give you that? No.

no

What's the parent element of a TD?

how do i attach it to the table ?

…?

what u mean

What is the ONLY parent element a TD can have in HTML?
it's not a UL)

not sure

no
neither

er
oops, tr
;-)

yes

Woosta, what is it ? just trying to learn

pfn just answered for you

mod_cure, you should read the HTML DTD/spec
it answers *everything*

been doing that and picking at it all day

#2, you should run all html through a validator

He knows enough HTML to know the answer .. surely ..

which will basically answer that question for you, as well

After all, his HTML was valid
do you see the problem yet?

no

Well.
That was fun

What is the ONLY parent element a TD can have? (remember, pfn just answered it)

Jan\: welcome back

Woosta, so i attach it to the tr ?

Bingo!

Jan\: I'd've told you about the encoding if I'd been around

sure sure
that's what they all say .. after the fact

not sure how that would fix the issue

hi
I have a javascript problem

Jan\: in JavaScript you'd use \xA9 or \u00A9, and in CSS \A9 (with no x)

–you're saying clear out all the children nodes with id=1 then recreate all the trs ?

this works in Mozilla, but not in IE
options.dataXML = (new DOMParser()).parseFromString(options.dataXML, "text/xml");
anyoine can help ?

Weren't you just here?

http://dev.abiss.gr/sarissa/

Woosta, i dont see how that makes sense

which?
whuh?

is there a function that converts to XML ?

Assuming id="calendarinfo" is your table, then the code you pasted will work once you fix the heirarchy problem

http://dev.abiss.gr/sarissa/howtos.html#loadstring ?

Someone at 71.6.194.243 pasted "this way ?" (54 lines) at http://erxz.com/pb/3609

stop doing his work for him
I hate lazy people

http://erxz.com/pb/paste

id="2" … bzzzt
WTF?

-_^ …

That code is completely different

agree, it's an example

thank you :-) I will try it

why did you change the whole thing?

Woosta, to MS Browser exist some parseFromString ??

ok, sorry let me post it

what you had before would have WORKED

In doing document.write('some string'), what are the rules on what needs to be escaped / how it will be un-escaped?
uIn doing document.write('some string'), what are the rules on what needs to be escaped / how it will be un-escaped?/u

anything written will be parsed just as if it was written statically into the html document

Raevel, Cool, thanks!

Someone at 71.6.194.243 pasted "updated" (35 lines) at http://erxz.com/pb/3610

Woosta, http://erxz.com/pb/3610

anyone know of a open source iframe library that adds navigation and resize controls?

It can't very well not be open source, can it

what do you mean? i'm talking of an OSS license, such as the GPL

Woosta, the tr tag should have the id instead of table and attach the tr id to the dom elements ?

Jan\: someone could have applied a very clever rotating cypher algorithm to obfuscate it! :p

jan\, insin, that's not what "open source" means..sorry to confuse

that wouldn't be very useful anyway!

heh

Quitit
*mutter*
Next time I'm gonna have it check off the MD5 hash of its own source, or something *impeccably* evil like that.
"TAMPER, would you?!"

Raevel, can u help me out for a sec please ?

Jan\: the problem is lawyers

Which file do I need to include if I just want to convert a string to XML ? sarissa.js, sarissa_dhtml.js, sarissa_ieemu_load.js, sarissa_ieemu_xpath.js, sarissa_ieemu_xslt.js

mathiii, why do you assume insin would know that

what do the docs say?

Jan\: mutant psychic powers

What, him too?!

insinfound nothing for now on

trying to figure out how to attach the dom code to a table, trying to recrate the table

i'm looking

Jan\: yes, you aren't special anymore

*sob*

If I read a JSON object from an array & then modify it's fields, will the changes appy to the object in the array, or would I just be working with a copy?

do you mean a JSON text, or are you referring to an actual Object stored in an Array?

the changes would apply to the instance of the obj that you modified

that's avoiding the essence of the question
is the object a reference or a copy?

if you're talking about an Object, you'd be working a reference, not a copy
that's *not* a "JSON object" though, which is why I asked the first question - JSON is a text format

a clarification through pasting of the context to which you're referring could more definitely answer your question

var a = [{'property': 'value}]; var o = a[0]; o.property = "changed"; a[0];

Error: Error: unterminated string literal at line 0: var a = [{'property': 'value}]; var o = a[0]; o.property = "changed"; a[0];

var a = [{'property': 'value'}]; var o = a[0]; o.property = "changed"; a[0];

{ property: changed}

var array = [{field:1}]; var obj = array[0]; obj.field+=1; alert(obj.field); alert(array[0].field);

ok, that clarifies things - that's object literal notation, not JSON
and you would be changing the object itself via a reference, not a copy

looks like JSON

haha

JSON is a text format
you haven't been reading that awful article on Dustin Diaz' site, have you?

How can i add #balh to the end of a url in javascript WITHOUT reloading the page??

var array = [{field:1}]; var obj = array[0]; obj.field+=1; array[0].field;

2

josh[n00b]: window.location.hash = "blah";

thanks insin

you're welcome

josh[n00b], in FF it wont reload the page. In IE6 the anchor has to exist or the page will reload, iirc

thanks [T]

json is a definition of how to create strings of javascript that when evaluated result in an object that usually encapsulates data or collections of data in the form of javascript objects

I like the usually

is {"field":1} JSON, vs {field:1} object literal notation?

they're both object literal notation
if it's not a string, it's not JSON
'{"field": 1}' is JSON

okay
thanks

sorry to sould like a stickler, just wanted to avoid confusion now and in the future
*sound

and you say obj = eval(json_string) (essentially)
^
ideally you'd like to use some library to handle the requesting of anything that returns json and have the json automatically safely evaluated by the library

If I append a bunch of properties to an object, then do a for/in, do they come back in the same order they were defined?

i think it's mostly really meant to be a data interchange format

Jan-: the ordering is not defined

an alternative to xml

afaik at least

http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Referencetatements:for…in
"A for…in loop iterates over the properties of an object in an arbitrary order"

How do I setup a scrollbar callback?

i wouldn't believe that unless i saw it in the ecma spec though

in practice all the browsers iterate with a consistent order

are you using any library to attach listeners to events?

nope

what browsers are you trying to support?

IE and Mozilla

I use my own HashTable object which uses an Object for storage and manages the keys using an array, just to be safe

i'd recomment using the Prototype library to bind a listener to the "scroll" event for the appropriate element

Ill check it out. Thanks

np
my bad

Jan-: no

Hrmn.
That's bad.

why would you use a library? it's not enough to just do eval(json_string);?

you're correct. that's prefectly suitable…

What does "constructor is not an object" mean

a library could streamline the process for you so you could set the parameters for making a remote request and handling the return object that resulted from evaluation of the json
and a lib can also make sure the json is safe, and probably better handle parsing errors

ok

^

Jan-: maybe you're using "new X" when X isn't a function

bc like i said earlier, you should only really be dealing with strings of json that are the result of a request or parameter data do be submitted with a request you are making

Jan-: or foo.0

that's what I was thinking
but it's not my code, so it's tricksy
is Woosta still around?

"Jan" at 71.6.194.243 pasted "Glitch with XML_Simple" (32 lines) at http://erxz.com/pb/3611

That may well be my fault somehow.
But I'm not sure.
If our antipodean friend wakes up again, perhaps someone could mention that to him if I'm not around.

Jan-: I'm guessing you mean this.inner = innerFunc;

Very possibly.
I have no idea what I'm doing with clever object notation stuff.

Well .. do you want innerFunc to be called when you call outerFunc?

er

Or do you want outerfunc to set a function called 'inner' that calls innerFunc when it's called?

I just don't want to have to put a ton of this_ws_Properties.foo lines into outerfunc, in my real app.
I just don't want to have to put a ton of this_ws_Properties.foo lines into outerfunc, in my real app.
Ahhh.
Obscuring problem.

actually .. on second look, you code makes no sense ..

Ignore it. It's gibberish.

done.

XML_Simple does *not* like objects with explicit null properties.
Hang on let me prove it

"Jan" at 71.6.194.243 pasted "Javascript" (3 lines) at http://erxz.com/pb/3612

I think we need another if() case in the "X in obj" loop in XMLOut
"constructor is not an object", presumably in:
if (typeof(obj[X]) == 'object' && obj[X].constructor == Array) {

why not change that line for if (obj[X] instanceof Array) ?

Hang on, I'll try it
It really gets upset if obj[X]===null

so check for that explicitly?

that's plan B

not instanceof

hi

Jan-: do you want it to output an empty element for the null property?

I guess so.

I am updating a certain div on my page and adding a select form to it. Immediately afterwards I run a javascript command to select a certain index of the form. It complains that it can't find the form (null). Am I making a mistake or is it not available yet?

Or, modify XMLIn to recognise the string "null", or something.
since null != '', as far as I know
null == ''

Jan-: false

Jan-: then how do you tell the difference between null and "null"? :-)

_STUPID_PREFIX_STRING_null

emptyString/emptyString

how are you adding the form?
woo(sta)

If it's not donig that, then it's wrong

Element.update

did you write that? What does it do?

did you catch the paste bin?

That should give something like optbar//opt
If it doesn't, there's a bug :-D

Awoooooo-gah!

i'm using rails to generate the javascript. But basically Element.update("divname", htmlcode for select box")

is there a reason why 'explain' is higher than others? http://75.18.204.208/

then I presume that uses innerHTML - adding forms/form elements with innerHTML is problematic

yeah
okay. so that's the problem. I will have to generate the form with the correct element selected at the start. e.g. set the selected attribute
it doesn't fit into my code so nicely

How do I get the scrollable width?

can you pastie your context?

I mean for any html page. I want the maxium scrollable area.

i'm not sure what exactly you're looking for

I would think it was document.body.Height

the document body width/height depends on the content, i believe. i'm confused by your search for the maximum scrollable area
i would say the maximum scrollable area of a html document would be infinite

I found it
it's document.getDocumentHeight();
Oh. I see your issue.
I want the CURRENT scrollable area

"Jan" at 71.6.194.243 pasted "Kinda fix for xml.simple" (17 lines) at http://erxz.com/pb/3613

OK, so that's probably really uglysome.

scrollHeight ??

But it prevents the error.
As to what a real fix would be… rhi ruhrhoh, Rhaggy.

eww
not using that :-D
working on a real fix now

*stifled sniffling*

uglysome?

ic. so that's workin for you now?

Yep, that nailed it.

cool

A girl that knows Javascript? Thats very cool. Never met one.

Jan-: 0.110 is up
http://rick.measham.id.au/paste/xml.simple.js
Tests at http://rick.measham.id.au/paste/xml.simple.htm work

 Web Hosting Services | Hosting Services

*
To prove that you're not a bot, enter this code
Anti-Spam Image

Leave a Comment

You must be logged in to post a comment.


Blog Tags:

Similar posts: