So I inherited some code where the author had a bad habit of making assignments to undeclared globals ie that
window.onload = findDigg;
tag?
goes wherever you call it
headscript blah blahwindow.onload = findDigg;/script/head
thanks!
it can go there though right?
The SCRIPT element places a script within a document. This element may appear any number of times in the HEAD or BODY of an HTML document. // html 4.01 section 18.2.1
thanks for the help, I don't get an error anymore
hope you 'digg' it
So I inherited some code where the author had a bad habit of making assignments to undeclared globals, i.e. that are assigned in a function without being scoped with 'var'. It's certainly bad style, but are these actually scoped as globals, and will it break on some browsers?
unfortunately, I added an 'alert("hi")' at the top of the function I'm 'onload-ing' and I don't get any alert on load
screw it, whatever
var makes a variable, not necessarily global
can JS communicate with PHP.. like if I want to send a variable to a php script or something.. or is it only GET and POST that works?
Right, but is acceptable to not declare the scope anywhere with var?
'var' just does an EXPLICIT making of one, instead of just using the name, removing ambiguities from any other same-named one being referenced upon, instead of a new instance at the current scope, using VAR removes scope-same-name-variable mixups
yes and no, it doens't, since they're both at different scopes, php is preprocessing on the webserver scope, js is on the client scope, but it can send url stuff or strings on POST/GET calls, which PHP/perl/asp/cfml/else can use
depends
so can I in a js do include stuff in a GET string without reloading the page.. or something…?
or POST,, which would be better
GET is available via location.search
POST is not available to the browser
its claiming my function is not available yet. the function is loaded in the header with an external .js . how can it not be available. this is for a onclck event on a form object in the page
what browser?
all of them
can you pastie something?
page is private. i can show you this. its loaded with script type="text/javascript" src="/js/behaviour.js"/script
which is this http://pastebin.ca/612087
The paste 612087 has been copied to http://erxz.com/pb/3507
Wage/salary/li
and
income?/label
body onload="hideElement('q12');hideElement('q13');hideElement('q14');"
your function is named displayElement. your onclick is trying to call "showElement"
hmm you are right
flaccid error
ha
thanks for your help
np
ok works good except
when it shows the element that was hidden which is a li, the number doesn't come back
(its an ordered list)
this occurs in opera and firefox but not IE
im submitting a form with document.myform.submit()… there is any way to make it submit on a new page, similar to a link with target='_blank'?
you could probably code that but its totally frowned upon
`js forms @ pablasso
js forms: Accessing form elements via JavaScript: Don't use document.forms[index].elementName or document.formName.elementName. Use document.forms['formName'].elements['elementName'] or document.getElementById('formID').elements['elementName'] or
document.getElementById('elementID')
^^ at least do that .. it won't fix your problem, but do it anyway
have you checked out any of the libraries out there? in Prototype you'd just call show() and hide() on the elements
sorry, ill use forms then any idea how to solve my problem?
what…. doctype are you using?
mmm XHTML 1.0
hehh
how about …. something like well, html hosting frameset doctype?
you can set a .target on a form… come to thinkg… I think it may just work even in .. welll can't say
hehe
on html strict, or xhtml which you have no really good reason to use, the target= attribute is removed, since it was originally intended for FRAMESET doctype, to address the framed pages as target, so using frameste doctype solves that, since you can just use target="_blank" in the form element in
the markup
`know xhtml @ pablasso
know xhtml: Are you using XHTML? READ THIS: http://hixie.ch/advocacy/xhtml , http://www.webdevout.net/articles/beware_of_xhtml.php , http://www.webdevout.net/articles/validity-and-well-formedness
duh.. i didnt know target works on forms too.. lets try it
Yay!
yup.. target is fine on a form with html strict, thanks!
does somebody have the patience to help me?
no
ok so my problem
http://75.18.204.208
if i click on the 1 again
it goes away
if i'm already on 1
you have to check the Prototype or …. I think is in effects.js documentation, since is what you're using
because you're hiding the "previous" one, even if it's the same one
where am i hiding it?
make swapFade return immediately if old == new
ugghh i'm confused deltab
heheh
do you even know what you're doing? ^_^
do you know what swapFade does?
cuz I know exactly what deltab meant, and I don't use prototype or scriptaculuous
heheh
do i add something, or change something
is there a builtin function to fetch a page? i'd like to do something like blah.innerHTML = FetchPage(url) ; I got some divs dynamically created i'd like to stuff with html from the server in a straight forward manner? I'm i thinking about this logically?
yes
there is a way to do that, but not with a function
so what would i change
http://developer.apple.com/internet/webcontent/xmlhttpreq.html
make swapFade return immediately if old == new
hrmmm. Ive been sucking in JSON data and generating the html hosting in javascript, but i'd like to let my server side templating engine handle all that
i'll admit it deltab, i don't know how to do that
oh cool, i didn't think i could do that with the XMLHttpRequest thing
`js innerHTML sucks @ _koft // remember
js innerHTML sucks: If you have events on elements that are rendered via innerHTML they do not go away when you empty the innerHTML area. They may even crash your browser. You cannot use innerHTML for building items like tables in IE. You cannot use innerHTML for adding options to selects
in
..some browsers. Form elements apparently added to forms via innerHTML do not get submitted with the form
thanks for that tip, i was not aware of that pitfall
if (x == num) return;
that didnt do anything
did you put it after the line that defines x in swapFade?
pitfall? hehehe, one may note that XMLHttpRequest() object works only on same-domain requests, no cross domains
~
thanks deltab
i think i understand it now
do you know a good javascript for fixing table header on a scrollable table?
myArray = new Array();
I've even tried myArray = [];
What's the *real* name of your identifier
the-erm: nope
I figured it out … really odd. I was setting myVar inside a function "global" but apparently IE likes it to be defined outside the function global first … which I thought I did.
Put apparently not.
s/Put/But
Hi
hi.
How to reload the file in an iframe ?
the page?
yes the page
I want it to reload the src with javascript
why?
I have 3 tabs on my page and it has been filled with using the iframe and there is an 'refresh' button
i want to fill this iframe or src on clicking the 'refresh' button
the tabs are filled with iframes?
yes
3 iiframes used for 3 tabs
why not use ajax?
better than using iframes
are iframes even XHTML?
yes, but we recieved the html design with iframes
so update them?
anyways you coudl probably just point the link to the iframe target and make the href the iframe URL
can u give me the syntax ?
i'll try
a href="http://www.mysite.com/myiframepage.html" target="iframename"refresh/a
http://www.thescripts.com/forum/thread468654.html
there
behold the power of google
I think we can use something like document.iframe.src='page"
yeah
read the link
ok
for you folks using firebug… when i'm looking at a load time for a javascript host file… is that simply DOWNLOAD… or load into memory (read objects etc…)?
Hello.
Hello!
!olleH
¡ollÝe
ooooh
pÝssÝydo1 Žl1sPÝ Ýy,noŽ ÝÝs 1
'³BAø
that's freaky.
not so easily impressed, but easily amused
uÝe‡ pÝsnoP Žl1sPÝ 'Žyyos
better
it's JS
hhehe
hi
http://paste.css-standards.org/19035 for some reason the "getmouseXY" function calls the "wait" function twice. How to avoid this ??\
how do yuou know?
So… I am loading the source of a page in an ajax fashon, however, inserted javascript doesn't seem to work
what do you mean how do i know ?
in the wait and decrement function's i have setup alerts. Not shown in the pastecode though
well
this is the exact code im working on now http://paste.css-standards.org/19036
setTimeout() does NOT STOP the next line from execution, it just times out the one argument it's given
and I think is what you're getting
the "getmouseXY" function calls the "wait" function twice, i.e the alert("making animation visible"); pop-up's twice
hiho
options?
yourSelect.options.length
and is there a way to get the value of the last option in drop down?
yourSelect.options[ yourSelect.options.length - 1 ].value
if all i want is the Fade & Appear function from effects.js
is there an easy wasy of getting only that bit out
I don't know what effects.js is .. surely whatever it is, you can just extract the routines you need and the functions they in turn call
part of scriptaculous
scriptaculous/prototype have a method of only loading the parts they need afaik
ask in #prototype
i did ;p
http://paste.css-standards.org/19036 for some reason the "getmouseXY" function calls the "wait" function twice. How to avoid this ??anyone ??
thecoolone19, why are you saying "wait()" ?
just a function name
the function name is not wait()
it's wait
but wait() also calls the "wait" function
i think that's where you're getting you're double call from
ok ill change wait to wait() and see
no
change wait() to wait
remove the quotes
which lines are you talking about ?
all of them
i see there are multiple places where you are passing a function name as a function call within a string
for function it should be wait() for sure
instead of having "somefunc()" change it to somefunc
thecoolone19, of course
that's the function declaration
ok
can JS distinguish right mouse click from left mouse click?
if I do node.innerHTML = "divdiv/div/div"; should I expect it to have immidiate impact on the DOM tree?
try event.button property
or does it need to be parsed, or something?
I would say it "should" update DOM as you set the content.
I don't need to run any functions or anything?
good
I'm trying to write a function that goes through the tree and evaluates all the javascript
is there a builtin function for this?
fatbrain what does HTML form buttons have to do with what I asked?
ah you mean event
ok got it
is it possible to make a JS save text in a file by calling a dll?
by calling and allowing activex, yep
… man that's just a security issue waiting to happen …
we dont need security, we need education, we need security because people are malicious, if we have education we wont need security
Unless of course it's a situation like a cookie where you can't change the path.
JS can write in cookie?
yes
Yes it can write cookes.
SetCookie()
thus it can write a text file
ahum
document.cookie
I've never pushed the limits of cookies … I wonder how much data you can put in one of those before the browser pukes.
I always use php's session, and maybe a cookie stating giving the screen width/height, or a 'remember me' cookie, that's an md5() of some info, and then I load the session from the database.
does anyone have a function for (dynamically) loading an external .JS file? (other than embedding it as SCRIPT element from the start)
I'm working on one right now
what are the odds
hight
well, low, I have to go out in 5
but it is simple, read the file in, then eval() it
how are you gonna do it? append a SCRIPT element dynamically? does that work?
oh cool
how far have you come?
so, you eval() all the javascript in one hit
tags
could you paste what you have so far?
pastebin rather
my problem is the file contains a mixture of html and javascript
join ##ubuntu
heh
Hello
??
my client ignored my slash
lol
hehe
I need dollars
easy dollars
send me 100 EUR, I'll send you 100 USD in return
could you paste what you have so far?
I will send you 100 singaporian dollars
lol
who here has NEVER used warez?
I'm sure this would be rather funny if I knew the conversion rate.
give me 5 mine
min
do you have mixed javascript and html?
I can neither confirm or deny that question.
thanks gregorycu - and no, just .JS luckily
because this function traverses the DOM tree
you just want to read the file, using XMLHTTP requests
I can strip unneeded stuff, but I might need that complex thing later on too
and then eval() the responce
what is warez
also, I'm not that good with XHR yet, so your code should give me a headstart
XHR is pretty simple … of course I use xajax.
Best php ajax library I've found.
I don't need PHP
just simple client-side JS
what is XHR?
XMLHttpRequest
hi all
aloha
you kids and your fancy names
where js code goes in a page?
inside SCRIPT tags, usually in the header
http://www.w3schools.com/js/js_howto.asp
ok, i have a mochikit function to round corners of elements of certain classes. where should i call it?
or rather, http://www.w3schools.com/js/js_whereto.asp
find an example on their page
thanks
going there
I mean on the mochikit framwork's page
got it, thanks
http://www.microsoft.com/surface/
How to set the function setTimeout("reloadAllFrames()", 5000); for 5 mins
5000*60
will 5000 refers to 5 mins ?
oh, no
5*60
hm
5000*60
5000 - miliseconds - i.e. - 5 secs
so 1000*300 - 5 minutes
it will come around 3 lakh secs ?
300000 millisecs
/1000 = 300 secs /60 = 5 minutes
hi, what is the offsetTop property of DOM element?
0)' date and time stamp with
i have got a js can nybody explain 2 mw…
what's the problem?
m putting the link
"aby" at 71.6.194.243 pasted "it hides the previous orkut scraps… but currently its nt working.." (1 line) at http://erxz.com/pb/3508
plz take a look http://erxz.com/pb/3508
phpboy FYI….
whats your opinion on this typematrix.com ?
SitRep?
Err, what's the difference between document.getElementById(id).width AND document.getElementById(id).style.width AND document.getElementById(id).offsetWidth and which one am I supposed to use?
my 'id' points to a canvas embedded in the page…
Hi, I need help with event handling and the this keyword
http://www.quirksmode.org/js/this.html says 'this' will be written into the 'onclick' method when I do element.onclick = sofunctionhere
but it doesn't work, it still refers to the window!
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
whats your opinion on this typematrix.com ?