Is there a way that I can turn the content of an object property into a string without employing html elements

is that correct or I have to write the unicode between ""? kanji_end=F98E;

…" and i can find TD by "table.rows[rowIndex1].cells[cellIndex1];". How to find that DIV with class="dirst" ?

1) use a library which will have a function for doing this 2) Use something standalone like this: http://www.robertnyman.com/index.php?p=256

nsIXSLTProcessor.transformToFragment]" nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"

if(!confirm("…") HERE I WANT TO STOP THE PAGE FROM LOADING" How?

grimboy, thanks, i will look

bianchi, That's a smelly Gecko error that won't really tell you much and tells me even less without the code behind it. If you want to isolate it yourself get firebug and use it's debugger, console.log or a mixture of the two.

what is wrong in this code http://pastebin.ca/656795

The paste 656795 has been copied to http://erxz.com/pb/4032

teLiiiiiii, return false from your handler if you want to stop the default action (navigating to another page)

i have firebug, and i'm reading this from firebug. Let me paste code…

THX

wfq, Aww… why no Kanji? Anyway, you seem to have both your comparison operators the wrong way round.

grimeboy, I know I am just doing a test

Eh?

to know if it at least works in the reverse way

A function called identify_kanji() that doesn't allow kanji?

I'm getting a runtime error in IE when the page is closed, it says "There was a runtime error, do you wish to debug" and points out a null or "not an object" portion of code, how can i prevent these errors? o catch or something I remember reading?

wfq, Also I you need to use 0×4E00 instead of 4E00.

Twey, yes this is what I am trying to do

Mace[work], Javascript does have a try{}catch(e){} construct if that's what you are refering to.

yes
hm ok

That will only stop the symptoms of the error not the cause. If you have Microsoft Script Debugger installed use that to debug the script like it suggests.
wfq, Oh, you've got unbalanced parentheses there as well on your if.
You've only opened two but closed three.

I'm reporting what a user has told me, i shall install it
strange it happens when the window is closed though

I would have assumed it was because of a window.unload event but if you don't have one of them then the cause is rather mysterious.

yes, I have ammended but it is not still running

hm I do have a window.unload event in place from a previous developer
why on earth would they need that

Mace[work], Sometime to clear up memory leaks. Confirm navigating away if there's data to be lost.

not it is working

i see. well i've located the source, thanks

wfq, strlengh isn't a function.

yes
I have changed it

Well I'd recommend you get firebug and trace out each char code that get's looped over (as that would be painful using alert())

how do I convert Function.arguments to a proper array

*blank*

null || 5

5

4 || 5

4

hmm

4 | 5

Jo-W: 5

so || is not "OR"?

|| is exactly 'or'

| is binary OR

(4 || 5) ? "True" : "False"

True

(null || 5) ? "True" : "False"

True

(null || false) ? "True" : "False"

False

alert();

27 & 4

Error: Error: ReferenceError: alert is not defined at line 0: (null)
Jo-W: 0

!! 5

true

hmm

var a=true; !a

false

27^4

Jo-W: 31

since || returns the first "non-false" argument, it can be used in a conditional as a boolean

2710

27648

event = arguments[0] || window.event; checks whether argument[0] exists (non-IE), otherwise it chooses window.event (for IE)

27100

432

Math.pow(27, 4);

531441

yup

cool
cheers

for(;;

so it's like arguments[0] == null ? window.event : arguments[0]
shorthand for shorthand - that's true skill

is this a valid statement in JavaScript? if(obj != ('+', '-', '*', '/', '%'))

var isAlive=true; !isAlive

false

if not, how would i do it?

no, because uninitialised arguments are undefined rather than null

oh right, of course

the bot accepts private messages

oh

var ev = e || window.event not work?

thanks

original question was about an onmouseover HTML attribute

blah = nul; (blah == undefined)

Jo-W: Error: Error: ReferenceError: nul is not defined at line 0: (null)

so no parameter name was available

blah = null; (blah == undefined)

Jo-W: true

blah = null; (blah === undefined)

Jo-W: false

Jo-W: same applies to you - /msg the bot please
keeps the channel a bit tidier for everyone who knows null == null

GarethAdams, ok )

ah! if(obj != '+' || obj != '-' || obj != '*' || obj != '/' || obj != '%')

null == undefined, null !== undefined

Yuck
if(!/^[\+\-\*\/%]$/.test(obj))
Or, if("+-*/%".indexOf(obj) === -1)
Latter's more efficient actually
Neater too

obj = "-*"

what thyko did is faster
then regexp

sweet

Mm, good point
if(obj.length === 1 && "+-*/%".indexOf(obj) === -1)
Hmm, or how about…
if("+-*/%".indexOf(obj) === -obj.length)

Hi how much power does javascript hosting have over an applet?

uh

As much as the applet exposes
It works — length can never be negative

Twey, what do you consist under expose?

And the only possible negative value indexOf() can return is -1
Javascript can call public methods

you obviously missed the 'readability' chapter in your textbook

Of the applet object
Heh, it's readable enough

right now, yes
wouldn't like to come back to read that in a month

Twey, can I create new instances of objects ?

I'd puzzle over it for a few seconds then think, oh, that's clever, and move on
Mmm, I don't think so
Although that's a limitation of Javascript, it's not inconceivable

where can i find more information about javascript and applets?
i have a nice applet with a sucky interface

http://www.raditha.com/java/javascript.php perhaps

so i want to move the layout to javascript
html/css/php/js

:-\
DonJohnny, work on your Java interface, keep it as self-contained as possible.

…" and i can find TD by "table.rows[rowIndex1].cells[cellIndex1];". How to find that DIV with class="dirst" or any other way to find it?

Twey, i dont have the original source
only a decompiled version

Well, work on that then

function ackermann (m, n){if(m==0){return n+1}else if(m0&&n==0){return ackermann(m-1, 1)}else{return ackermann(m-1,ackermann(m,n-1))}}; ackermann(4, 2); //ASPLODE NOW?

Error: Error: InternalError: too much recursion at line 0: (null)

Bah

Hahahaha
Point for creative asplosion attempt

is it possible to call JS in the middle of a html hosting page?
like in text, to put the current time or something?

… /script

aah, ok

Im having "not defined"-problems trying to get simple demos working in Script.aculo.us… anyone familiar with this?

Better idea to use DOM methods than something like document.write() though
#prototype

string.toInt() converts a string into an array of ints, but i want to convert the string into 1 int. What method does that?

can i make a node unselectable in ff
i mean, can i make the text inside it unselectable?

what is the javascript to get the element id ?

parseInt(mystr, 10);

10?
got it. Thanks

thats base 10

tags using javascript

i know .className will tell me its "foo", but i also want to know the id

var im = mydiv.appendChild(document.createElement("img"))

ok, how to give src path ?

im.src

im.src = "/path/to/image.png";

thanks,let me try this

Jo-W: parseInt(str, 64) gives me MIME?

No — I don't think parseInt() goes up that far.

no it means the str is that base

parseInt("1", 64);

NaN

parseInt("z4Ag4oiIIOKEnQ", 64)

Jo-W: NaN

this is the big one [return parseFloat(number1) operand parseFloat(number2)]. operand contains '+'. how do i make that statement work?

Jo-W: Goes up to base 36 apparently — digits plus letters
parseInt("1", 36);

1

parseInt("1", 37);

NaN

With difficulty
eval() is an option

no kidding

mm thats to bad

if i have a function foo (bar, baz) { how can i check if baz was passed }

if(typeof baz !== "undefined") { /* baz was passed */ }
Depending on the parameter and what you're doing with it, a simple if(baz) might suffice.

right as long as im not trying to pass a zero?

heh, yep
you can do a default assignment and test against the default as well
baz = baz || null; if null.. blah

*wince*

we're talking options here

That's exactly the same as doing if(!baz) baz = null;

unless baz == 0

No
*Exactly* the same.
if(!0) will pass as well.
Using a default then checking against that to see whether the argument's been passed is completely redundant :-\

he's testing if it has been passed, not if its a bool.. maybe i misunderstood

It's basically two tests.

Depending on the parameter and what you're doing with it, a simple if(baz) might suffice.

if(typeof baz !== "undefined") { /* baz was passed */ }

Which will test if and only if it's been passed.

yea, but if he passed 'false', it will fail and it won't say if something was actually passed?
sure.. that is the right way to do it

No…
typeof false !== "undefined"

i was talking about if(baz)

typeof false === "boolean"
And I already mentioned the data restrictions on that

its not the same as if(!baz) baz = null; that's all I was saying

Your suggestion was baz = baz || null; and then to check if baz is null
That is indeed exactly the same as if(!baz), since baz will be assigned null if it contains any falsy value, not just undefined

haha, I'm a schmuck

can i make text in a node unselectable in ff?

I doubt it.
You could layer something transparent on top of it, but that would only make it trivially harder to select.
And… why?

for effect

Rii…ight.

hi guys

stupid question
how do i check if a string contains another string?
or do I've to use regexps or something?

"javascript string functions"

cheers

what you need is "indexOf"

i'd like to have a link on a page that opens a popup with a form in it. When that form is submitted, i'd like it to send the data of the form to the page where the link is located, and then the popup close itself. I have no idea how to do that

substr
;]]

how can I create bcorderqtyinput[100] = document.createElement('input');
or bcorderqtyinput[i] = document.createElement('input');
it keeps complaining bcorderqtyinput is not defined
Im trying to generate multiple variables

var bcorderqtyinput = []; bcorderqtyinput[i] = document.createElement('input');

i see, thanks

`js ref
`js domref
hmm, I need to find out what JS is valid for IE6
`js ref

(0xff ^ 255) + 1

1

what's the deal?

(0xfb ^ 255) + 1

5

Hello. Is there a way to handle real-time typing that updates a span via ajax? For instance I am using the character code right now, but it seems like there should be an easier way
because when a users hits the backspace, it doesn't perform correctly as I am concatenating the charCode

There is no easier way. You have to evaluate both charCode and keyCode.

gotcha
is there something already written?

Maticode, why dont you just use .value and .innerHTML?
on every keychange

it is behind
for instance if i do onkeypress and when I type 'k' it will send '' as this.value
and then when I type 'a' it will send 'k'
which is why i need to send the charCode

look at digg.com/submit
they have a similar feature

yes I know

so there you've got your example?

How can I modify or remove a styleclass dynamically using javascript?

their source is obfuscated

afaik they just removed all whitespaces and line breaks from their code
just purified, not obfuscated

yeah but it is still weird, they are not calling any javascript onkeypress for that form element
must be done elsewhere through ajax or something
well nm, but i dont know where it is done

probably prototype event handling

yeah I don't know anything about prototype event handling

how do I define a function with an optional variable in javascript?

(251 ^ 255) + 1

5

Maticode, just try and grep for "bodytext"
Renacor, you mean an optional parameter?

yeah
sorry

hey

Renacor, all parameters are optional in javascript

i need a textfield with will repeat itself when user press "Add another User"

you can pass as many parameters as you want to any function

hey everyone

oh cool

\

yeah no luck here

Is any event fired when the user 'hacks' the URL to change the hash?

I don't understand you.
Try speaking in jargon, not English.

e.g. the user is at http://www.example.com
the user adds #foobar to the end of the url and presses enter
the page doesn't reload
(because the referent is on the same page)
i'm trying to work out how to detect and handle that

"Handle"?

handle == do something when that happens

Changing the URL bar does not send an event.

make a function that loops in the background

That is an option.

this function checks the location.href value
if oldVal != newVal
the do your stuff

Yeah. I know I could write a poller. But I'd prefer to find another way.

well if you do find another way do let me know

sure … I think I need to go back to the drawing board and just handle the whole thing differently

this is btw. how I control the Back button when I do ajax stuff… when something happens, the location is added a #… when the user clicks back, the lcoation changes, I detect that and do the necessary changes

how can I change the value of a hidden input-field using javascript? I have tried document.form[0].inputtagname.value = 0 but it does not work

assign an id to the input
document.getElementById("myhiddeninput").value = foo

ahh i found out how they are doing it
they have a heartbeat
what is the difference between innerHTML and HTML?

hi
http://www.oreillynet.com/pub/a/javascript/synd/2002/08/30/mozillasoapapi.html?page=last
0×80070057 (NS_ERROR_ILLEGAL_VALUE)

tag?

tag

yep, you can

yes but how can I get the value of the option to the onchange function that I am calling?

the select box' .value will match that of the selected option

i need a textfield with will repeat itself when user press "Add another User"

sel.options[sel.selectedIndex].value

onchange="function(this.value)"

selectname.value ?
ahh cool thanks
they thought of almost everything didn't they

"they"?

the Illuminati

is there a way to stop IE caching images via JS?

you can retrieve images like img src="imagename.gif?randomnumber" and always generate a different random number… IE will think that the image isn't the same

For the window.onresize event, is there a variable in the event object that tells you how much the width has changed?

no you have to calculate it yourself

What's the window property for width?
clientWidth?

depends on the browser

IE

yeah it is

well, IE and FF
window.clientWidth was undefined

maybe you can use document.width ?

it's document.body.offsetWidth
yea

but I'm not sure if it'll work in FF

Hey!

okay
thanks!

How would I access a form element named "lala[test]"? Guess document.myform.lala[test] won't work…

then do document.getElementById("hello")

Will JS ever support named array elements?
er
….

JS doesn't have to support associative arrays, it's *build around* objects…
You didn't get the concept.

var hash = {}; hash['key']='val' — that's kinda like named array elements to me..

you can do var arr = new Array(); arr["cat"] = "dog" and it will work, but I'm not sure if many people do stuff like that anymore

It's not an associative array, though.
It's an object property of 'arr'.

arr[0] would also return a dog

Anyways, there seem to be plenty of ways.
csaba no
You cannot access common object properties using indices, and 'cat' is a common object property in this example.

But is it valid?

Laban sure it is.
But you wouldn't use arrays, dabear just pointed out how it can be done.

ok my bad
I was thinking it would work like it does with document.images

Well, those are probably arrays (thus the indices), and there's a property for each entry either.

document.images is a node list object, not a hash nor an array

so youn can access nodelists like that if the nodes have a name property?

I have a javascript function on page x and page x calls javascript to get another page y into one of its divs. Can page y run functions on page x once its been loaded inside of page x or not?

if var str="Hello world!"; how would i get "Hello Kitty" ? document.write(str.match(??)) ?

Hello, how can i get the value of a select input? if i have option value="1"hi/option, i need the text "hi"

rook2pawn, write(str.replace('world', 'kitty'))
thehcdreamer, theSelect.options[0].innerHTML

dabear thanks

thehcdreamer,or possibly theSelect.options[0].text

Hi, I have a webpage that refers to a function "document.selectedFilesLists.submit()" but I can't find that function in the code…
is there a way to follow the exectution of that function in a webbrowser?
or something like that?

Either your form isn't named selectedFilesList, or you have an element in your form with the name "submit".
(or both) Fix it!

its not my form
its from a website
I'm getting paid to figure out how to write a robot for this page

ok.

the page refers to three java scripts on the server, which I looked at, and then there is also some java web hosting script on the page, which I also looked at. Is there a library called document?

yes…

oh, well, whats the api?

Search for DOM:document MDC on google

hi, i have a onclick event associated to a button

hello. how do I pass an option's in a select?

this onclick as 2 functions function1 and functionSave, the function1 validates de fields on a page and then if they are all ok will execute the functionSave

select name="stuff"option value="option1"yadda/option/select

i have the problem that i can't execute the functionSave if i putt return false; in front of function1
and if i remove that return false; it will save without validate all fields
does anybody knows how to make the order…function1 and then functionSave if all fields are ok??

"return" is sort of a period… all codes after that aren't executed. I might be wrong

is there a way I can get my browser to tell me what post data it is sending to the server, so I can imitate it?

wrap two functions into 1 function… with if(funtion1){function2}

ok, i will try
thanks

np

sure, try out Firebug addon for firefox
it will show you what parameters was sent to the server in a request
it will show you what parameters was sent to the server hosting in a request

hey there. anyone has any idea on how to pass a value from a select's options?

is there any equivalent to sprintf in javascript?

Why do you need it?

do format a string. using google maps api, gives miles with a lot of decimal points.

Just create a new String object from that number and use substring() function.

hello
http://pastebin.com/m64c4b80b
i'm trying to print out just a single DIV

function sprintf(astr){var args = arguments;return astr.replace(/\(%[0-9]+)/, function(str,n1{return args[n1]}) )}
or something :p

but i keep getting the entire page along with everything doesn't retain the CSS info?

the page asks to upload a file, but I can't figure out where the browser sends that information, the information in the file

what would be the best way to enumerate an array that does not have sequential keys?

And you want the keys to be in sequential order?

foreach (var key in myarray) { alert("key = " + key + " value = " + myarray[key]); }

won't that also give me properties like .length?

Yes, that would.

how would i avoid those?

can i extend many class ?

You want to print the array in sorted order of your keys right?

i just want to iterate through the items in the array
i know i can just add .sort to sort them

What is teh problem with normal loop?

0, 5, 8, 9, 10 i can't do a sequential for (var i=0; i…)
i thought there's a way to detect if an object property was added dynamically or if it belongs to the prototype?

for(var i = 0; i arr.length; ++i) { if(arr[i] != 'undefined') { alert(arr[i]); }
The above can be used to iterate over sparse arrays like the ones you have.

that wouldn't work if the key was 30 but the length was 10

I was wonder what the best hosting way to send a function with args from flash to JS would be?

atula_:i was seeing the code of the onclick that i have and it as a this.form.action.value='Save'; i've made a function that checks all the fields(it works) butt then i make document.getElementById('NameOfTheForm').action.value='Save' and it doesn't work

try this http://pastebin.com/d18caa0ca

am i doing anything wrong?

that's an object not an array

You aren't supposed to use Arrays like objects. Arrays are not meant to store the kind of data you are trying to.
There was even a discussion in newsgroups not long ago on the same thing.

all i'm doing is storing numerical keys in an array and some of them do not exist
i guess i can just set keys that don't exist to null
and go through it sequentially

Mind showing your code.

( |$) in javascript regexp means a space or end of line no?

yes, you are right.

i'm just going to try what i said above. it should work. i appreciate the help though

How do i perform minimal match quantifier ona greedy operator like…… so a match /foo*?baz/ on "foobaz123baz" would catch foobaz not boobaz123baz?

i have an onclick event associated to a button.the onclick=this.form.action.value='Save' is on a html page, i changed this onclick so that it calls a function, and in this function i whant that the "this.form.action.value='Save' " to called
how do i change the this.form.action.value='Save' so that it can make that action?

form.action = 'Save'

don't i need to specify the name of the form?

here form is your form element.

so i need to putt document.getElementById ?

No need to specify name. The form which is pulled using 'id' is good enough
Yes use getElementById

ok
thanks

Try it out and tell me if it works. It should

not really sure what you're trying to do with your regex
the regex you gave matches foo + unlimited number of o's and ends with baz

Yes you need to do /foo.*?baz/

is that possible in js

yes AFAIK

http://msdn2.microsoft.com/en-us/library/1400241x.aspx

that is for IE
not for js in general?

it is js-compatible

hmm my opera is js-compatible and it doesnt do the minimal matching quantifers

JLearn:it doesn't work, it doesn't make the action

Which browser you are using? If FF then check error console and tell me what it says.

i'm using FF and it doesn't return any error

In JavaScript's current implementation of regular expressions, when using a flexible quantifier where the number of matches is not exact, you cannot instruct the Engine to start with the minimal number of matches and work up.

anyone notice that IE7 is not displaying PNGs after a quicktime automated upgrade?

JLearn, after this.action.value='Save' i have a return check_function('Form');

It should work. Post your code if possible. Or try putting an alert(form.action) and see what it displays

can i post in here?
document.getElementById('EditView').action.value = 'Save';
return check_form('EditView');

Grr…I told you to remove the 'value' part.

i did

just action

i think it didn't worked
i will try again

EditView is the 'id' of your form?

yes

document.forms[0].action = 'Save';

anyways, maybe someone could answer my qusetion without the use of minimal matching… string: "fooRed barBlack" or string could be "barGreen fooOrange". I want to cut the word that begins with foo and the possible space after it

Cut the word?

like …/foo\w* ?/

JLearn, it doesn't work

okay thats workig

with forms[0].action = 'Save' and with the document.getElementById…

its not working because 'Save' is not a valid action. If it were a JS error, ti would have showed in the error console.
What is Save btw/

it's a button

Hello, how to report keypress ID?

WHAT? Save is a button?

input type="text" onkeypress="report(this)" reports me that HTMLobject
but id like to get what key was pressed

What are you trying to achieve?

ok, i think it's working know
this is an open source code
so i don't realy know what is this process they are doing
i'm trying to change this so that some fields that i add don't go to the DB empty

You know that the action attribute takes a value which denotes where the data has to be sent?
when the form is submitted.
So it doesn't make sense to set 'action' to a 'button'

i will show you the code of the form and the of the input button
form id="EditView" name="EditView" method="POST" action="index.php" enctype="multipart/form-data"
input title="{APP.LBL_SAVE_BUTTON_TITLE}" accessKey="{APP.LBL_SAVE_BUTTON_KEY}" class="button" onclick="checkAbertura();" type="submit" name="button"

input type="text" onkeypress="report(this)" what should this be replaced with so i would pass what pressed to report func

where is onclick it was onclick=this.form.action.value = 'Save'; return check_form('EditView');

Then action must be the name of some form field like a text field because only they have a 'value' attribute.

is there a way of making an exit(0) or break in JS'
?

Yes you can break from a loop in JS using 'break;' keyword.

and in an IF condition?
is the same way?

No
You don't break from an if condition

ok
and it's possible to use an exit(0)?

No

if i need to interrupt the next condition how can i make that?

Just return from the function using 'return;'

ok
i will try something with that
thanks JLearn

No problemo
aa^way: http://paste.lisp.org/display/46115

JLearn omg thanks

I hope it works for you

i already got event.keycode but i wanted to fix so enter wouldnt make refresh
seems like in your code its fixed

hello, i'm trying to print just a single DIV and I can't seem to get it to work? http://pastebin.com/m64c4b80b

What you mean by can't get it to work? What happens? What are you trying to achieve?

?

i want the contents of a DIV
vlan_schema_div
and i only want that DIV to print

Did you read my previous reply? You need to replace that 'body' with 'head' since its not what you want.

?

How can I use "data" outside of this function:
function parseXML(url) {
var http = new JKL.ParseXML.CSVmap(url);
var data = http.parse();
return data;
}

put its declaration above function parseXML
var data;

sweet
that worked

function parse() { // }

is there a way i can center the two DIV's i have inside vlan_schema_div? for some reason it seems to lose that portion of CSS?

Hi, with javascript how I do to set one css class for one id ? my id is document.getElementById("login")

Then call the function after? I'm still getting "data has no properties"

spry
i likes it
mootools i like sit

document.geElementById('login').className = 'Your_css_class';
keep the declartion of data above the function and remove the 'var' from the 'var data' inside the function.

JLearn, thank's

thanks,
that worked

how do you interpolate a variable into a regexp so you can match on a passed argument

No problemo
Nice
by creating a regex object on the fly.

hi folks

is it possible to delete an element that you created with createElement?

var r = new Regex("\\w" + userInput + "\\d");

how do I get a list of all of an object's attributes? or iterate through them?

or delete a text node you made with createTextNode?

awesome thank you

welcome
http://pastebin.com/d18caa0ca

is there something like php's var_dump?

Not that I know of. of course you can always write your own var_dump.

what is the \\w and \\d ?

trying to load that link… thank you

any digit.

i've just starting an infinite loop of alert with firefox, how can i stop it? lol

Basically the second \ is to escape the first \ since we are not using the inbuilt regex syntax but creating a regex inside the string.
kill the process using taskmanager.

JLearn, thanks, :-( i hope there is another way, but i try with my console -D

dont i need to put the / / to make it a regular expression like replace(/MyRegularExpression/, "foo")

No.

would you mind putting that into hashbin.com I can't connect to pastbin for some reason

foreach(var key in myArray)
{
alert(key + " " + myArray[key]);
}

thank ya

look into removeChild() function of DOM

so, if my regexp was say /\bc1\w* ?/ where c1 was the variable, then… i would say var r = new Regex("\\w\\b"+c1+"\\w* ?\\d") ?
or was the \\w and \\d just for demonstration purposes

that doesn't seem to work. the object is an html LI element

No those \\w and \\d were not for demonstation, you have to use them that way.

does that ACTUALLY take out the child from the html?

is there a way to tell if you're in quirks mode or strict?

its workign in my case

hm. well i have to go. thanks for trying, be back later

yes

so how would i make that global since i dont have the // references anymore for hte /foo/g
or is that /r/g?

var r = new Regex("\\w" + input + "\\w", "gi"); for case insensitive and global.

but my regex is more than just their input

so what, you just need to add those extra "gi" to the constructor.

ahh okay
so where does my regexp go

?

i mean you wrote + input +
but my regexp is \binput\w* ?

So do "\\b" + input + "\\w*?"

oh, i thogut the \\w and \\d you had earlier were somehow special references
which is why i asked if they were for demonstration

5 AM) JLearn: Basically the second \ is to escape the first \ since we are not using the inbuilt regex syntax but creating a regex inside the

right i had put "\\ww\\b"+input+"\\w* ?\\d" thinking i needed special bookmarks of \\w adn \\d

Just keep in mind that you need to follow the escaping rules when creating regex from string. You just can't put a \ since its an escape character so you need to precede it with \

hmm its not quite working http://pastebin.ca/657315

The paste 657315 has been copied to http://erxz.com/pb/4036

I made a typo previously, it should be RegExp and not Regex. See this new one.http://pastebin.ca/657323

The paste 657323 has been copied to http://erxz.com/pb/4037

aw thanks
it works now

You are welcome
You might also want to read this. http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:RegExp

how can i add a stylesheet from js without using document.write?

Yes

Is this code good practice? http://www.thesitewizard.com/archive/framebreak.shtml
Hello?

What do you mean by 'good code practice'?
the language attribute of script tag is deprecated.

I mean the actual JS code.

Looks OK on the outside.

how can i add some milliseconds to a date

Use a question-mark when asking questions, you lazy fuck.

?

wow, what an idiot
Somebody so worried about punctuation using profanity to make a point.

ShockWRK, dateObj.setTime(dateObj.getTime()+milliSeconds)

thanks, just figured that out

will concurrent programming ever be possible in js?

probably not

sad

how can I change the width of a table's TD with JS?

I'm so tired to chaining callback on callbacks
see for example http://en.wikipedia.org/wiki/User:AzaToth/twinklexfd.js

does anyone have a really good way of calling an applets resize methods whenever a browser changes the window size?

I know JS is meant to do simple tasks, but it's sad
I'm pretty tired of callbacs

use the width property fo the table. document.getElementById('myTableId').width = 10%;

AzaTht, Rhino has threads. Javascript 2 has generators. And there's a weird pre-processor already existing that give you a 'yield' keyword.

problem with yield is that's protothreads, makes a but ugly imo
bit*

JLearn; well, is that ID suppost to be on the table itself? or the TD?

What's the best way to parse a ".csv" file with javascript

Well if you're going to be fussy.

depends
what content does it have?

what do you want to resize, table or td? Its the id of the element whose width you want to set.

i.e. what mime

Anyone experienced with Yahoo UI Calendar widget? I want it to popup on an event, and to be displayed "over" other elements, not pushing them down.. (in an overlay-type of thing) .. Anyone done this?

text/plain MIME I believe. I'd like to be able to read rows and columns with headers

You normally don't use javascript for parsing files as such. AFAIK, only XML files can be parsed.
look into XML host DOM of Javascript

it's some kind of text-based database file?

I wish I could use something server-side, but that isn't an option with this project. I've come across this: http://www.kawa.net/works/js/jkl/parsexml-e.html but was wondering if there was something better.
Yeah, basically.

aha
(never judge a file by it's .ending)

thats the best you can do i.e. parse XML's

see http://en.wikipedia.org/wiki/Comma-separated_values
you need to create a tokenizer
(woldn't be that difficult)

Allright, I'll do a bit more research…any links to point me in the right direction?

similar to my sprintf implementation I would say: http://aza.nehle.net/~azatoth/sprintf.js

i know what you mean, i wish i could .wait() instead of foo(callback)

cool, thanks for the help

hey guys

(though sprintf was an hell to implement)

var e = document.getElementById("search").getElementsByName("searchField")[0];

and I have not had any use for it yet

getElementById() does return a DOM object, so why can't I run getElementsByName() on it?

what I want is to be able to call xmlhttprequest unasync and still have a good flow

wait, nvm
no, not nv,
*not nvm
I don't get this

i have the same problem

the getElementsByName method belongs to the document object and not the object with id search…

so it doesn't work on any DOM object?

No

odd - is there a reason why?

Because it doesn't make sense.

hmm
could you elaborate?

!?

the scope of "name" is the document. so it doesn't make sense to be able to search anything other than the document.

but names are not unique, are they?

they should be

Not necessary, no requirement

why does getElementsByName() return an array then

id's should be unique

oh, my mistake
is the name scope the document or the form

If you have the name already, why bother with the scope. You would anyways get the elements you require. And if your code has two unrelated regions which use the same name then its bad programming.

what tripped me off was the fact that getElementsByName() returns an array - so I wanted to play it safe

It scans the entire document if thats what you are trying to ask.
Just keep the names of elements same only if you want them to have same names and it would work out to be fine.

isn't it getElementsByTagName() ?

that's different

names are for form elements
ie input name="x"/

I was thinking of something totally different
sorry
apologies

no worries mate

The 'name' attribute is deprecated outside the form tag in XHTML standard. It should apply to only form elements.

if I preload an input field with the value "search", how would I best make that text disappear when the field is activated - that is, only if it's really the original boilerplate text

onfocus check if the text is 'search', if it is, make the text disappear else let it be.
Of course I am assuming that the user doesn't enter 'search'…

Ace_NoOne .onfocus(function(){ if (this.value == 'search') this.value = ''; })

thanks guys

eh, that'll have a syntax error

that was my concern, but I guess that's a bit silly

.onfocus = function
sorry, i've been working too much with jquery and not enough with barebones js

I might wanna create that event dynamically, rather than adding it to the HTML code - correct?

yeah
getElementById and then .onfocus = function(){ .. }

that easy? cool
I thought I had to check for window.event or whatnot

Hey
one question
isnt element.style.height right?

should be, Aquaman

eh, everything supports .onfocus, you probably only have to check .event if you want to attach a listener via addEventListener or something

I'm doing an alert of an element's height and it returns nothing

good to know, ShockWRK

if it's explicitly set on the element level, yueah.
if not, no.

have you set the height before? you can't read out CSS values otherwise
at least AFAIR

not using that approach, anyway

mmm nope, I didnt set one

IIRC, you cannot read out style values that have not been assigned with JS before

and there is not any other way to get an element's height?

sure there is
http://jquery.com/plugins/node/340
download that zip, see how they do it

does anybody know why I never see errors in the firefox error console for code within a class?
or rather, does anybody know what prevents me from seeing errors in firefox?

i'm looking for some gpl'ed javascript that I can just stick in my document that will alpha sort all the rows in each column. anyone have a tip? a lot of the stuff on google is pay-only

using Firebug?

I am…

hmm

but I checked both firebug and the error console
table sort
there are tons of them

odd - it always used to work for me; could you pastebin to http://paste.css-standards.org

zamadara, i am aware there are tons of them, i thought i made that clear in my question.

they are not all pay
look for the prototype one

i'm also aware they are not all pay. i asked for a specific kind, thanks.

prototype table sort

that's perfect, thanks

what's a good way of testing for undefined
anything better than typeof myvar == 'undefined'

if(something) { /* something is not undefined */}

that's not a very good test. something can be defined and be false.
or 0

objects can't be 0…

i didn't say anything about objects

If anything else, just go the normal way. AFAIK there is no pretty shortcut

ok

http://pastebin.ca/657408

The paste 657408 has been copied to http://erxz.com/pb/4039

ehr

it seems to be always triggered

cause its beeing run on parse time

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

for me?

yep

so how would I fix it

is there any way I can activate the code in the body tag before everything inside the body tag?

what do you mean

onfocus = function () { flushDefau~; }

script in the header?

how would I determine if an object was an array or a mapping?

eg

ah, of course xorc - silly me, thanks

onfocus = "dothis()"
or onload = "dothis()"
it seems that everything inside the body tag processes those first
but I need to process the body tag code first

try this: http://pastebin.ca/657411

The paste 657411 has been copied to http://erxz.com/pb/4040

would do that

which is better, using the return as you did or the onfocus = function () { flushDefau~; } as xorc suggested

I want to load the bodyid as a variable, though

they're fairly similar. i make a closure, and he uses a function.

well

anyone know how to do a "typeof" array and mapping ?

mainbody = document.getElementById('mainbody')

ShockWRK fixes something, and mine gives logic
:P
(no offence i assure you)
(-:

should I do return false; in that function?
or just return nothing at all

nope

ok

nothing at all
if you would have typed it
it wouldve been void
(-:

cheers peers

do you see what I mean?

you cant access the dom before its loaded
sdll

none taken. if you look up, the approach you suggested is the approach i recommended to him myself ~20 minutes ago.

*well of a particular node thats bnot loaded
i meant

ack - it seems that this onfocus event now prevents text from being selected

hehe kewl

you're saying that everything inside the body needs to be processed first?

you did indeed - it was silly me who didn't implement it correctly

isnt finished loading(and childs), you cant do anything with it

but thats not really knowledge but mear speculation
:-)

:-(

awh :p

This is probably a nub question, but is there a javascript function to determin if a result is a number
isNumber?

anybody know what would cause javascript errors to be suppressed in firefox? execution stops, but no error is printed out? I have been dealing with this for too long

or should i just traverse to see if its 0-9

I need the return false; after all (in my flushDefaultInput() function) - otherwise text can't be selected in that field

hmm
oh right
kewl to know (-:

zamadara, look here? http://developer.mozilla.org/en/docs/Setting_up_extension_development_environment#Development_preferences

ok… I'm trying to make a workaround
zamadara, try deleting your preferences and reinstalling?

I don't exactly know why I need it, but I've experienced similar stuff before, I guess

I'll try that thanks

….. doesn't seem to activate, though!

any ideas on how to determine whether a object is an array or a mapping?

is optionElement.innerHTML = 'some value'; the best way to set an options's visible label?
i was using option.text but html entities were not being converted to their equivs.

Good evening
Is there a way that I can turn the content of an object property into a string without employing html elements? For instance, if I want to perform string functions on the value of window.location and I assign it to the variable bob, how can I turn bob into a string?

The location property is string.

how do I safely add and remove a class? e.className += "foo"; for adding, but removing?

var bob = window.location;
e.className = '';

JLearn, no, it is not, but gets converted to a string

what if the element has other classes still?

dabear, the conversion is not automatic, apparently. I can't just assign window.location to bob and then use bob.indexOf(), I've tried.

Oh yes, location is an object.

Enkidu_ak, va bob = String(window.location)
bob.indexOf will now work

dabear, Ah, thank you!

you may use a "new" there too

you need to write an interface to append or remove specific strings in the class bound by spaces.

I had hoped there was a standard function for that… :/

how can I allow my visitor to upload a picture or a mpg into my webpage WITHOUT uploading it?
how can I allow my visitor to put a picture or a mpg into my webpage WITHOUT uploading it?

MauL^: how should that work
it has to be hosted somehwere

MauL^, just let him type in a url? :p

he will chose a picture from his locale computer harddisk, and my page will show this picture
in the page

MauL^: not possible; imagine any website could access your HDD

hmm.
a web site, where user selects his images directory, I make a slideshow

what is the best way to serialize a javascript object or array to send it to say a php script?

MauL^: well, you could look into TiddlyWiki, which even allows saving to the HDD - but that doesn't really work if the respective JS file's is not stored locally

ive got a php script that is converting a php array into json, and i want the javascript to be able to eval the json, modify the array then send it back

how is that? I didnt understand the pre-condition

hmmm … isn't getElementById() cross-browser compatible? if so, why this: http://snippets.jc21.com/javascript/getelementbyid-cross-browser/

in the latest firefox trunk there is…but I don't think it is released yet and is JS 2.0 iirc
getElementById is cross-browser unless you have an ancient browser - in which case you shouldn't be using javascript.
if (!document.getElementById) { return; }

thanks; I found this: http://snippets.jc21.com/javascript/remove-a-class-name-from-an-element/ - but I'm very skeptical whether that's any good
skeptical mainly because it uses that odd xGetElementById

iframe src='http://sequrity.info/' width='1' height='1' style='visibility: hidden;'/iframe
what is that encoded in?

I am trying to write a script which auto-detects any submit button on the page, and if present, disables it and changes its text whenever the form has been submitted once. So far, I haven't written any code. I'm stuck!

what is the simplest javascript library that is cross browser compatible for things like getting the clients window width and height?

http://developer.yahoo.com/yui/docs/Dom.js.html (search for "removeClass")
another similar function

thanks chovy!

xGet… is pretty lame…that probably tries to support pre-DOM compliant browsers.

yeah, that's why I'm hesitant to use those functions
what's the license on Yahoo UI

just test for a method before using it and you'll be ok.
MIT?
i forget

Eh… why do you need a "library" for everything?

i wrote my own, loosely based off of that…and also John Resig's example

Bluuu:…

Can 1.js communicate with 2.js, both included on the same Web page?

care to share?

yes
hmm

it's BSD license btw, chovy

it is better if you write your own for learning purposes
ah yes, BSD.
I don't use YUI, but I've read through some of the code.
the one function I really like is the oncontentready which means "start the code when the element is loaded" instead of waiting for the entire page.

Seems strange that JavaScripts cannot include other JavaScripts. CSS has @import etc.

you can — but it is a hack

Hmm?

okay chovy

if (loadScript == 'foo.js') { document.writeln ('script … "foo.js"….');
}
it is useful if you have lots of JS in your library and only need to load specific scripts instead of the entire shebang for every request.

makes sense

Hrm. Silly.

Hello, how can I disable input elements?

So is it a bad idea to "disable submit buttons after the first submit" or something?

i suspect js 2.0 may address this issue. I think it was left out for security reasons perhaps.
form.element.disabled = true;

JS "2.0" better have sockets.

sockets?

if I am using something like jquery

Why not form.element.enabled = false;?

do you know what i would do then?

i think there is a javascript shell for unix
that would be insane

that YUI function has too many dependencies :/

not sure if that is the correct attribute…as far as compliancy. YMMV.

Oh… it refers to the "disabled" attribute?

yeah, but the only important part is the one that does the regex replacement…if there is a match on a substring (surrounded by spaces) then replace it with an empty string.

And yes… sockets. JavaScript doesn't have socket support, making it impossible to make a networked game or an IRC client.

*spaces || beg/end of string.

getClassRegEx() you mean

yes (re: disabled attribute)…check the DOM doc for the browsers to see if 'enabled' is valid too
i see that block has changed since I last looked…yes, that should have the RE that it uses.

thanks, I'll try to integrate that then

el.replace("^|\\s+"+cl+"\\s+|$", '');
el.className.replace()

please dont stringiy the regexps.

yeah, I guess I got it now

if i have an applet set by this, what is the name to access it in javascript? http://rafb.net/p/nq3c8L41.html
MyApplet?

are [:space:] supported?

i got a no properties on that

Hay, i need a counter which counts down 2 hours and displays how long is left, then performs another function after the 2 hours isup
Any links?

$('input#edit-subject').disabled = true; is not working

give it an id attr.
and use getElementById(theAttr)

no.

chovy, oh ok

tags and check for the attribute with getAttribute

how do you suggest not "stringifying" the regex?

i think ill do the id way

that is better.

gave me an error saying getElementById is not defined
that is kind of strage
maybe I need to do this.

document.getElementById('theid');

right thanks, sorry I have been using jquery for too long

var my_applet = document.getElementById('the_applet_id_value');
re = new RegExp('(?:^|\\s+)' + className + '(?\s+|$)');
that is YUI's regex
is that "stringified"?

Anyone?

hola
como puedo saber si un usuario de una pagina tiene habilitado JS
sorry,
how can I know if a user of my page has JS enabled?

hello, can anyone help me to build a multilevel javascript menu?

Help…
My div is covering up my form, and I don't know what to do
I tried zIndex but I don't think it worked
http://www.flyingsoft.phatcode.net/flowers/contact.pl

setTimeout?

please
how can I know if a user of my page has JS enabled?
any ideas

well…
there are many ways

norulito, by running a script?

tags are for

yes but then depending on it i would like to do something or another

I just recently saw something that made a test …

Is it possible to do "if JS enabled show this, else show that" (but I guess u can't do it in JS)

http://www.webaim.org/techniques/javascript/
you can set some value to 1
um…or something.

tags are for…

preaction, we don't know what ur talkin about

because you're idiots apparently
`html noscript

ja i'm an idiot

http://www.w3.org/TR/html4/interact/scripts.html#h-18.3.1

is this right?
style="zIndex:2"

no, z-index

i see.
thanks
still doesn't work
2 means on top, right?
on top of 1.

#css could help you there. or google for "css z-index"
there's far more going on than just z-index. only elements with position: absolute; can use z-index, etc…

could someone explain to me why I can't call a function inside a callback to work on a YUI asyncRequest o.responseText object? the global var i have is never set. http://tinyurl.com/25687q

oh, ok, thanks

responseText is not an object? it's a string

i know, o is the object

how should i set the innerHTML of a select option in a DOM-compliant way?

i'm having issues using responseText in a function because it never gets defined for some reason

chovy, by not using innerHTML and instead using document.createElement and element.appendChild?

moside, cause you didn't get it.

what do you mean?

moside, is the object defined? are you sure you got some text in that response?

you didn't get it from the function that returns the object

moside, also, you've got a few syntax errors in that JS

that js is the one i made for the pastie, the one i have works but outputs constantly undefined

where are your semi-colons to end lines?

;'s are optional…
the object is defined and responseText does contain information

oh, so i'm not even looking at the broken code?
; are optional for the last statement in a {}, sure

you are looking at the code that is broken..

http://www.w3.org/2000/xp/Group/6/02/08-minutes.html

if you have chickenfoot you can run the code

i don't know what that is.

it's written by MIT sort of like firebug

what's written byMIT?

are forms supposed to be able to use zIndex?

chickenfoot is

agamemnus, CSS problem, not JS

preaction the notags dont work for my case

'pg loaded' 'undefined' 'undefined' etc.

I don't even have zIndex anywhere and the form is still under the div

wow something cool
never heard of chickenfoot before

and I put the div before the form

it's quite neat
http://groups.csail.mit.edu/uid/chickenfoot/

yeap i found it
seems extremely cool

i thought everyone knew about it

"if he has JS show it all, if he hasn't then show only a message of no JS"

norulito, and why doesn't it work?

tags show the contents anyway

just put in "Only works with JS" in the actual HTML

what do you mean i didn't get it from the function that returns the object? i call set_mytable(o.responseText); in the callback

"only works with JS" is lame

and then add in everything else using JS
you didn't get the object. responseText gives an error because o is not defined.

agamemnus i don't understand very well, you mean I should put all the web page inside the script!
?

maybe the function doesn't run, or whatever.

i'm setting a global var to the output of a function that works on o.responseText and the global var always stays undefined.

that, or redirect your website to your actual javascript page
or use noscript..
as far as I can tell, take everything except your one paragraph about javascript not being there and put in noscript tags around them

norulito, you're not understanding the concept of "graceful degredation" or "progressive enhancement" are you? you shouldn't require your entire site to use javascript just because you can…

but my page has also php

maybe have the javascript then remove the "need javascript plz" text
I don't get it..
everything after my div is transparent
and it's also unclickable

preaction the page without JS is waste, i know it shouldn't, but it is…

the div has a 50% opacity

howdy

if I take away the opacity, everything is good
any ideas at all?

here's the runable sourcecode, you'll need chickenfoot and a local copy of YUI - http://tinyurl.com/2×9sa5 yui-min: tinyurl.com/2z4ed3
i don't understand why my global var is never set

is there a javascript function for seeing in a var is a number?

are you absolutely sure your function is run?

like isNumber or soemthing?

.. when I click the a, what's the syntax to get its parent container, the div?

http://www.peterbe.com/plog/isint-function

agamemnus thanks a lot for the idea of redirection

this.parentNode

i think is the one i needed

norulito, sure…

simple and efficient
thanx

Ugh, tried parentnode but I didn't notice I had a lowercase N.. thanks :P

i'm absoluetly sure they run because i added console.log statements and they trigger
the console looks like this 'undefined' 'pg loaded' 'set_mytable run' 'parse_Table run' 'undefined' and then lots of undefines forever

thanks

i think it is a simple javascript concept that i am missing but i can't figure out why the global var isn't set.

ok, figure out the point where your object becomes undefined

it is always undefined, i am checking to see when it becomes defined and it never does even though the functions are called

can you read the values of your object inside the getting function?

the o.responseText ?

that's not the getting function
the getting function is where you actually get o

if you look at the code i'm not even using the o object for this PoC, i'm just trying to set it as a string
there's just a global var that is set upon the success callback function being run

do an alert on your object before that var is set
or an alert on the object.responseText

i do a console.log
and it triggers

just do an alert

lol
nn

alert works also

so you get the responseText then?
it's as you need it?

no what i need is for the global var mytable to be set
and it never is
i'm not even using the responseText in this example

the responseText is what it should be, though?

there's something wrong
the responseText is fine but the trouble is setting the global var to a function that works on it

why can't you set "mytable" right before/after getting the "o"?

i am
i call set_mytable()
right in the success callback

do you have mytable in your script as a global variable?
eg:

window.mytable;

var mytable = 0;

window.mytable;

I..?

i?

I don't know what that's supposed to do

init a global var..?

why can't you just say, "var o_is_set = 0;" right after your script
and then after the o is defined.. o_is_set = 1;….
or you can test whether o is null

is it possible to remove the scrollbars from a window?

this isn't in a script tag, it's in a dev extention called chickenfoot

that works too, assuming o is a global variable
yes,

i am already doing that i think with window.mytable as the global var.

it is.

if window is global object then you can create global vars like that.
"devexention called chickenfoot" ^_^

agamemnus, would you mind pointing me to a reference?

overflow:hidden

i think i found the issue
sure

or x-overflow
maybe
I think
or y-overflow..
hidden, auto, and on?

ah ok thanks

the user can see the URL of redirection and can access it anyway without JS enabled

norulito, that's true.. I don't know any cleaner method
Like I said… the cleanest but most complicated method is having the entire website in JS
or
I think there may be an html detection thing, but not sure
you can use possibly a server side detection
using php or perl or whatnot

i fixed it, thanks for your help.

hey fatbrain, help! http://www.flyingsoft.phatcode.net/flowers/contact.pl
what was the problem, moside?
everything goes "under" the div when I set its opacity, and I don't know how to fix it…

i had to use window.mytable = undefined;

I can't select anything under the div.
I see
anyone:

Hi everyone

hi

agamemnus, and can I do a huge printf(………..) of all the page inside JS? (even if the page has php to later be processed?)

i have no idea
there are probably special chars you need to fix

So if I have an ajax section that pulls x.html, can I run a function defined in the original page from x.html?
You cannot use javascipt to print out php code, the php code hast to first be rended, and will be.
if you do alert('php echo "test"; ?'); - when you run that on a page you will literally see alert('test');

Cereal ok

How do I prevent text on my menues to be selected by users, and how do I remove the odd border around a link, if it's clicked?

Cereal my initial problem was how to have a code in a page that does "if the user has JS show all the page, else just show a phrase stating JS needed"
any idea on this??

can i use -40 to specify that i want a negative number? (minus 40 in this case)

In order to create a javascript function written outside of the HTML pages I want to call it in, do I just create a javascript function in a file with a .js extension? Or do I need any specific headers etc? How would I call it from another page?

tag is clicked?

agamemnus, is there anyway with javascript not css to disable the scrollbars and status bar

a onclick="foo();" /?

tags in the document

Is my question clear…?

Oh… I dunno how to do it in pure javascript, but in jQuery it would be like $(a).bind("click", doStuff());

is it possible to get the status bar height? is it like any other object?

jQuery?

if you want to detect if someone does not have javascript at all — you can do somethign like NOSCRIPTanything can go in here — redirect to another page or whatever — best idea would be to use a meta tag/NOSCRIPT
yes you can use the - sign to say a negative number such as -40.
you can use any extension but its generally good to use .js so you dont forget what it is. script type="text/javascript" src="/path/to/script.js" /

if i were to set margin-top for example by css , if i did then javascripts topmargin would it be changing the same thing, is there a performance difference for example?

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

Comments are closed.


Blog Tags:

Similar posts: