im stumped I do not understand why when x becomes -1 the loop doesnt just break on its own – isnt x = -1 supposed

morning everyone

Sembiance, a splendid afternoon

good day

it’s coming down in buckets here. rain rain rain. several roads closed (Which isn’t unusual here rofl)

hot and sunny here

same here
must be europa
=]

fuck you, firefox.

why the hate for firefox?

it keeps trying to fill in these forms for me
which is intensely annoying at this point
for this webapp at least
any way to make it stop that ?

options-privacy-remember what I eneter in forms and the search bar ?

cunning.

hi guys
Is there some superduper function to set the text in a element, for instance divs and spans and h1..n ?
elem.textArea, isn’t crossbrowser compatible I’m told.

create a text node and add it

… retract the div element… create node div…

how exactly?
Isn’t there an easier way to do this?

I don’t really see how that is difficult, if you need to do it more than once just write a function that does it

document.getElementById(‘div_id’).innerHTML = “Yuor new text”; Yuo need this?

hello

“Jak08″ at 71.6.194.243 pasted “Date system” (1 line) at http://erxz.com/pb/3949

I was wondering how I could get the first part of that bold
while leaving the rest of it in normal text

omfg
what is it with ie
http://reviewerportal.com/digital_cameras/?p=1
why wont the dropdown menu on the left work in ie?
works fine in firefox

Fraz, still not work? )

no
i rewrote the menu in a seperate file
which worked fine
then transferred the code over
and still wont work
nothing in the left sidebar is clickable in explorer
i think the javascript is working now, but cant click anything
trying to validate my html, but the html validator over at w3c isnt working

to a JS function, so it calls a function when the link is clicked on?

var a= document.getElementsByTagName(‘a’). for(var i=0;ia.length;i++) a.onclick= function(){} )

no you don’t… you LOVE php

)
it work so strange…

how do i check if a property of an element is a getter or setter?

see source code)

Min2liz, thanks. Yes I need that.
I found out that there are at least 3 non-w3 approved in-dom attributes for changing the text in a text node
..innerHTML, .textContent and .text
not sure any of them works though.

nodeValue ?

okay, four.
not sure though.

krrronos, I presume that line was directed at me, but thats confused me more. How would I make it bind to one link?
Just all the a href=’bla.html’’s in the page

i have an error
a[i].onclick= function(){}
thats right

hi
how can i alter the content of a div using DOM?

krrronos, I’ve got http://pastebin.com/d20e9dc38 and when I click on a link, it won’t do the alert?

SamuraiDio, innerHTML?

a[i].onclick = testit; no ()

a[i].onclick=function(){testit()}

same goes for the onload

When making a get request of a page with AJAX, what is charset set to?

Thank you
another quick question, whats the statement to stop it following the link?

onclick=”return false”

unless you are trying to combine both questions

[Liquidor], utf-8 ?

but (
Aww man I’ll never get this to work. Been struggling with this all day.
What do you see and with what browser as the first word on this page? http://reputation.mygamesonline.org/armory.php?n=Shízzy&r=xavius&ra=Human&f=9&s=Honored&v=3947&mv=12000&cache=8

Shízzy IE7

Shízzy FF

~paster
~paste
~bin

Okay so far so good. However when I request this page with AJAX I get Sh?zzy with FF and Sh?y with IE :-/

how do i as for a pastebin?
!paste

Does anyone know the reason why and what to do to solve this matter?

how can you make javascript hosting wait mid function for say 10 secs?
setTimeout doesnt seem to work

“SamuraiDio” at 71.6.194.243 pasted “window.parent.document.getElem” (16 lines) at http://erxz.com/pb/3950

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

this snippet waits 1 second then executes 10 functions calls one after the other with no break? instead of 1 every second
for (var x = 1; x = 10; x++)
{
window.setTimeout(“sendInput()”,1000);

}

that’s wrong code

how come?

you create 10 threads and they all wait for 1 sec, then they all execute
what you want to do is create a thread, wait, create a thread, wait, etc.

how can i do that?
without repitition

0) setTimeout(“myfun(” + (x-1) + “)”, 1000); } start with myfun(10);

thanks

np

can some1 help me?
cannot i break strings passed on function parameters?

You want to do something with an interval of n seconds?

yeah

Why not use setInterval ?

cool never heard of it

can i break strings added to variables or function parameters?

SamuraiDio substring method maybe ?
or split method

StaZ_work, no, the problem is that my string is too large, is an html host content, and i dot want to add it all on one line

SamuraiDio substring method maybe ?

var foo = ‘asdasdasdasdasd’; foo +=’asdasdasd’

oh you create a string

ahh
tnx

If a[i].onclick=testit;, how can I let testit() know what the a.href is?

i thought you wanted to break it to output it in pieces

giggsey, this.href ?

a[i].onclick=function(this){testit(this)}

i dont think u need to pass ‘this’

yeah, you don’t

a[i].onclick = function () {alert(this.href)}

what if I am trying to confuse people?

Khisanth you will be lynched
http://icanhascheezburger.files.wordpress.com/2007/01/1159434782588.jpg

there are many others in front of me in the queue for that!

hmm
Now return false; in testit() won’t work

a[i].onclick=function(this){return testit(this)}
the false can’t returned without the return keyword

a[i].onclick = function () {alert(this.href)}

Okay, thanks
Now (sorry), is there a way to just get the last bit of the link? Just the filename?

astring.split(‘/’)

Thanks pr0nbear

hi all. i need a js which resize an input field or a textarea… any idea?
?

can you specifiy the port in a relative url?

why this not work?
newContent += ’scriptsetTimeout (“ajaxRedirect(webroot + \’noticias\’)”, 5000);/script’;
unterminated string literal

garethfn, nope, you need a full url

it could be on the line before

kta

some clue?

SamuraiDio i jsut gave you one

hi,

hailz

StaZ_work, what did you mean

i want to read a selected text from textarea using js, how can i do that.. im trying like this document.getElementById(‘writetext’).selected

SammyWG if the line before is not terminated, the console could think the unending string is on this line, check the code your on, 5 lines before to 5 lines after, try deleting or spacign a line and see what happens to the error line number

StaZ_work, even if i place all on the same line,i get the same error

* shrugs *. try deleting parts of the string and readding it parts by parts until you get the error then you’ll know exactly which part is erroneous (debugging trick)

StaZ_work, tnx, ill finish later…

Hi all!
I need some kind of onload event on an individual HTML element
I can’t address the element directly and do something like initialize(document.getElementById(“foo”)) because the ID “foo” may not be unique on the HTML page
and I also can’t give each element a unique ID (because this CMS is crap)
so, how can I identify an element as well?
I’d really like to have some “in-place” event handler

section, where “this” is set to the Window object

node in HTML either (and go on from there), or is this possible somehow?

Twey, give me a ping when you are awake
Twey, I owe you rum I assume = )

is it possible to completely replace the document element?

I can has doubts ?

Hi, i’m trying to load some pages into iframes..but it contains some js code that “breaks” it out of the iframe. is there a way around this?

0) { parent.location.href = self.document.location }/script

e.g mail.yahoo.com contains some code similar to this
Anyone got a clue?
anyone here?

hey

hi squi – u see my q?

what could be a way of an element accepting input without adding any onclick- etc input to it?
i just walked in

heh ok

without any event added to it*
therer is not a lot going on here, is there?

try element.focus() in an initializer

no
tommyd:u got one for me too?

tommyd what would that do other than giving the element the focus?
realnamexyz state your question again, i didnt see it

for input elements this sets the cursor in the item
maybe I misunderstood your question
imho “accepting input” is something which basically form elements can do

Eg I have a “div” and it somehow reacts to events but it has no event-trigger added to it, how is that possible?

tommyd:i’m trying to load some pages into iframe, that contains code that breaks it out of the iframe- how can i avoid this behaviour and force it to stay in iframe ?

it for example reacts to clicks
realnamexyz do not use an absolute position and it can’t leave its parent

how should an element react on events with no event handlers defined?

tommyd thats the question… i used firebug on it, but it only has styles set, nothing else

you could add the event handler to the document element and act accordingly (i.e. delegate) the work on the specific item

it still reacts to mouse-clicks though
tommyd wouldnt firebug show it anyway?

well, I don’t know firebug enough to answer this question
you could certainly do something like document.addEventListener(“onmousemove”, function(ev) { myElem.style.x = ev.x; myElem.style.y = ev.y });
bah, skip “style.”, you know the rest

oh i see
no that would probably not be shown

I don’t think code like this is “recognized” by Firebug

yop

here is an example of what i’m trying to do http://pastebin.ca/649977

The paste 649977 has been copied to http://erxz.com/pb/3951

how do I match “../” 0 or more times with a javascript regexp?

tommyd:as you can see, the windows doesn’t stay inside the iframes..

this is merely a CSS issue than a JS issue, please ask in the appropriate channel
/(\.\.\/)*/ ?

thx

0) { parent.location.href = self.document.location }/script

how can i disable this behaviour?

at first, its not self.document.location, but self.location
and moreover self.location.href, not self.location alone
(location is the object, href the string pointing to the URL)

well, it works..
(this code is not from yahoo – but they use similar stuff)

please try to ask sb else… I’m about to go. Sorry

tommyd:np

Does anyone know how I could determine the width and height of a element without a style.width or style.height property?
I’ve got a findY and findX function, but I need to create a invisible box and know when the mouse is in the invisible box, so I need to know the height and width

can a javascript function just return and not return a variable/object?

“vBm” at 71.6.194.243 pasted “Any way to do this a bit bette” (10 lines) at http://erxz.com/pb/3952

? :]

yes.. just method () { return; }

Hi
I’ve got two divs that are next to each other and touching – I’d like to be able to drag the divider between them and make one smaller and one bigger
Like a paned interface in itunes, for example

I believe I have seen similar effects in scriptaculous or maybe openrico.

does anyone here know how to detect what text the user is highlighting in javascript ? ive created a custom blogging interface for my website and some custom markup to go with it
the backend works great, but when a user clicks on the h1 button, i would like “h1. ” to be prepended to the words they have highlighted
ive search all over and cannot find this answer anywhere, so if someone could offer some sort of pointer thatd be great :P
or if it is even possible at all

I’d suggest looking at the source of other wysiwyg editors

invinceable, http://www.quirksmode.org/dom/range_intro.html

What should I search for?

Is it possible to call a javascript function without there being an event to call it with?

oh, http://wiki.script.aculo.us/scriptaculous/show/Draggable looks helpful
what?
myFunction(); calls the function

and not when i have load() placed elsewhere

script type=”text/javascript”load();/script
would call load()

yeah, i did that

what’s in load()?
and where did you place that?

after the function

probably best just to paste code

ok.. and what does load() do?

http://erxz.com/pb/javascript

do you have firebug?

firebug? no

put console.log(‘I was called?’); at the beggining of the load method.
oh.. nvm then
yah.. give us a url
or paste into pastebin

https://addons.mozilla.org/firefox/addon/1843 is firebug

got it working
really weird, o well thanks

yeah but now im curious
:P

I do suggest installing that addon
very handy for debugging javascript

oh, nice
i use IE to debug it lmao

good luck with that

hehe

IE has the most retarded error reporting ever
lol

yeah, its awful

the closest you can get to decent reporting is with MS Script Debugger
but even then.. it tells you nothing.. just highlights the line that errored.

the newest safari stuff is good, too

yah 3 safari

it’s like alpha though

I am actually getting to the point that I spend more time “surfing” with safari than any other browser.

for sure

mostly because I am still getting memory leaks with firefox and well.. IE is IE. lol

does the new safari support labels?

it’s 2x faster than ff for me

the old didnty

tha’s another thing.. I have noticed that it
’s the fastest renderer

what do you mean
?

label

it always has supported labels..

/spaninput //label
no it does not

if you mean in terms of .. you click the label.. probably not.

(-:

that is not a feature of HTML.
that is a feature of the browser

i even wrote a script which fixes the issue for ie/safari
:p
as i *wub* labels

but interestingly enough.. I think I know what the problem is.

http://www.miraclesalad.com/webtools/safari_fix_label_jquery.html

in my honest opinion.. even though some sites might tell you to label that way.. or that it even doesnt error.. I find it unreliable

what is the maximum cookie value string length ?

input type=”text” id=”someInput” name=”someInput” /

I think the lack of for in your labels could be the issue

hmm

yip
that is your problem
cuz my labels work fine in safari

http://www.xs4all.nl/~xorc/labeler.js – my implementation

unfortunately, an unecessary one
as the problem is the lack of for in the label

why
supports either way

firebug is pretty laggy -_-

http://www.xs4all.nl/~xorc/labels.html

well, I dont know.. but I would think it’s always better to avoid javascript if it’s not needed.
and if you want your input field to be focused when a label is clicked
then it just requires an id and the label to have a for attribute to that id

thank you, that looks exactly like what i need!

but its needed, as label is not supported and has huge usablity features

i am as well, im looking at the source of DRUPAL atm

shrug.. I have NEVER had a problem with label and usability. hehe
well.. whatever tickles your fancy

yeah but writingb a little code for each label (and every input as a label) its more efficient to do it with a script
hehe

in fact, in terms of Accessability.. the for attribute is required for screen readers

well, labels are very nice imho

brb.

wow… im having a problem in Firefox, i have the same javascript on one page, with same fields and it works on a different page but not this one

is there any way to find out the structure (methods/properties META information) of the javascript based object ?

anyone out there do work with radio buttons and their groups? I have some javascript that looks like: radioElem.checked = true; but for some reason in IE its not setting up that button as selected…. any ideas on what I may be doing wrong?

Awake

Yeppers ;P
late night last night, and here early

Heh, not exactly early here
I slept from about 0600-1700

I’m in arizona, us

England here

I have a question, the (function() {})(); stuff

A function expression that executes immediately

Seems like some kind of trickery, I get why you did var DnD = (x)

Lets you create another scope

StaZ|Work, hi

Because JS blocks don’t alter scope

Twey, I see, I got the execution bit, but you use it for properties too
Twey, why on the properties?

tag

Twey, I don’t understand the javascript hosting “object” model so well
(function() { })()

Where I’ve used it on properties I’ve created it so I can add some extra properties to the property before returning it to be added to the parent object

function() {here}

Because I added properties to that function
I could have done it outside the object, but this way is neater.
Sorry, BRB, should’ve used screen
OK

Twey, I see what’s going on

works

how new DnD.DragElement(ele) calls to s = function(el) instead of the paren function
how does it know too?

Closures
`js closures @ cstockton

is there a way to know all the function list of a javascript object?

`closures @ cstockton

closures: http://jibbering.com/faq/faq_notes/closures.html or http://blog.morrisjohns.com/javascript_closures_for_dummies

The function has access to the reference to itself

Twey, I’ll take a look

is this proper usage of new option? new Option(“Afro”, “Afro”, defaultSelected, selected); trying to get that option to be selected when its loaded
?
can someone please tell me why, http://pastebin.com/d4987d5b2 the SELECTED one isnt being selected?
got it working, except its selecting the one before… lol

try setting the .value :P

without looking at your code, you know that arrays are zero based, right?
the first element in an array is [0

yeah

]

but im doing new Option(text, value, true, true);
so it should select that option, right?

you must be using some library
I don’t know that function/syntax
sorry

?
That’s not a library

anyone very familiar with prototype library?

#prototype is

http://pastebin.com/d5964780d is my actual code

I was talking to Bear10

yeah, but new option isnt a part of a library

oh, interesting
apparently you know more than me about this
sorry

hmm, found a bug, when i actually change the option from what it should be to something else and back then it selects correct one, but if i run that option onload it picks the one before :|

Personally I wouldn’t use new Option() though

what would you recommend?

Just use document.createElement() and set the attributes yourself

I love your nick Bear10

likewise
not familiar with createElement :|

`domref @ Bear10
`js domref @ Bear10

js domref: w3.org/DOM/ , http://developer.mozilla.org/en/docs/DOM , www.mozilla.org/docs/dom/domref/ , www.zvon.org/xxl/DOM2reference/Output/index.html , www.krook.org/jsdom/ , http://phrogz.net/objJob/languages.asp

Damn inconsistencies

haha, funny thing is the script works in Firefox and not in IE now i hate JS

is there any alternatives to innerHTML that do not require DOM creation/manipulation?

No?

damm it.

What’s wrong with just using the DOM methods?

cuz it’s super slow?
and ugly to write
heh

innerHTML’s a heck of a lot uglier

it’s one line
how is it uglier?
or assigned to a variable.

And the DOM methods aren’t much slower

then passed to innerHTML

Yes, but the DOM is not a string

nope

The most common example of this problem is XHTML

it’s an object. but I have the string.. so I have to convert the string to the dom object

If you were to write a script using innerHTML for an html hosting document

which is going to be ugly no?
like a 500 line table..

Then move that script to a document that uses a different markup language, e.g. XHTML
You’d have to rewrite the script
It kills portability

I have no control over the output

Of course, innerHTML doesn’t work in XHTML anyway, but that was an example.

the html string I have is what I have to deal with.. period.
unfortunately

seems a bit strange, no HTML parser written in JS?

new DOMParser()
http://developer.mozilla.org/en/docs/DOMParser

Just as proprietary as innerHTML

yep
non-standard*

so is there any good reason why no one has written one?

i try to remember about something:

considering the amount of JS libs that more of less do the same thing

is there any isOpera() sniffer included in browser
or should i use useragent ?

gebura, function isOpera(){return !!window.opera}

loving u
thanks

not sure if the !! is needed tho :p

ok thanks, i ll try

prototype uses it, atleast

do you know what is the double “!” ?
i don’t know this kind of synthax

it turns the object twice
from object to false to true
or to false if not opera

i guess you can’t use text/html with DOMParser()

arg!!
this code make opera segfault !!!!

Hahaha

if (window.opera)
{
alert(‘ee’)
}
else {
alert(‘ee’);

Nice

}
dabear, !! seems needed

“vbgunz” at 71.6.194.243 pasted “brain fatigue? simple 3 line loop, endless gotcha?” (8 lines) at http://erxz.com/pb/3953

can someone check what is supposed to be simple and tell me why it does not end?
am trying to get the index of “i”… please no other solution, just what is wrong would be great
is it because I am modifying x in the body?
it’s a very short problem, hope someone better than I can answer my stupid paradox

try ++x instead of x++, vbgunz

That will make no difference
indexOf(“i”, x + 1)
“billie”.indexOf(“i”, 0) == 1
“billie”.indexOf(“i”, 1) == 1

im stumped. I do not understand why when x becomes -1 the loop doesn’t just break on its own :/ isn’t (x != -1) supposed to say, while x is not equal to -1, loop, otherwise break? this is my first gotcha :/ is x++ ruining it somehow, is that ran first before the check or something?
I can do this easily with while true, if break but am frigging stumped when in my eyes this should work just as well…
hmm… I solved it *but* not how I wanted. it appears I cannot use the var x and modify it… it fails

can you do something like document.getElementById(‘foo’).getElementsByTag(‘input’) to get all the input tags that are the children of ‘foo’?
Or do I have to iterate through children
checking each one to see if it is an input

js ref
`js ref

http://developer.mozilla.org/en/docs/JavaScript , http://devedge-temp.mozilla.org/central/javascript/index_en.html , http://phrogz.net/ObjJob/ , JScript@MSDN: http://tinyurl.com/9pk3l , www.crockford.com/javascript/

Thanks

leip, look at cross-browser.com/x
http://cross-browser.com/x/lib/view.php?s=xGetElementsByTagName
xGetElementByTagName(“a”,xGetElemenById(“one_element_id”));
that ’s what you are looking for ?

Seems it. Thank you!
Interesting library…

whats the difference between ++x and x++ ? I seemed to have solved a problem with ++x Vs x++ … is ++x deferred or something?

++x increments before, x++ after

x=0; ++x /* 1 */; y=0 ; y++ /* 0 */; y /* 1 */;

var x = 0; print(++x); x = 0; print(x++);

101

can a class prototype be modified within the class declaration itself?

var x = 0; print(++x); print(” – “); x = 0; print(x++); undefined

1 – 0undefined

There are no classes in JS
And, yes.

Twey, I mean like function name(){ this.prototype}

That’s a constructor function

print(“foo”);

foo1

And it’d be name.prototype or this.constructor.prototype

void print(“foo”);

fooundefined

gah

thats nice. ahh, dabear really helped me out with that. I haven’t gotten to ++x yet but it’s very cool in a loop, sweet
thank you!

Twey, there doesn’t need to be an instance of the class already to access the prototype members?

where are you getting classes from?

deltab, a constructor is basically a class yes?

no
a class is a structure built around a constructor and more

Of course not, the prototype is a property of the constructor itself, not an instance of it

would the constructor have access to the prototype property if its assigned outside of the constructor?

so if i wanted to make a GET request using javascript, and taking the output from a few text boxes, how would i do that ?

The code within the constructor is run when the constructor is called, so if the prototype’s already been assigned by that time, then yes.

so this should work assuming printToScreen is defined? function name(){ printToScreen(variable);} name.prototype = { variable : 0}

varek http://gebura.lescigales.org/x/xFenster_Work/files/gmw.js
see gmwConcatInputsValues(form)

err this.variable

or gmwSendForm(form)

Yes

i don’t think you can use this function directly but it may give you somes ideas

Twey, thanks a lot :-)

Welcome

hmm.

gmwSendForm(f) seems to is what you are looking for
to be
is you want do something simplier just do

i’ll do my own implementation

a href=”#” onclick=”document.location=’file.php?foo=’+getElementById(bar)”

is there an open source applet for resizing an image graphically out there?

“applet” ??
you aren’t is the good channel
javascript!= java

tag can i just use ‘document.body.onload = function(){}

tag?

oh
then i mean

DoctorNick,

can javascript do it?

window.onload() = function () { your code }
SAberu|, i think, scriptaculous (a heavy library must do it)
http://cross-browser.com/x/lib/view.php?s=xAnimation.imgSize can also

ok thanks gebura

Just onload = function() {}; is fine.

using onload without any parent objet isn’t very recommended i think
it the same for alert()
witch (window){ onload= function () { } } may be a way

Ok, i’ll try that.

gebura i’m looking at the script on the cross browser page
i’m a newbie to javascript, not sure which part of the script sources the image
var i = this
i assume it’s that part? :s

it seems
i don’t have try this script so i couldn’t help you a lot

..
………………………..
…………………………….. how do I rotate an image hosting (not a canvas) in photoshop?

don’t try to copy it, just include it on your script.js file (witch dependency)

then i just feed the width and height vars into a button which submits to my php script then use those values to resize the image

an example of usage is on http://cross-browser.com/x/examples/xanimation.php

aga free transform

sory my english is poor, i don’t undertsand you what youd want to do
you can try to post on cross-browser.com forum

thanks

i want a script which displays the image to the browser then allows you to resize it on thr screen
by dragging the image

is X (javascript library) worth implementing?

arf
it s more complicated that i was thinking

Anyone have experience with it?

ok

you may have to write piece of code
or try to use scriptaculous
witch may be more complet and more simply to use

i also need a script which allows you to select a vertical strip of the picture which u can drag/scroll across the picture dynamically in order to select

leip, it is a great library
i use it for many development
eyeos use it for example
it depend of what do you want to do

hi, I have a quick JS question for ya…
is there anyway to terminate script execution before it gets to the end?
for instance, if I have an error and I want it to stop
I tried “return” and “break” and they both cause errors because they’re not inside a function/loop

it is not as simply to use as prototype, since you have to develop you own wrapper (for example) to use it
see http://gebura.lescigales.org/x/xFenster_Work/files/gmw.js for examples of usages

Thank you

what do you want to do with ?
if you want ome help with , i am your man
some

were you talking to me just now?

no, to leip, sorry

oh

does anyone know how you can pass a function call with arguments as an argument of another function? or is it not possible?
like something(something2(stuff),500);
without something2 being executed

Hor|zon, function foo (a , func) { func(a) }

I would think that you could create an anonymous function that has that as the body

ooh

something(function() { something2(stuff); }, 500);

Hor|zon, you call it with foo (a , alert ) or , foo (a , function (param) { alert(param) }

makes sense, cool I’ll try them
thanks guys

if you want more complex example most of httprequest wrappers have a callback function
np
Hor|zon, http://gebura.lescigales.org/x/xFenster_Work/files/gmw.js contain also some examples
function gmwDoForAllBox(funct)
for example of implementation
used in gmwReloadAllBox() for example of usage

hmm
I see
cool
and at work they said it couldn’t be done…I was about to redo it
thanks a lot

is there anything in javascript that functions like exit() or die() from other languages?

rmeador, you can use throw

that will throw an exception which will cause an error
I can’t have unhandled exceptions… I’m doing serverside javascript

outch

yeah

i don’t know how to play with
you must define ‘foo’ “) stop the script

I just want to be able to stop script execution on an error without it breaking
I would have expected “return” to work, but it crashes

you may see at your javascript implementation
if it is server side it must have a way to stop
but witch ?

I have no idea

see the doc
of your javascript implementation

knowing the engineering team around here, it’s probably internet explorer being opened on a per-request basis
we don’t have docs for anything
we’re not allowed to see documentation or code for the server

but what ’s implementation name ?

I don’t know

haha, i undertstand that i must be difficul to code with !

but I do know some things, like generating a PDF, are done by creating an instance of IE on the server hosting and forcing it to “print” to the PDF writer andn then serving the resulting file
this company I work for is a prime candidate for thedailywtf.com
ok, but you’ve told me it’s not part of JS… which is also what google told me
so now I have to go bother the engineers here and they’ll tell me it’s not possible…
thank you for your hlep
*help

if it work with embeded ie
it may be jscript
but i don’t know if there is a server side implementation of it
it may but i am not sur

I’ll try to figure it out…
thanks

http://en.wikipedia.org/wiki/Server-side_JavaScript

I’ll look at that
bye

does anyone have suggestions for this?
http://www.flyingsoft.phatcode.net/flowers/helenasflowerabode.png

aga|afk yeah, delete it

hm? just wrong tab completition?

can someone make me a script?

chrisb17, not freely i think
help you to make a script, we can

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

write you own…

its basic and i am broke lol, take u 5mins at the max lol

what does this bot said ?????

bot said nothing

Available Plugins: oeis [...] ???

staz….
that’s pretty mean :-|

SammyWG he asked for a suggestion showing an image not saying suggestion about what
and anything with the word “phat” in it deserve to die. /rant

on its look and feel
I don’t have “phat” in my text…

and fine , can u tell me what i need to lean to have 3 text boxes when they reach the max chr limmit it moves to the next box till it reaches all 3

it’s the link :-|
chrisb17, you need to learn* javascript, of course…

what parts

body onload=”document.getElementById(‘loginbox’).focus();”

aga|afk well i think it’s a little “cheap”, maybe could look better on a non white background, the colors doesn’t match very well, i’d go for the same color, different tone, and maybe 1 big leaf behind the name instead of 2 on the sides. that’s my suggestion and personnal opinion

your problem is not fully defined

buu, can you tell m why you bot tell me a list of available plugins ? i don’t undrstand well

but not in the body tag (it isn’t easy to get to… standard template)

of course it won’t be on a white background, it’ll be on a flower background..
so, let’s say that you want to move the cursor whenever the user changes the characters

active text box not the mouse

I wana know the js that would make the mouse move

check for key presses in the current character box
you can’t

especially the one that will make it hit the user in the side of the head.

then check the amount of non-whitespace characters in current textbox

my real question, not the mouse nonsense, right?

aga|afk, js can not pilot mouse ?

is there a javascript for idiots tutorial?

if it’s bigger than what you need, go to the next one, if it’s smaller
yes, there is
no
?
do you want to know the functions you need or are you totally illiterate in javascript?

http://www.howtocreate.co.uk/

but not in the body tag, 2) js to move the mouse

just thought on the (my times) afternoon hilite

I don’t know about the first question, but you can’t move the user’s mouse with JS.. that’s a security violation

rats. I was just kidding about the mouse.

what is the first question?

cuz to me, the mouse is the piece of hardware I hold in my hand. be a neat trick to make it start moving around
body onload=”document.getElementById(‘loginbox’).focus();”
but not in the body tag (it isn’t easy to get to… standard template)

focus on a box once you load?

yes

yes, i think so
is that code not working? it’s something quite similar, I think

and /body

thanks anyway, then. i was thinking of a big leaf myself
carlfk, can’t you add it in to the body tag after it’s defined?

the first line I have ‘easy’ access to is form method=”post” action=”.”

addEventListener and attachEvent(ie)

not easily

you can attach shizzle to your body onload event

right.

where would that go?

between script tags

body.addEventListener(‘…..’) I guess
or
document.getElementById(‘body’).addEventListener(‘….’)…

doesn’t something have to call it?

nah
wait a sec

yes…

document.body

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

exactly (-:
describes ie workings too

would document.body work?

yep afaik

document.body

body marginheight=”3″ bgcolor=”#ffffff” topmargin=”3″ onload=”…

looks like it requires body onload=”load();”

ehr no?

I can add a ‘hook’ into the body tag, in which case I can just stuff the onload in there. I was hoping to only work with the one file that “is the body”

http://cross-browser.com/x/lib/view.php?s=xAddEventListener
there is also xAddEventListener2 and xAddEventListener3

what do you mean exactly?
cause you can include a script, and write document.body.addEventListener (“load”, function () { \n\n\ncode
that would simulate a “onload” file
or something like that

lives. trying not to muck with it

so

both are django templates to be exact

which files you want to mess around with?

login.html

hehe
so do an include there for a .js file?
or in it :p

for this Ill just include … yeah

on your body ?

I thought I still needed a call from the body tag?

No
The onload event can be modified directly.

in that case, can I just do:

scriptdocument.getElementById(‘loginbox’).focus();/script

you can but it is not very good (standard)

overwritten more likely

i haven’t undertsand why de you can’t use window.onload = function () { code }

that would be assuming joomla doesnt do anything to the body onload event

You can but it won’t work because loginbox isn’t in existance yet

or django

Django doesn’t touch the HTML

?
nah but it touches dom?

No

(guessing ‘touch’ needs to be defined)

Django by itself doesn’t modify the output in any way

by itself it doesn’t do anything. once some hack weby starts driving, all bets are off

Aye :-)

because it splits it into 3 lines and indents foo

well
lala
nvm me

it works!
yay. thanks folks.

Welcome

thanks for your help gebura. I just decided to store it as a string and run it with eval
simpler

anonymous functions are also simples
you have problems with ?
it must be more flexibible that ’s your hack

i have sort of a unique problem that i cannot seem to find an answer to
im using the function getSelection() and that works just fine

well, I wanted to basically create a kind of playlist of functions and then execute them at a later date, which is why I think strings are more natural
that and it was confusing trying it with anonymous functions

but i would like to get the selection of a string the user has just typed, is that
even possible via javascript? or should i be looking elsewhere ?
the only thing i could think of would just be grab the text the user has just input and set it to a varaible and then use getSelection on that
but that does not seem to work because i think the selection markup used is lost when the data is sent

invinceable, user submited values in html content aren’t different in
(for example in a input)
so i don’t think it is possible
sorry

it isnt :/ i swear i saw someone doing it on their site using a WYSIWYG editor to input custom tags and such

user submited values and values already in html content aren’t !=

:/ darn i already coded the backend too

maybe i don’t understand what do you whant

to be prepended to the text that is currently highlited

etc etc

maybe there is some way to trick JS into before rendering the text, first set that input field to a normal html host element somehow, and then get the selected text from that ?

ok i haven’t undertsand good the first time

There are API methods to get the selection location I believe.
`js selection

the problem is that when you click you will loose selection

yep i think that is so, i was working on this ealier with a co-worker and we’re trying to figure this out but we were given this
http://pastie.textmate.org/86037
that is supposedly how Drupal does it, but i don’t understand how they can get those function to work on input values
everytime we try it, no dice :/


Try warning out element.selectionStart

you mean just comment out the entire if statement ?

how to change background image with style ?
style. ?

I MEAN LEARN TO PROGRAM.

:/

Hi all. What does it mean if a variable begins with an @ symbol, ie var @47@ = ”;

is this valid ?
document.getElementById["underblog"].style.background = “http://www.101greatgoals.com/wp-content/themes/default/images/header_white.jpg“;

so warning out element.selectionStart and learn to program are == ? :P

ive never seen that before
its probably just somebody trying to be creative

@ is an illegal character in JS .. are you sure there’s no source filter before that gets to the browser?

I think I answered my own question. It’s a modifier that forces ‘by reference’. I didn’t realize javascript could have references.

Eh?
Where do you get that info from?
var @47@ = ”;

Error: Error: missing variable name at line 0: var @47@ = ”;

I should know this, but how do I pass a string literal to a function in an onclick (e.g. onclick=”function_name(“string”)”), the many quotes seem to be confusing the browser

Use different quotes or escape them.

alright

And remember you can’t escape quotes in HTML
Though you can (and should) encode them

Why can’t I use document.body[eventName] = function … in FireFox but it throws no error?

Woosta, I have 2 code samples that use this, one complicated one that works, one simple one that I just put together thats broken. I’ll see if I can figure out what the difference is…

Oh, yeah, attributes.

no, where did you get the info that it’s something to do with references?

It works just fine in IE 6 & 7, but it never binds it to a event call in FireFox

?

wll thank you for your GREAT advice
but i solved here
http://paste2.org/p/5626
*solved it

lost it… still looking…
doh… I misread the page I found. The code is being passed through a pre-processor, which is replacing the weird @ variables with dynamic names. It’s a silly form of code obfuscation (but apparently worked on me!)

figured it out, had to use window.addEventListener(eventName … in FireFox

#microformats
err
forgot the join

Does anyone here know much about IE 7? I’m trying to debug a script in it, and I am on a Mac. It’s causing me no end of pain. http://paste.lisp.org/display/45857
I’ve annotated that with the relevant HTML.
The problem is that it doesn’t even start showing anything, so I think I must be doing something wrong with onload?

how do i get document.getElementById(‘addGameButton’).value = “Hide Game”; to work in Firefox? or something that can get the same effect.

what the hell…

i am setting an opacity on a png image in ie6 with a png transparency fix, and it goes to 0 immediately..
i’m pretty sure it’s because of the fix

Hi!
why aint this working:
with (A) y=4;
document.write (A.y);
results in “undefined”.
shouldnt it be “4″ ????????????

“with (A) y=4;”?
var A.y = 4
maybe.

you dont know “with” ?
this works:
with (document) write (“hello”);

what is “with”?

with (A) this.y=4; maybe?

or… A.y = 4

It changes the object scope
A.y = 4; will work too :P

“undefined” again

in the line?
hmm

I’ve never actually used “with”

this works as well:
with (location) href=”http://www.heise.de“;
I dont get it, why “with (A) y=4;” is not working.

is A defined?

var A={};
with (A) this.y=4;
document.write (A.y);
thats the whole code. 3 lines.

{}
?
does “A.y = 4″ work?

yes

dont use with statement, it’s depriciated
deprecated

who says so?

it’s not deprecated
ur deprecated
Firefox 1.5 generates a warning when the ‘with’ statement is used: “deprecated with statement usage”. This has been removed in Firefox 1.5.0.1 (bug 322430).”

another question:
when I do this:
eval (“x=3;y=4″);

”ERROR: syntax error at (eval 212) line 2, at EOF

A is not an object then
……
http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Referencetatements:with

x and y are now in the global scope. any way to make eval put stuff in a different scope?

…..

eval(“var x=3; var y=4;”) maybe?

”ERROR: syntax error at (eval 212) line 2, at EOF

yes, but I need to eval user-input that lacks the “var” thingies.
thats why i wanted to wrap WITH around it. but that doesnt work either…

eval(str.replace(/(\w\=\d/g, “var $1″) maybe?

”ERROR: 13163: Search pattern not terminated at (eval 212) line 1.

i’m not sure if = should be = or \=

Heh

only way is to prepend all declarations with the var-keyword.

Why the hell do you want to eval user input?

eval(‘x=13;y=33′);

why not?

33

It’s usually bad design..

that regexp will probably not correctly transform something like “apples=oranges*peas*packagesize+overhead”

umm
does anyone use mr. turnbull’s IE5.5+ PNG Alpha Fix v1.0RC4?

‘with’ isn’t technically deprecated, just practically deprecated. It’s a bad idea

mumpitz. the client is free to execute on his machine whatever he wants.

yes, that’s what i meant

then maybe do \w+ instead of \w?

yeah, that was for Agamemnus .. I figured you knew that :-D

well, i will probably be able to create a regex that works. i was just hoping to get around it.

I really think regex would be the easiest solution

yupp. will go that route,
..

Can anyone help me with my IE problem above?

what’s wrong with this ? ” if (event.propertyName != “src “) return; “

Trying to get any form of debugging working in IE is failing me.
bTrying to get any form of debugging working in IE is failing me./b

arcfide… how so

Well, I get “Runtime Exception” as the error, and then, I can’t start any debuggers.
I mean, this script isn’t that big, how could this be so hard?! :-(
I’m so annoyed at IE right now.

idk
restart ur IE/debugger/computer
but what the hell is wrong with my code?

I didn’t see your code.
Where is it?

In JavaScript do you only use == when its a string? and = if its a boolean?

= is assignment, == is comparison, regardless of its operands

why doesn’t this work?
if (event.propertyName == “src “) return;
or if (event.propertyName != “src “) return;

well im doing if(add == true) that dont work, but if i do if(add = true) then it does…

just doing alert(event.propertyName)…. works

What does that alert give?

if i change it to false, it no longer works so from what it looks it works properly with just =

if (add==true)…. do you have add and true defined?
it gives “src”

var add = php echo “‘$add’”;?;
to whatever $add is, at times its nothing at others its true

With or without the quotes?

what?
without the quotes…
if (event.propertyName != “src “) return;

What do you expect that to do:?
I mean, what are you trying to do?

I’ve got a question about the ‘new’ operator. Let’s say I do var foo = new bar();. is there some way to stop it from overwriting the object? like, return false in the initalize?

no there is not, new returns an object. always. throw an exception if you want to handle errors

hm.

i am starting to doubt about always though.

Well, what i’m trying to do is click an element, and it will create the object. But if it exists already, then I don’t want to create it.

does anyone have a code snippet to turn table cells into editable fields?
i don’t even need the reverse

using any libraries right now?

me?

yes

mootools
anyone?

How can I know if the client has JS blocked?

i don’t think you can

Your script won’t run.

I am doing an online quiz program which automatically logs out the user after 30 minutes.
I don’t want them to reset the timer or disable javascript.

do it on the server

load the page with JS

j4cbo, but how can I call script at that time?

you can’t. record the time the user starts the quiz
and then if they try to submit it and it’s been too long, refuse

well
you can use push
but only opera supports it, and i have no idea how to do it

all browsers support push to some degree, but it’s ass to do in any existing web framework (i’m actually writing my own for it), and really isn’t appropriate here
just make a counter in javascript, and if the user disables it, that’s their loss

Whats the firefox compatible way of making a divs display change?

hello, if I want POST data with XHR should i set Content-Type on xhr ?

does anyone know a good script for edit in place?

The same way as any other browser, .style.display = “newvalue”;

did, its not working
ill paste my code sec

Then you’re doing it wrongly.

document.getElementById(‘div1′).style.display = ‘none’;

http://pastebin.com/m37378759

I suspect it’s empty.
Your code doesn’t account for that, now does it?

i have div style=’display:none’

buttons values change ?

actually thats not the problem, firebug says that the .value one is (my bad)
yeah, they can well in IE atleast

http://pastebin.com/m2cdd5285
Ah
Hm
Sample page?

is there a way to get the selection length of an input string without setting up two functions ?

you get pm?

i dont think my selectionstart is being initialized correctly

There is no element with ID “addGameButton”

it has name=addGameButton

So?

makes it work fine with IE, lets see

Note “getElementByID”
ID
Not “name,” “ID”

picky picky :/

We have a separate function for that, document.getElementsByName().
It’s just stupid for gEBI() to return elements based on names.

ah…

Especially when that means it can return an array
I mean, how broken can you get?
s/array/collection/

still crashes :|

You didn’t read what I said
Also, you took it the wrong way
Hm
Actually, no, now you come to mention it that is easier.
But it’s getElementsByName()
Plural.

i do have that refresh lol

It now works
Kind of

yeah, they value of button dont change

You see how there’s an s in getElementsByName()?
That means it’s plural.
More than one element can have the same name.
Thus, getElementsByName() returns a collection.
As, again, I said above.
And I’ve been coding too long, my wrist is starting to ache

i tried adding the id tag to the button, didnt work, tried using singular of the getElement and didnt work either
it works now … -_-
thanks a bunch again

anyone know of a good tutorial/link to show how values about the selected text can be found from a textarea?
i know there is tinymce but my recquirements are very basic and i think somethign like that would be overkill

Welcome
The error console is very helpful

what does “values about the selected text” mean?
if you just want to know what text has been selected (i.e. highlighted) by the user, then there’s something like document.getSelection
and an IE equivalent that i cant remember
ah found it
inVINCEable667_:moz: document.getSelection, ie: document.selection

if (event.propertyName != “src “) return; …. is this valid javascript?

Yes
Although that’s no guarantee it’ll work

:-|
aight

What’s wrong with it?

finally got this working, “object required”

event doesn’t exist in anything except IE, use arguments[0] instead

i’m trying to fix IE5.5+ PNG Alpha Fix v1.0RC4 by mr. turnbull
the test in question is after the IE5.5/6 detection

Oh

the fix doesn’t work with varying opacity

But surely that’s the point of it.

I think it’s because it’s activated when properties of images/divs are changed
no, it only fixes transparency issues
otherwise if I set opacity, it goes to 0 immediately
so I say, if the name is not “src “, then return

Aye, probably

before that, it said:
if (!/MSIE (5\.5|6\.)/.test(navigator.userAgent) ||
(event && !/(background|src)/.test(event.propertyName))) return;

But wouldn’t it be “src” rather than “src “?

so now I add, “if (event.propertyName == “src “) return;”

Why would it be “src “?

i think actually it isn’t the problem anyway, and sometimes event is null

Ah

i had it do an alert of the event.propertyName
and it was src
then I did a test on “src” and it didn’t activate (if statement)

is there a way in javascript to add a character to the front of a position? for example i have the character position 21 and i would like to prepend a “T” to the front of that
is there a way to do that

so I added a space, and it did, but something still errored

without using a loop to go through every single
character

invinceable, sure

could i just please have the name of the function i can figure it out i searched google i just cant find it

it’s one of the string functions ..
string manipulation
hold on

i dont think sub_string or substr() would work either
normally i would be doing this with PHP on the backend but this has to be done before it gets to the backend :/

http://www.w3schools.com/jsref/jsref_obj_string.asp

str = str.substr(0, 21) + “T” + str.substr(21);

ugh ur 100000 steps ahead of me, Twey

wonderful ! ill try it right away
but im guessing i need to delete those out strings out of the document first, then perform that function, then write them back in so there is no repeat

?
OH!
I know what the problem is
last time i had a problem because a div enclosing an image in ie6 did not transfer its opacity to the image correctly when its own opacity was changed
(if it had transparency and opacity already).. the image’s transparent color became visible
but no, these images don’t have opacity already, or do they?
frustrating
does anyone know how “IE5.5+ PNG Alpha Fix v1.0RC4″ works?
I am looking at the code but it just don’t click
dammit!
2 bugs… 2 opposite solutions
this is bullshit, found another method but it breaks my code
they don’t respect the alpha channels
dammit

You should not apply other visual filters to the iamge with the PNG behavior because these other filters do not respect the alpha channels and the result will most likely not be satisfactory.

any ajax menus wich can be edited on the fly ?

Anyone using Sprout?
http://wiki.sproutit.com/core/

Haha, “Java Script”

eww .. scary

Gragh.
Namespacing prototypes in JS is so damn awkward.
Something like myObject.prototype = {someproperty: {f: prototypedObject}}
It’s virtually impossible to get a reference to the myObject instance from f or a method on it.

does anyone use YUI here?

Twey!
Still awake? o.O

Aye

hi, is there an alternative for createEventObject in firefox?

If there was, what would it do?

It creates an event object

AHhhh
*whack*

Hahaha
Seems perfectly self-explanatory to me :-p

How to replace “/n” in a string with “”

“testing/ntesting”.replace(“/n”,”")

testingtesting

\n not /n

should work in either case

“testing/ntesting/ntesting”.replace(“/n”,”")

testingtesting/ntesting

you want a g in there

“testing/ntesting/ntesting”.replace(/\/n/g”,”")

Error: Error: missing ) after argument list at line 0: “testing/ntesting/ntesting”.replace(/\/n/g”,”")

why g

i’m getting my slashes all mixed up

global replace
no, you’ve got an extra “

“testing/ntesting/ntesting”.replace(/\/n/g,”")

testingtestingtesting

“testing/ntesting/ntesting”.replace(/\/n/g,”")

testingtestingtesting

oh hehe

Let me try
i think it should be replace(“/\/n/g”,”") with double quotes for both

but it is always coming in single line between div

That would replace only one instance.

How to do that , will you help me ?

I think you mean str.replace(/\n/, “”)

If i enter in textarea with ‘Enter Key’ it is not coming on with multiple lines in div
str.replace(/\n/, “”) works fine, thank u

Is it possible to set .onfocus without describing it in the html tag?
Will it only be run once, or how do I set it?

on focus is run every time the element is focused

myelement.onfocus = function() { /* do stuff */ };

thankyou

any ideas how to create user definable menu ? ( to let him choose what to remove from actualy menu )

hi
how to run function when page load/render finish?

well there’s the document.onload event which you can define in either the body tag body onload=”callFunc()”
or you can define it dynamically
scriptdocument.onload = function () { doStuff } /script

scriptdostuff()/script

thank you a lot

hi, can anyone help me figure out why this doesnt work in ie?
http://dev.byron-adams.com/jquery/plugin/appendDom/

Hi
I have a list and the user can click an item to select it – I’d like to make it so that if I type “t” it will jump down to the T part of the list
Basically how most operating systems and browser drop downs work
Anyone have any hints/ideas for me?

can anyone tell me how to change ExecCommand(‘createlink’,true) so that the dialog asks not only for a URL but also for the text to display on the page

I’m not sure what ExecCommand is

natrap, you’d probally need to create your own dialog and insert the link via ExecCommand(‘inserthtml)

but if you want text to display on a page I’d look at innerHTML and appendChild

im guessing this for a document with designMode=on ?
whats a good way to time the execution of a function?

you know what i just saw its not needed. if i type the display text first and select it and then press insert link it does what i want

search for ticks I think

ticks?

Click.ticks
*Clock.ticks

grab a new Date() at the top, and another at the bottom. Subtract.
`benchmark

http://rick.measham.id.au/paste/benchmark.htm

^^ that’s how that works

woosta, thanks

how precise can that get?

Woosta, can i just use that tool asis? :P asin just insert some code into one of those textboxes?

yes
Date objects are microsecond precision

oh, well then that’s good
I wonder where/why I thought that Clock.ticks was a good idea
In any case, do you have any suggests for my find as you type question?

And when you run a thousand iterations and divide the sum of the results by 1000, you get nanosecond precision

hi anyone fam. with mootools here?

I have something like that somewhere IIRC

I don’t need code, just ideas

Good .. you can read my code and get all the ideas you need coz it doesn’t seem to be working any more for some reason
http://rick.measham.id.au/paste/typeAhead.htm
If you find the problem, let me know :-D
Ahh
it isn’t finished

hmm
I’d rather not have an input
my main problem is catching keystrokes without one

OK then I don’t 100% get it
You have a regular select and you want to scroll down it as people type?
Coz that happens already

http://www.tom-haynes.com/music

anyone think this is fast? http://dev.byron-adams.com/jquery/plugin/appendDom/ :P

looks like itunes, should act like itunes. focus a pane, type to select something fast
no forms at all

very nice trhaynes

ahhh
you want document.onkey(press|down|up)

ok cool
any way I can make the spacebar not scroll?

Then in that handler work out which ‘pane’ is focused and pass the event to a specialised handler
spacebar scroll .. ?
Ahh
sure
onkeydown = function(){ return false }
now no key will do what it normally does :-D

oh good

which will be annoying .. so check if it’s spacebar first

I’m all about messing up people’s expectations of their own computer

(and probably return true if event.ctrl)

yeah, I’ll be smart about it
I’m a little sore that I just lost ~30 minutes of work due to stupidity

you should split you theads from your tbody so that the headers stay in place when you scroll
30 is nothing
I’ve done weeks recently
It’s the ‘R’ in R&D :-D

I’m sorry
I was thinking about that, but how will the theads and tbodys be the same width?

that’s how they work

oh?
I can set different CSS positioning on each?

IIRC zofbot has a link to some tutorial on how to do it right
(in #html)

thead {position: absolute; top: 0;} tbody { overflow: auto;} or something
that’d be really cool

that will glitch in Opera

IIRC it was slightly more annoying than that

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

Comments are closed.