Ok this doesnt make any sense Anything wrong with this code onmousedown=return drag_onevent this function drag_onev

thanks

The first is an anonymous function, the second is an object

in my opinion, there is no difference between function & object in JS
because object is implemented by function

Eh?

I guess the 2 sentence have same effect
just guess, not sure

thanks so that is why I get the error message 'something?' is not a function when I use the newer library that uses somethingB format

is there a way to enforce proper floating point operations?, I use a document.write() to print the result of 4.2*3 but I get this: 12.600000000000001
what's with that 1*10^(-15) ?

not sure about in javascript, but in most languages floating points often have really small decimals at the end like that
floating points are just not super reliable
in most languages they say to use integers as much as humany possible and divide them by powers of 10 to turn them into floats if you really have to for some reason
or use rounding
lol

mmm

like to 42 * 30 instead in that example

kniolet, rounding would be sufficient if I use it in the future , suppose I use another high level language like C/C++, does it automatically does a defined decimal rounding?

in C/C++ you often have the trailing .000000000001 or such also

I see, gcc rounds the printf output to 12.600000

in javascript any number is represented as a 64bit floating point number

( 4.2*3 ).toFixed(2)

12.60

If you stringify a number, be specific about the stringification

jseval (function (){ 4.2*3; })();

Error: Error: missing formal parameter at line 0: (function (

:/
jseval (function (x){ 4.2*3; })();

Error: Error: missing ) after formal parameters at line 0: (function (x

(function (){ 4.2*3; })();

Error: Error: useless expression at line 0: (null)

(function (){ return 4.2*3; })();

12.600000000000001

(function (){ return 4.2*3; })().toFixed(2);

12.60

print "moo"

Error: Error: missing ; before statement at line 0: print "moo"

write "moo"

Error: Error: missing ; before statement at line 0: write "moo"

write "moo";

Error: Error: missing ; before statement at line 0: write "moo";

(function (n){ if(n==0) return 1; return (n * arguments.callee(n-1));})(5);

120

(function (n){ if(n==0) return 1; return (n * arguments.callee(n-1));})(3);

6

1*2*3

6

1*2*3*4*5

120

(function (n){ if(n==0) return 1; return (n * arguments.callee(n-1));})(12);

479001600

buubot++;

bored ? :P

hehe
that would require a y-combinator in most other languages :P

hiya all, I need to retrieve the height of an element (document.getElementById('foo').style.height) and the actual element doesn't have a height set - it's supposed to get its height from the amount of space its contents take up.
so, I need to get height from said element, what are alternate ways of doing so?

dav7, element.offsetHeight

oh
k
:P

`dom
`js domref
Anyone know of a good dom reference? .clientX is working fine in FF but not IE
Ok, this doesn't make any sense. Anything wrong with this code? onmousedown="return drag_on(event, this);" function drag_on(ev, el) { … drag_mousePos = [ev.clientX, ev.clientY]; … } ?
Works fine in Firefox, but not in IE, yet IE is supposed to support event and has supported clientX since v5
"clientX is null or not an object"

is there some way to return the class of an object?
so for the window object, to return Window

constructor ?

how would I do that?

object.constructor

window.constructor returns function()
altho, it looks like it works anyway…

function something else zaydana?
http://www.w3schools.com/jsref/jsref_constructor_array.asp take a look at the examples in the Try-It-Yourself section

I'm very new to javascript coding. Is it possible to tell this statement to append to what's already in place? document.getElementById('span_result').innerHTML = receiveReq.responseText;

jherrera - it works in firefox, but not ine IE. But I think thats to do with the fact i'm trying to change Window's prorotype. .constructor did work, thanks :-)

aagh, hey zaydana, does window.defaultStatus works in IE?

alert(window.defaultStatus) gives me a blank box
is that how i'd check? :-p

no
try this in body
script type="text/javascript"
window.defaultStatus="This is the default text in the status bar!!"
/script

works in IE, not FF

yep, I use Firefox/2.0.0.6, didn't work
does anyone know another way to change status bar besides window.defaultStatus ?
zaydana, I found how to do it in Firefox/2.0.0.6 if you're interested

found what? status bar?

change status bar text

ah right
how you do it?

http://groups.google.com/group/mozilla.support.firefox/msg/1e6f7285888c8b70

hmm, thats not *really* a solution :-p
but worth knowing anyway

it's not that FF doesn't support it, but the option is deactivated

yeah

however, I have one more problem though

link in status bar not the text I set in the function onmouseover

I doubt you'll be able to get around that
after all, the property is named defaultStatus
is there a plain "status" one?

kk, let me try it
nope
same result

ah well

well, there must be a way

I wish IE would let me touch Window.prototype :-(

I've seen this annoying websites that don't let you see where they are redirecting you when you hover like say an image, it just shows you another text

big, steep idea… but write your own window.prototype "HAL" layer for IE

oh god no :-p

lulz

its not that important

that's good then
:p

ah wait
OH YEAAAH, it works

what works?

forgot to refresh the website

~_~

but if I could change it, i'd be able to make a window.ondomload event which worked transparently with my events system

nice

looks like that aint happening though :-(

ehrm

:/
?

but I removed the href , so it doesn't matter

heh

dav7, I have this image that has an anchor, I want to set the text "MOUSE_HOVER" in status bar when the image is hovered

righty
right

dav7, so I have this function that is called when onmouseover event is triggered, well, it works if no href is set in the anchor
but what about if I have the href?

hm
a href="#" onmouseover="window.status = 'This message will display in the window status bar.'
oops
a href="#" onmouseover="window.status = 'This message will display in the window status bar.';" onmouseout="window.status = 'This message will display in the window status bar.';"link/a
^ jherrera
btw, just for the fun of telling you all, I implemented this drag-to-scroll system like Adobe Reader. the AJAX part isn't finished yet, just the UI, but take a look (and drag the test content):
http://dav7.net/ajaxreader/
xD

thats pretty nifty

dav7 nope, not working

0.o
zaydana:

http://pastebin.ca/653310 dav7

The paste 653310 has been copied to http://erxz.com/pb/3986
The paste 653310 has been copied to a href="http://erxz.com/pb/3986"http://erxz.com/pb/3986/a

hm
:P

looks good

I love how you can edit a file that doesn't exist
using Firebug
Woosta:

most browsers don't let you access the status bar by default anymore
You need to allow it specifically in the preferences
(Note too that FF3 will not have a status bar)

Woosta, yeah I did it, onmouseout works, I only have problems with onmouseover

If one works, but not the other, you have a fairly simple problem :-D

yep, Woosta, I've pasted my code, can you check it out for any error I'm missing?

Though it might be a more recent security fix
When you hover over a link, maybe they don't let you change it in order to stop phishing

mmm, yeah it's probable

AHh .. I see the problem

aha
I do too

You're linking to w3schools!

Woosta yeah, but what's the problem?

w3schools suck.

well. I definately like FF3's lack of a status bar, considering I don't use one myself in FF2

I'm guessing your browser knows that and is refusing to cooperate

hahahaha

html
head
/head
body
a href="#" onmouseover="window.status = 'This message will display in the window status bar.';"x/a
/body
/html
OOPS
GREAT

that's the reason it's gone .. it's a waste of real estate

_

Grrrrr

yep
sorrrry

NP .. accidents happen

I'm near the edge of coping with Windows' $*&%#*&^%#*&$%*�*%� clipboard… I'll be writing a program that clears it whenever anything goes into it if this keeps up
anyways

I use glipper/klipper

question. if FF3 isn't gonna have a status bar, what are all the status-bar-using-extensions going to do?
heh

the select text, then mid-click to paste is nice

yeah
I need a screen just dedicated to displaying my clipboard

See http://rick.measham.id.au/paste/status.test.htm — I'm guessing I was right

hah, back in my windows 98 days, I would do anything for having a screen just dedicated to display processes so to kill them and make the PC didn't freeze every x minutes

The second google link at the bottom shows how phishing can still happen :-D

Woosta href is showed, what about IE zaydana?

IE what?

ehrm 6/7
Woosta, which second google link?, I just see one

reload
IE is in a world of its own. I've no idea what it does

Firefox/2.0.0.6 show both google links in the status bar

But the second doesn't really go to google :-D

hahahaha, that sucks man

So the prohibition on status changes to ward of phishing is really rather pointless :-D

something weird happens though
if I press the backwards button, and hover on the second link, it shows me the real link
if I refresh, it shows me google again
so it actually shows me the real link, once I've been phised

yup
Coz what happens is when you click, JS changes the href
Then the new href is followed to yahoo
Click 'back' and the page hasn't reset. The href is still pointing to yahoo

does this channel have folks preparing for SCJP5?
anybody going for SCJP 5 ?

hey all whats the javascript command to say
alert('hi');
sleep(10seconds);
alert('10 seconds has passed');

alert('hi'); setTimeout(function(){ alert('10 seconds passed') }, 10 * 1000);
`dom ref setTimeout @ Fr0Gs
`dom ref window.setTimeout @ Fr0Gs
Bah, stupid bot

is there anything like instance.constructor that works in IE?

it works in IE too, for JS objects

not working for me?
at least, not on window, object, and other built in objects

DOM objects are not JS objects in IE

oh poo
that ruins my fun
so… does that mean theres no way to change them?

you can give them properties individually; they just don't have prototypes

ah right
well thats just fucked up my entire idea :-(

How can I "load" my base.tcl file from all my other tcl script files?
like, I want to do a "package require myPackage"

#tcl ?

ah
thought this was #tcl

it is, we just changed its name to #javascript to fool you

orly

test

if i'm using javascript to validate a form that is being included with include() ?, would that affect documents value in 'document.form.name.value' at all?

hello, it is allowed not to set maximal array length during array definition, like var arr = new Array(); ?

yes

Can array `key` be string, not number?

can anyone tell me why, if(document.formname.subofform.value == '') { } wouldnt return true when form is named, 'formname', & a member of it is 'subofform'?

Can i dynamically add array elements like in PHP - $arr[] = 'new element';

i thought maybe because the form it is being tested against is included & thatd affect the value of document.?

utopia_, try id="myfield" and document.getElementById('myfield');

cool thanks
ill try that

document.getElementById('myfield').value *

you can add elements to an array with push()

JanisB, is 'document' an array that takes on values if a file is included using php host so i could narrow down the prob ?
or is it treated just as one document?

`document` is an object
that contains a lot of trash, like all forms, they field values/names e.t.c…

ahh, day 1 learning JS
i guess ive alot of reading to do cas this isnt near working

which keycode is the enter key? 10?

ok got it, it's 13

google rox, yea

if I have a color, for example #FDAABF then can I get the opposite color by xoring this value?
bif I have a color, for example #FDAABF then can I get the opposite color by xoring this value?/b

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

Comments are closed.


Blog Tags:

Similar posts: