From billy.reisinger at gmail.com Mon Jan 1 12:43:10 2007 From: billy.reisinger at gmail.com (billy reisinger) Date: Mon, 1 Jan 2007 12:43:10 -0600 Subject: [Javascript] Ajax question In-Reply-To: References: <7.0.1.0.2.20061230113442.05c946c0@juniperwebcraft.com> Message-ID: <14a0d8670701011043o2d38d1a3i1ab4e3b1058073bf@mail.gmail.com> Someone may have already mentioned this, but I believe the ajax request object has an "oncomplete" handler in every browser implementation. You could always send the ajax request and then set the window.location to whatever value when the ajax oncomplete event fires. That way you can be sure that whatever action was supposed to happen via ajax actually completes before you change pages. Something like this? requestObj.onComplete = function() { window.location = "http://somewhere"; } requestObj.send(); I dunno, maybe I'm not understanding your problem exactly. Billy On 12/31/06, tedd wrote: > At 6:04 PM -0500 12/30/06, Mike Dougherty wrote: > >On Sat, 30 Dec 2006 15:27:56 -0500 > > tedd wrote: > >>I know this is hard to understand, but just simply consider this -- > >>if the user clicks (The CLICK) this anchor -- > >> > >>Rock > >> > >>-- everything works. Now, how do I redirect the browser to another > >>page from the same user click (The CLICK)? > > > >I don't understand why you think you need ajax. If the page does a > >post submission back to the old-school server-side form handler, you > >can set whatever session variables you want then refresh the page. > > I need server-side to know what client-side is doing in real time > when the user clicks next page. > > >Now if the idea is that you have a really archaic FrontPage-style website ... > > No. > > >So now I wonder what you do with >href="javascript:sndReq('rock');">Rock if there is no javascript > >available? What about doing this: > > > >Rock > > There's no accessibility problem without js in my current > investigation. What I'm doing is rather trivial and not necessary for > the basic operation. It's progressive enhancement, not really needed. > > > > >If sndReq() returns false, the href will not be followed by the > >click - perhaps it could do > >window.location=pagerefresh_whatever.html - or it could simply > >return true and allow the normal function of the tag to work. > >Arguably better would be: > > > >Rock > > > >...then use some form of unobtrusive javascript to register the > >click event on the "Rock" object to the sndReq() function given an > >argument of "Rock" > > > >since you have a completely unusuable link given the > >href="javascript:whatever()" notation, it seems that this use-case > >is not what I described above, so if you have control of the page(s) > >why not eliminate ajax completely? Given that you want a page > >refresh after each change of state, you might as well use well > >proven technologies the way they were meant to be used. > > What fun is there in that? > > When current technology doesn't fill the bill or is illusive, then > you must look deeper. > > Cheers, > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > From mwarden at gmail.com Mon Jan 1 13:15:46 2007 From: mwarden at gmail.com (Matt Warden) Date: Mon, 1 Jan 2007 14:15:46 -0500 Subject: [Javascript] Ajax question In-Reply-To: <14a0d8670701011043o2d38d1a3i1ab4e3b1058073bf@mail.gmail.com> References: <7.0.1.0.2.20061230113442.05c946c0@juniperwebcraft.com> <14a0d8670701011043o2d38d1a3i1ab4e3b1058073bf@mail.gmail.com> Message-ID: Yes, the problem is likely that the sendreq function is executing in an asynchronous manner. The window.location line redirects before the request gets sent to the server. I would suggest using javascript to queue up location changes if there is a pending ajax request, then using the onreadystatechange event handler to execute any pending location change when readystate is 2 or higher. This should be sufficient, but theoretically you could still run into the case where your server side app layer has not set the session variable yet, but it is already processing the second request (location change). You can't avoid this case; you can ony impose enough of a delay to make it unlikely. You make this solution accessible by allowing links to work in the usual fashion if js is not available. Someone else in this thread explained how to accomplish this. Hope this helps, -- Matt Warden http://matttwarden.com Cleveland, OH, USA -- Matt Warden Cleveland, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From tedd at sperling.com Mon Jan 1 15:21:23 2007 From: tedd at sperling.com (tedd) Date: Mon, 1 Jan 2007 16:21:23 -0500 Subject: [Javascript] Javascript detection Message-ID: Hi gang: In my ongoing attempt to reinvent every wheel I can find, please review my current javascript detection solution at: http://sperling.com/js_detect Does this technique work to detect your browser's javascript setting? Also, if you change your browser's javascript setting, please restart your browser before rechecking the link. Thanks. tedd PS: I know that there are easier ways to detect js and tell the user what their javascript settings are, but this technique also tells the server. :-) -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From hassan at webtuitive.com Mon Jan 1 16:01:22 2007 From: hassan at webtuitive.com (Hassan Schroeder) Date: Mon, 01 Jan 2007 14:01:22 -0800 Subject: [Javascript] Javascript detection In-Reply-To: References: Message-ID: <459984B2.1070603@webtuitive.com> tedd wrote: > my current javascript detection solution at: > Does this technique work to detect your browser's javascript setting? BZZZT! Wrong answer :-) "Javascript has not been detected on the client." (env: FF 1.5.0.x/Linux, definitely JS-enabled...) -- Hassan Schroeder ----------------------------- hassan at webtuitive.com Webtuitive Design === (+1) 408-938-0567 === http://webtuitive.com opinion: webtuitive.blogspot.com dream. code. From wonsil at 4m-ent.com Mon Jan 1 15:47:50 2007 From: wonsil at 4m-ent.com (Mark Wonsil) Date: Mon, 1 Jan 2007 16:47:50 -0500 Subject: [Javascript] Javascript detection In-Reply-To: Message-ID: <000f01c72dee$7d1c9500$6564a8c0@WONSILT42> > http://sperling.com/js_detect > > Does this technique work to detect your browser's javascript setting? Incorrectly states that JS is not found in my FireFox 2. Mark W. From david at dorward.me.uk Mon Jan 1 17:06:08 2007 From: david at dorward.me.uk (David Dorward) Date: Mon, 1 Jan 2007 23:06:08 +0000 Subject: [Javascript] Javascript detection In-Reply-To: References: Message-ID: <20070101230608.GA29387@us-lot.org> On Mon, Jan 01, 2007 at 04:21:23PM -0500, tedd wrote: > Does this technique work to detect your browser's javascript setting? No. > PS: I know that there are easier ways to detect js and tell the user > what their javascript settings are, but this technique also tells the > server. :-) Design with progressive enhancement in mind, and the server shouldn't need to care. -- David Dorward http://dorward.me.uk From tedd at sperling.com Mon Jan 1 17:31:21 2007 From: tedd at sperling.com (tedd) Date: Mon, 1 Jan 2007 18:31:21 -0500 Subject: [Javascript] Javascript detection In-Reply-To: <20070101230608.GA29387@us-lot.org> References: <20070101230608.GA29387@us-lot.org> Message-ID: At 11:06 PM +0000 1/1/07, David Dorward wrote: >On Mon, Jan 01, 2007 at 04:21:23PM -0500, tedd wrote: > >> Does this technique work to detect your browser's javascript setting? > >No. > >> PS: I know that there are easier ways to detect js and tell the user >> what their javascript settings are, but this technique also tells the >> server. :-) > >Design with progressive enhancement in mind, and the server shouldn't >need to care. > >-- >David Dorward http://dorward.me.uk David: I thank you for your review, but I ~am~ designing with progressive enhancement in mind.I do know what it is. Please realize that there is nothing in progressive enhancement that prohibits the server from knowing what's going on. Progressive enhancement simply means that the application/web-site/feature/what-ever will work without the enhancement, right? So, if I look to the server for things to enhance the users experience, but not make those enhancements required, then the server can also be a tool for us to consider in web development. That is what I am doing. Thanks. tedd PS: What OS and Browser are you using? -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From david at dorward.me.uk Mon Jan 1 17:41:12 2007 From: david at dorward.me.uk (David Dorward) Date: Mon, 1 Jan 2007 23:41:12 +0000 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101230608.GA29387@us-lot.org> Message-ID: <20070101234112.GB29387@us-lot.org> On Mon, Jan 01, 2007 at 06:31:21PM -0500, tedd wrote: > I thank you for your review, but I ~am~ designing with progressive > enhancement in mind.I do know what it is. > Please realize that there is nothing in progressive enhancement that > prohibits the server from knowing what's going on. Correct, but it removes the /need/. > So, if I look to the server for things to enhance the users > experience, but not make those enhancements required, then the server > can also be a tool for us to consider in web development. That is > what I am doing. So the page works without CSS. So the page works WITH CSS. So the page works without JavaScript. So the page works with JavaScript. So the page works with JavaScript, but with popups disabled. etc. So - how is it useful to know if the client supports JavaScript or not? The page works either way. > PS: What OS and Browser are you using? Windows XP. Firefox 2. -- David Dorward http://dorward.me.uk From mwarden at gmail.com Mon Jan 1 19:31:09 2007 From: mwarden at gmail.com (Matt Warden) Date: Mon, 1 Jan 2007 20:31:09 -0500 Subject: [Javascript] Javascript detection In-Reply-To: <20070101234112.GB29387@us-lot.org> References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> Message-ID: On 1/1/07, David Dorward wrote: > So - how is it useful to know if the client supports JavaScript or > not? The page works either way. Perhaps we can skip the interview and just help answer the OP's question. Tedd, try something like this: if (!window.location.indexOf('js=1')) window.location = '?js=1'; You'll want to clean it up a bit because the above will remove any query string variables (could be bad). Another option: (new Image()).src = 'setsessionvar.php?js=1'; You can also use XMLHttpRequest, but then what you're really detecting is if XHR is available, which is not the same as whether JavaScript is available. -- Matt Warden Cleveland, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From david at dorward.me.uk Mon Jan 1 19:37:22 2007 From: david at dorward.me.uk (David Dorward) Date: Tue, 2 Jan 2007 01:37:22 +0000 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> Message-ID: <20070102013722.GD29387@us-lot.org> On Mon, Jan 01, 2007 at 08:31:09PM -0500, Matt Warden wrote: > On 1/1/07, David Dorward wrote: > >So - how is it useful to know if the client supports JavaScript or > >not? The page works either way. > > Perhaps we can skip the interview and just help answer the OP's question. Perhaps if the OP explains his thinking then: (a) We can learn something or (b) We can suggest a better solution This is a *discussion* list isn't it? -- David Dorward http://dorward.me.uk From tedd at sperling.com Mon Jan 1 23:11:38 2007 From: tedd at sperling.com (tedd) Date: Tue, 2 Jan 2007 00:11:38 -0500 Subject: [Javascript] Javascript detection In-Reply-To: <20070102013722.GD29387@us-lot.org> References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> Message-ID: At 1:37 AM +0000 1/2/07, David Dorward wrote: >On Mon, Jan 01, 2007 at 08:31:09PM -0500, Matt Warden wrote: >> On 1/1/07, David Dorward wrote: >> >So - how is it useful to know if the client supports JavaScript or >> >not? The page works either way. >> >> Perhaps we can skip the interview and just help answer the OP's question. > >Perhaps if the OP explains his thinking then: > >(a) We can learn something > >or > >(b) We can suggest a better solution > >This is a *discussion* list isn't it? > >-- >David Dorward http://dorward.me.uk David et al: To explain what I'm trying to do is probably too complicated for my limited communication skills. The original post that started me on this investigation was simply "How does one take the value of a javascript variable and carry it forward to the next page?" However, no one was able to provide an answer, other than using cookies and I don't want to do that. However, I believe that it can be done otherwise and that's what I am trying to accomplish. What I am doing is not essential to the operation of my web page and if javascript is not enabled, then the enhancement is not realized nor needed -- thus satisfying "progressive enhancement" requirement. So, we should not address that topic any further. My first step in this investigation is to determine if javascript is enabled in the user's browser -- the following is my methodology. 1. The user is directed to this url: http://sperling.com/js_detect The "js_detect" is a folder containing [1] (index.php) the default file, the code is listed below. As you can see, this [1] (index.php): a) starts a php session [js]; b) loads a javascript named [2] (is_js.js); c) makes the current index.php page refresh to "index1.php" after one second; d) and note, the index.php page has no visible content -- thus, the user doesn't see anything. 2. Now, javascript [2] (is_js.js) simply executes "a.php" script after an onload event and passes the js variable to "a.php" via a javascript POST operation -- IF -- javascript is enabled. 3. The [3] (a.php) simply takes a javascript POST and sets a php session js variable. Actually the else portion of the code is never executed for this would never be called is javascript wasn't enabled. I only present it for clarification. 4. The [4] (index1.php) simply displays the php session variable js. Now, I don't fully understand why I have conflicting reports. Some people have the identical browser and OS combinations and report that it both works and doesn't work. And, I don't understand why browsers running on LINUX and Opera on Windows machines fool the script. A more complete accounting is here: http://www.browsercam.com/public.aspx?proj_id=311334 In any event, the technique works for most browsers and OS's. Thanks for your review and comment. tedd --- code follows --- [1] --- index.php ------------------------------------------------------------------ ? --- end of index.php -------------------------------------------------------------------- [2]--- is_js.js ----(Thanks to Matt for the idea given a week ago)--------------- function is_js() { (new Image()).src = 'a.php?js=1'; } window.onload = is_js; --- end of is_js.js -------------------------------------------------------------------- [3] --- a.php ----------------------------------------------------------------------- --- end of a.php --------------------------------------------------------------------- [4] --- index1.php ------------------------------------------------------------------------ Stuff by tedd

Javascript has not'; } ?> been detected on the client.

--- end of index1.php --------------------------------------------------------------------- -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From stephanwehner at gmail.com Mon Jan 1 23:48:14 2007 From: stephanwehner at gmail.com (Stephan Wehner) Date: Mon, 1 Jan 2007 21:48:14 -0800 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> Message-ID: On 1/1/07, tedd wrote: > At 1:37 AM +0000 1/2/07, David Dorward wrote: > >On Mon, Jan 01, 2007 at 08:31:09PM -0500, Matt Warden wrote: > >> On 1/1/07, David Dorward wrote: > >> >So - how is it useful to know if the client supports JavaScript or > >> >not? The page works either way. > >> > >> Perhaps we can skip the interview and just help answer the OP's > question. > > > >Perhaps if the OP explains his thinking then: > > > >(a) We can learn something > > > >or > > > >(b) We can suggest a better solution > > > >This is a *discussion* list isn't it? > > > >-- > >David Dorward http://dorward.me.uk > > David et al: > > To explain what I'm trying to do is probably too complicated for my > limited communication skills. > > The original post that started me on this investigation was simply > "How does one take the value of a javascript variable and carry it > forward to the next page?" However, no one was able to provide an > answer, other than using cookies and I don't want to do that. > However, I believe that it can be done otherwise and that's what I am > trying to accomplish. I've come up with a way to accomplish as much of what I understand the ambition to be; I've been able to see it working on my rather outdated browser, Mozilla 1.3.1 - Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030425. The idea is to set the base-href to different values, depending on whether javascript is enabled or not. Here is a simple test file. Go to the exciting and telling page. I use file:///tmp since I don't want to set up a server for this. Now I create two directories /tmp/script and /tmp/noscript and put a file a.html in each. One says "no script", the other says "script". Depending on whether I enable javascript or not, I am taken to the correct page. (I often think I'm glad I am not a web-browser, having to process all this stuff.) Does it work in other browsers? Does it do what Tedd wants? Stephan From list at tridemail.de Tue Jan 2 01:50:09 2007 From: list at tridemail.de (Michael Borchers) Date: Tue, 2 Jan 2007 08:50:09 +0100 Subject: [Javascript] DOCTYPE making div.style.top NOT WORK References: <001001c725d4$44453830$af24a8c0@mbpc> <06CB8F61-104D-47F7-8958-EF3C7852F68C@nickfitz.co.uk> Message-ID: <006401c72e42$a09929e0$af24a8c0@mbpc> ----- Original Message ----- From: "Nick Fitzsimons" To: "[JavaScript List]" Sent: Friday, December 22, 2006 6:01 PM Subject: Re: [Javascript] DOCTYPE making div.style.top NOT WORK > Try this: > > function getPosition(element) { > var position = {x: 0, y: 0}; > while (element) { > position.x += element.offsetLeft; > position.y += element.offsetTop; > element = element.offsetParent; > } > return position; > } > > which will (as with your existing script) return an object with "x" > and "y" properties, and works (in my quick tests) on IE, Firefox, > Opera and Safari, even with a DOCTYPE declaration. works fine! great! thanks! From matt.murphy at thermofisher.com Tue Jan 2 10:54:11 2007 From: matt.murphy at thermofisher.com (Matt Murphy) Date: Tue, 2 Jan 2007 10:54:11 -0600 Subject: [Javascript] not well-formed Message-ID: <33CB8A3B603760409040215E4232728C2DD77A@exchange.tc-tech.com> whenever I do an ajax update with document.getElementById('domid').innerHTML='blah' I get an xml error from firefox that it's not well-formed. Any idea what this is? Should I bother worrying about it? Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick at nickfitz.co.uk Tue Jan 2 10:54:22 2007 From: nick at nickfitz.co.uk (Nick Fitzsimons) Date: Tue, 2 Jan 2007 16:54:22 +0000 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> Message-ID: <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> On 2 Jan 2007, at 05:11:38, tedd wrote: > My first step in this investigation is to determine if javascript > is enabled in the user's browser > > Now, I don't fully understand why I have conflicting reports. Some > people have the identical browser and OS combinations and report > that it both works and doesn't work. > > And, I don't understand why browsers running on LINUX and Opera on > Windows machines fool the script. A more complete accounting is here: > > http://www.browsercam.com/public.aspx?proj_id=311334 > > In any event, the technique works for most browsers and OS's. > It doesn't work on Safari 2.0.4, OS X 10.4.8. Surely the easiest way is to just use self.location.href to redirect to some page; if JS isn't enabled, it won't do anything. So, (with prior apologies for any syntactical errors in PHP, which isn't my usual server-side technology): self.location.href=\"startSession.php\";"); } ?>

Hello world

where startSession.php does whatever it does (including setting whatever it needs to detect that the session has already begun in the function "session_not_already_in_progress"), and then just redirects back to the above; as the session has been started, the redirection script won't be created by the server on the second time around, but the server knows that JS must be enabled for "startSession.php" to have been requested. On JS-disabled clients, "startSession.php" will never be requested. HTH, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ From tedd at sperling.com Tue Jan 2 10:57:59 2007 From: tedd at sperling.com (tedd) Date: Tue, 2 Jan 2007 11:57:59 -0500 Subject: [Javascript] Javascript detection 2 Message-ID: Hi gang: The following Javascript detection link works for all browsers provided by BrowerCam. http://sperling.com/js_detect1 Please only report failures. Thanks. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From tedd at sperling.com Tue Jan 2 11:02:02 2007 From: tedd at sperling.com (tedd) Date: Tue, 2 Jan 2007 12:02:02 -0500 Subject: [Javascript] Javascript detection In-Reply-To: <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> Message-ID: At 4:54 PM +0000 1/2/07, Nick Fitzsimons wrote: >Surely the easiest way is to just use self.location.href to redirect >to some page; if JS isn't enabled, it won't do anything. So, (with >prior apologies for any syntactical errors in PHP, which isn't my >usual server-side technology): > > > >if (session_not_already_in_progress()) { > print(""); >} >?> > > >

Hello world

> > > >where startSession.php does whatever it does (including setting >whatever it needs to detect that the session has already begun in >the function "session_not_already_in_progress"), and then just >redirects back to the above; as the session has been started, the >redirection script won't be created by the server on the second time >around, but the server knows that JS must be enabled for >"startSession.php" to have been requested. On JS-disabled clients, >"startSession.php" will never be requested. > >HTH, > >Nick. Nick: Your technique is simple and I am sure it works. It's similar to this: http://sperling.com/js_detect1 Sometimes it helps to bounce stuff off other people's heads. :-) Thanks. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From paul at juniperwebcraft.com Tue Jan 2 12:06:02 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Tue, 02 Jan 2007 10:06:02 -0800 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> Message-ID: <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> At 1/2/2007 08:57 AM, tedd wrote: >The following Javascript detection link works for all browsers >provided by BrowerCam. > >http://sperling.com/js_detect1 Tedd, And then, of course, it may not be the presence of JavaScript you need to detect but rather support for the DOM -- I assume that the reason you want to check for javascript is to see whether or not your client-side scripts will run. I suggest you include a check for document.getElementById or another DOM method that your scripts depend on. Downloading a test page before each real page will slow down the browsing experience, but perhaps not very noticeably on a fast connection. I'm guessing that what you're doing is establishing an architecture in which PHP downloads different page content depending on whether or not javascript is present. That implies that the javascript version of a page will depend on javascript running in order not to break. To be as thorough as possible, since a user can disable javascript at any time while perusing your site, I guess you'd need to test for js before every page. That still wouldn't prevent the current page from breaking when the user disables scripting, so I recommend that you keep at least your hyperlinks functional in the absence of scripting so folks can navigate to another page, restarting the process in non-js mode. Regards, Paul From mwarden at gmail.com Tue Jan 2 12:28:25 2007 From: mwarden at gmail.com (Matt Warden) Date: Tue, 2 Jan 2007 13:28:25 -0500 Subject: [Javascript] not well-formed In-Reply-To: <33CB8A3B603760409040215E4232728C2DD77A@exchange.tc-tech.com> References: <33CB8A3B603760409040215E4232728C2DD77A@exchange.tc-tech.com> Message-ID: On 1/2/07, Matt Murphy wrote: > whenever I do an ajax update with > document.getElementById('domid').innerHTML='blah' I get an xml error from > firefox that it's not well-formed. > > Any idea what this is? Should I bother worrying about it? What is the doctype and the content-type of the page in question? Thanks, -- Matt Warden Cleveland, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From tedd at sperling.com Tue Jan 2 13:35:50 2007 From: tedd at sperling.com (tedd) Date: Tue, 2 Jan 2007 14:35:50 -0500 Subject: [Javascript] Javascript detection In-Reply-To: <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> Message-ID: At 10:06 AM -0800 1/2/07, Paul Novitski wrote: >At 1/2/2007 08:57 AM, tedd wrote: >>The following Javascript detection link works for all browsers >>provided by BrowerCam. >> >>http://sperling.com/js_detect1 > > >Tedd, > >And then, of course, it may not be the presence of JavaScript you >need to detect but rather support for the DOM -- I assume that the >reason you want to check for javascript is to see whether or not >your client-side scripts will run. I suggest you include a check >for document.getElementById or another DOM method that your scripts >depend on. > >Downloading a test page before each real page will slow down the >browsing experience, but perhaps not very noticeably on a fast >connection. > >I'm guessing that what you're doing is establishing an architecture >in which PHP downloads different page content depending on whether >or not javascript is present. That implies that the javascript >version of a page will depend on javascript running in order not to >break. To be as thorough as possible, since a user can disable >javascript at any time while perusing your site, I guess you'd need >to test for js before every page. That still wouldn't prevent the >current page from breaking when the user disables scripting, so I >recommend that you keep at least your hyperlinks functional in the >absence of scripting so folks can navigate to another page, >restarting the process in non-js mode. > >Regards, >Paul Paul: I appreciate your insight. I'm not trying to send the user one place if js is enabled or somewhere else if it's not. What I'm attempting to do is very trivial. I'm sure most will say "That was a real waste of bandwidth", if they knew. It's just a trivial progressive enhancement that in no way will interfere with the user in navigating the site. But in my defense, I am learning how to pass variables from client-side to server-side without using cookies or obvious url's. But, to do that I need to know if js is enabled or not. I think I have that problem solved. Now, how to get around not downloading a test page before presenting the "final" product I don't think is possible for one has to use js to see if it's there, or not, before passing that condition back to the server, right? If you have a different method, I would love to hear it. Thanks. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From mwarden at gmail.com Tue Jan 2 14:17:23 2007 From: mwarden at gmail.com (Matt Warden) Date: Tue, 2 Jan 2007 15:17:23 -0500 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> Message-ID: On 1/2/07, tedd wrote: > But in my defense, I am learning how to pass variables from > client-side to server-side without using cookies or obvious url's. > But, to do that I need to know if js is enabled or not. I think I > have that problem solved. But this is exactly what you are doing in your js detection scenario. You are passing a variable to the server side indicating whether js is available. To make this data usable, you *are* going to have to use cookies (unless you use PHP's phpsessionid querystring parameter). Otherwise, the variable will not be available in the $_SESSION. In other words, you have these options: 1) Store the variable directly in cookies 2) Use PHP sessions, which store a session id in a cookie and persist the variable on the server side 3) Use PHP sessions, which append a phpsessionid querystring parameter to every URL and persis the variable on the server side 4) Append the variable as a querystring parameter to every URL You'll note that 1 and 2 are nearly identical solutions, as are 3 and 4. Once you establish that JS is available, you could do this communication via JS alone: (new Image()).src = "editsession.php?variable=value"; editsession.php is something like: ----------------- start_session() foreach ($key in $_GET) { if (... do any security validations here...) { $_SESSION[$key] = $_GET[$key]; } } For the next request, $_SESSION['variable'] will have value "value". -- Matt Warden Cleveland, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From tedd at sperling.com Tue Jan 2 14:46:00 2007 From: tedd at sperling.com (tedd) Date: Tue, 2 Jan 2007 15:46:00 -0500 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> Message-ID: At 3:17 PM -0500 1/2/07, Matt Warden wrote: >On 1/2/07, tedd wrote: >>But in my defense, I am learning how to pass variables from >>client-side to server-side without using cookies or obvious url's. >>But, to do that I need to know if js is enabled or not. I think I >>have that problem solved. > >But this is exactly what you are doing in your js detection scenario. >You are passing a variable to the server side indicating whether js is >available. To make this data usable, you *are* going to have to use >cookies (unless you use PHP's phpsessionid querystring parameter). >Otherwise, the variable will not be available in the $_SESSION. In >other words, you have these options: > >1) Store the variable directly in cookies >2) Use PHP sessions, which store a session id in a cookie and persist >the variable on the server side >3) Use PHP sessions, which append a phpsessionid querystring parameter >to every URL and persis the variable on the server side >4) Append the variable as a querystring parameter to every URL > >You'll note that 1 and 2 are nearly identical solutions, as are 3 and 4. Matt: Yes, I realize those -- however, there is one more way to pass variables from client-side to server-side, which is why I want to detect if javascript is enabled. My methodology (correct or not) is first to detect if javascript is enabled. If it isn't, then forget the enhancement. If it is, then: 1. gather the values of the client-side variables for the first page; 2. on unload pass these values to an ajax routine; 3. which then passes them on to a php script; 4. which then places them into sessions; 5. This way the next page can read the session variables and continue with values that were set on the first page. All of this is done without anything appearing in the url or in cookies. What say you? Won't that work? Thanks very much for your review. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From paul at juniperwebcraft.com Tue Jan 2 15:31:39 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Tue, 02 Jan 2007 13:31:39 -0800 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> Message-ID: <7.0.1.0.2.20070102124759.02276e20@juniperwebcraft.com> At 1/2/2007 11:35 AM, tedd wrote: >Now, how to get around not downloading a test page before presenting >the "final" product I don't think is possible for one has to use js >to see if it's there, or not, before passing that condition back to >the server, right? > >If you have a different method, I would love to hear it. Hi Tedd, There's such a discontinuity between the server and the client that I think the best you can hope for is a probability, not a surety, that a particular condition exists on the client side. You can make assumptions when you download a page to the client that might cease to be true by the time the page renders or at any time during the user's interaction with the page, and you can make assumptions on the basis of what you get back from the client that might no longer be true by the time you download the next page. I think the problem you're ultimately trying to solve is faux. The server CAN'T know whether or not javascript "is running" because the server-side script completes its execution before the page finishes rendering and the user interacts with it client-side. It's like deciding whether to leave your great-great-grandchild an inheritance of a comb based on whether they've got long hair. The expression of the problem infers a simultaneity that just isn't there. Even if you could look ahead in time and see that the child has hair and how long it is, by the time that child is born and reaches the age of inheritance they may have decide to cut their hair or they might be undergoing medication that causes them to lose it entirely. Better to leave an inheritance that they can use regardless. So I believe a more robust approach to web design is to deliver pages that work whether or not javascript is running. If the user can interact with the page controls as enhanced by javascript, then disable javascript, then continue interacting with the page successfully, I would slap that page with a big fat gold star. In that model the server doesn't attempt to determine whether or not javascript is running, it downloads pages that can accommodate both scenarios. Back to your problem, though: For reasons I don't know you've rejected suggestions of using POST and GET and cookies which are the primary mechanisms we've been given to share information between client & server. I wouldn't want to discourage you from cutting a new path -- go for it, maybe you'll figure out something that no one else has seen -- but I would think it would be somewhat more efficient to find a means that does use the familiar methods. For example, here's one using GET: Contact Us That is, pass a value to PHP which it can store any way you want between page-views, then redirect to the desired page. This link will work whether or not javascript is running, although if js is enabled it could modify the querystring to enhance the process. Here's one using POST:
or:
Here again, javascript can create, modify, and delete hidden form fields at any time until submit, and can take control of the submit method to work its magic at the last instant. As long as you're using a double hit on the server to accomplish your goal, I would imagine these solutions could fit inside your parameters (as I guess them to be). Regards, Paul From david at dorward.me.uk Tue Jan 2 15:40:21 2007 From: david at dorward.me.uk (David Dorward) Date: Tue, 2 Jan 2007 21:40:21 +0000 Subject: [Javascript] Javascript detection In-Reply-To: <7.0.1.0.2.20070102124759.02276e20@juniperwebcraft.com> References: <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> <7.0.1.0.2.20070102124759.02276e20@juniperwebcraft.com> Message-ID: <20070102214020.GI29387@us-lot.org> On Tue, Jan 02, 2007 at 01:31:39PM -0800, Paul Novitski wrote: > For example, here's one using GET: > > href="switchboard.php?something=123456&dest=contact.php">Contact Us Ampersands followed by non-name characters must be represented by entities. > Here's one using POST: > >
Forms use GET by default. > Strict varients of (X)HTML (which I hope we are all using) require child elements of forms to be block level (although they can hold inline elements, such as form controls, in turn). ... but lets avoid XHTML for the most part. In the majority of cases, its a lot of trouble for no benefit, and is usually done wrong. -- David Dorward http://dorward.me.uk From paul at juniperwebcraft.com Tue Jan 2 16:24:02 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Tue, 02 Jan 2007 14:24:02 -0800 Subject: [Javascript] Javascript detection In-Reply-To: <20070102214020.GI29387@us-lot.org> References: <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> <7.0.1.0.2.20070102124759.02276e20@juniperwebcraft.com> <20070102214020.GI29387@us-lot.org> Message-ID: <7.0.1.0.2.20070102135435.02286b98@juniperwebcraft.com> At 1/2/2007 01:40 PM, David Dorward wrote: > > href="switchboard.php?something=123456&dest=contact.php">Contact Us > >Ampersands followed by non-name characters must be represented by >entities. ... > > > >Forms use GET by default. ... > > > >Strict varients of (X)HTML (which I hope we are all using) require >child elements of forms to be block level I appreciate your vigilance, David. Actually I was deliberately omitting everything but the bare essentials necessary to demonstrate my points in order to provide clear examples, presenting a kind of pseudocode and not complete, validatable markup. I probably should have appended that caveat. >... but lets avoid XHTML for the most part. In the majority of cases, >its a lot of trouble for no benefit, and is usually done wrong. Unless I'm misunderstanding, I disagree with this point. I don't find the rule-set of XHTML-Strict to be at all onerous; in fact its very strictness and consistency provides a lack of ambiguity I'm quite comfortable with. More to your point, though, I'm one of those ne'er-do-wells who's been serving up XHTML as text/html to accommodate IE. I use XHTML-Strict because a) it's the future and b) it works, even served with the text/html content-type and no xml prolog, very consistently in my target browsers and c) heck, I already shifted from HTML to XHTML and I don't want to have to get back into those old habits for another year or two just to have to switch back again. I hope it gets me a lighter sentence that I promise to serve it up as xml as soon as an XHTML-compatible IE version gains sufficient market share. This is off-topic here but I'd be open to arguments to the contrary off-list or in one of the other lists we're both members of. Warm regards, Paul From david at dorward.me.uk Tue Jan 2 16:40:10 2007 From: david at dorward.me.uk (David Dorward) Date: Tue, 2 Jan 2007 22:40:10 +0000 Subject: [Javascript] Javascript detection In-Reply-To: <7.0.1.0.2.20070102135435.02286b98@juniperwebcraft.com> References: <20070102013722.GD29387@us-lot.org> <22194B3C-4BDD-4F73-851E-22B922337E4E@nickfitz.co.uk> <7.0.1.0.2.20070102094111.02287720@juniperwebcraft.com> <7.0.1.0.2.20070102124759.02276e20@juniperwebcraft.com> <20070102214020.GI29387@us-lot.org> <7.0.1.0.2.20070102135435.02286b98@juniperwebcraft.com> Message-ID: <20070102224010.GJ29387@us-lot.org> On Tue, Jan 02, 2007 at 02:24:02PM -0800, Paul Novitski wrote: > >... but lets avoid XHTML for the most part. In the majority of cases, > >its a lot of trouble for no benefit, and is usually done wrong. > > Unless I'm misunderstanding, I disagree with this point. I don't > find the rule-set of XHTML-Strict to be at all onerous; The pain comes mostly from Appendix C (and that XHTML as text/html depends on browsers getting HTML wrong in the first place (even though most do)). > I use XHTML-Strict because a) it's the future Can I borrow your time machine? > I hope it gets me a lighter sentence that I promise to serve it up > as xml as soon as an XHTML-compatible IE version gains sufficient > market share. So you cut out support for the segment of the market that is still using non-XML browsers, for what benefit? > This is off-topic here To bring things back on topic, there is also the issue of Firefox often requiring hefty rewrites of JavaScript for use in XHTML, since you need to use namespace aware DOM methods, and avoid document.write(). -- David Dorward http://dorward.me.uk From pp.koch at gmail.com Tue Jan 2 19:00:27 2007 From: pp.koch at gmail.com (Peter-Paul Koch) Date: Wed, 3 Jan 2007 02:00:27 +0100 Subject: [Javascript] Javascript detection In-Reply-To: References: <20070101230608.GA29387@us-lot.org> <20070101234112.GB29387@us-lot.org> <20070102013722.GD29387@us-lot.org> Message-ID: <21e4a1280701021700u60cbbaa3nc632a116d0fc7f5d@mail.gmail.com> Nice idea, but in general I share the criticism that it's somewhat too complicated. If I want the server to know whether JavaScript is enabled, I always use a hidden form field. I set its value to "no" in the HTML, and a JavaScript (which can be extended by as many object detects as you like) changes the value to "yes". The value of the hidden field is sent back to the server, and JavaScript is decisively detected without any possible error. > David et al: > > To explain what I'm trying to do is probably too complicated for my > limited communication skills. > > The original post that started me on this investigation was simply > "How does one take the value of a javascript variable and carry it > forward to the next page?" However, no one was able to provide an > answer, other than using cookies and I don't want to do that. > However, I believe that it can be done otherwise and that's what I am > trying to accomplish. > > What I am doing is not essential to the operation of my web page and > if javascript is not enabled, then the enhancement is not realized > nor needed -- thus satisfying "progressive enhancement" requirement. > So, we should not address that topic any further. > > My first step in this investigation is to determine if javascript is > enabled in the user's browser -- the following is my methodology. > > 1. The user is directed to this url: http://sperling.com/js_detect > > The "js_detect" is a folder containing [1] (index.php) the default > file, the code is listed below. As you can see, this [1] (index.php): > a) starts a php session [js]; b) loads a javascript named [2] > (is_js.js); c) makes the current index.php page refresh to > "index1.php" after one second; d) and note, the index.php page has no > visible content -- thus, the user doesn't see anything. > > 2. Now, javascript [2] (is_js.js) simply executes "a.php" script > after an onload event and passes the js variable to "a.php" via a > javascript POST operation -- IF -- javascript is enabled. > > 3. The [3] (a.php) simply takes a javascript POST and sets a php > session js variable. Actually the else portion of the code is never > executed for this would never be called is javascript wasn't enabled. > I only present it for clarification. > > 4. The [4] (index1.php) simply displays the php session variable js. > > Now, I don't fully understand why I have conflicting reports. Some > people have the identical browser and OS combinations and report that > it both works and doesn't work. > > And, I don't understand why browsers running on LINUX and Opera on > Windows machines fool the script. A more complete accounting is here: > > http://www.browsercam.com/public.aspx?proj_id=311334 > > In any event, the technique works for most browsers and OS's. > > Thanks for your review and comment. > > tedd > > --- code follows --- > > [1] --- index.php > ------------------------------------------------------------------ > > > if (!isset($_SESSION['js'])) > { > $_SESSION['js'] = 0; > } > ?> > > > > ? > > > > > > > > --- end of index.php > -------------------------------------------------------------------- > > [2]--- is_js.js ----(Thanks to Matt for the idea given a week > ago)--------------- > > function is_js() > { > (new Image()).src = 'a.php?js=1'; > } > window.onload = is_js; > > --- end of is_js.js > -------------------------------------------------------------------- > > > > [3] --- a.php > ----------------------------------------------------------------------- > > > if (isset($_GET['js'])) > { > $js = 1; > } > else > { > $js = 0; > } > $_SESSION['js'] = $js; > ?> > > --- end of a.php > --------------------------------------------------------------------- > > [4] --- index1.php > ------------------------------------------------------------------------ > > if (!isset($_SESSION['js'])) > { > $_SESSION['js'] = 0; > } > ?> > "http://www.w3.org/TR/html4/strict.dtd"> > > > Stuff by tedd > > > >

> Javascript has not'; } ?> been > detected on the client. >

> > > > --- end of index1.php > --------------------------------------------------------------------- > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -- ------------------------------------------------------------------- ppk, freelance web developer http://www.quirksmode.org/ ------------------------------------------------------------------ From wonsil at 4m-ent.com Wed Jan 3 07:02:02 2007 From: wonsil at 4m-ent.com (Mark Wonsil) Date: Wed, 3 Jan 2007 08:02:02 -0500 Subject: [Javascript] Strictly speaking (Was Javascript Detection) Message-ID: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> Paul starts a mini-thread about XHTML strict to which David replies: > To bring things back on topic, there is also the issue of Firefox > often requiring hefty rewrites of JavaScript for use in XHTML, since > you need to use namespace aware DOM methods, and avoid > document.write(). While I have occasionally used document.write(), I've always thought it to be a "dirty" way to alter pages. It sure is easier than using DOM methods but does it not lend itself to creating errors of well-formedness and making subsequent changes to the page more difficult - especially in a growing AJAX world? Does document.write() have a place in a progressive enhancement environment? I'm just curious what others think. Mark W. From javascript at mattbarton.org Wed Jan 3 07:13:46 2007 From: javascript at mattbarton.org (Matt Barton) Date: Wed, 03 Jan 2007 13:13:46 +0000 Subject: [Javascript] Detecting ActiveX control Message-ID: <459BAC0A.8020703@mattbarton.org> Hi, I have a custom ActiveX control which is running in my intranet app (target browser is only Win IE5.5+). Is there any way for me to detect, in javascript, if the control is accessible by the browser? I find my users often have IE security settings which prevent the control from running, and this causes a javascript runtime error: "Object doesn't support this property or method". Any ideas? Matt From mdougherty at pbp.com Wed Jan 3 07:36:42 2007 From: mdougherty at pbp.com (Mike Dougherty) Date: Wed, 03 Jan 2007 08:36:42 -0500 Subject: [Javascript] Detecting ActiveX control In-Reply-To: <459BAC0A.8020703@mattbarton.org> References: <459BAC0A.8020703@mattbarton.org> Message-ID: On Wed, 03 Jan 2007 13:13:46 +0000 Matt Barton wrote: > I have a custom ActiveX control which is running in my intranet app (target browser is only Win >IE5.5+). > > Is there any way for me to detect, in javascript, if the control is accessible by the browser? > > I find my users often have IE security settings which prevent the control from running, and this >causes a javascript runtime error: "Object doesn't support this property or method". try { var myobj = (your object); } catch(e){ //appropriate error response } From javascript at mattbarton.org Wed Jan 3 07:42:37 2007 From: javascript at mattbarton.org (Matt Barton) Date: Wed, 03 Jan 2007 13:42:37 +0000 Subject: [Javascript] Detecting ActiveX control In-Reply-To: References: <459BAC0A.8020703@mattbarton.org> Message-ID: <459BB2CD.3090007@mattbarton.org> Many thanks, I'll give it a spin. Mike Dougherty wrote: > On Wed, 03 Jan 2007 13:13:46 +0000 > Matt Barton wrote: >> I have a custom ActiveX control which is running in my intranet app >> (target browser is only Win IE5.5+). >> >> Is there any way for me to detect, in javascript, if the control is >> accessible by the browser? >> >> I find my users often have IE security settings which prevent the >> control from running, and this causes a javascript runtime error: >> "Object doesn't support this property or method". > > try { > var myobj = (your object); > } > catch(e){ > //appropriate error response > } From mwarden at gmail.com Wed Jan 3 08:31:11 2007 From: mwarden at gmail.com (Matt Warden) Date: Wed, 3 Jan 2007 09:31:11 -0500 Subject: [Javascript] Strictly speaking (Was Javascript Detection) In-Reply-To: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> Message-ID: On 1/3/07, Mark Wonsil wrote: > While I have occasionally used document.write(), I've always thought it to be > a "dirty" way to alter pages. It sure is easier than using DOM methods but > does it not lend itself to creating errors of well-formedness and making > subsequent changes to the page more difficult - especially in a growing AJAX > world? Does document.write() have a place in a progressive enhancement > environment? > > I'm just curious what others think. They'll tell you "no", and then they'll turn around and tell you that innerHTML is fine. I find DOM manipulations to be elegant, once you wrap your ahead around the fact that this is *not* markup anymore, but rather an active document, represented by a tree structure. -- Matt Warden Cleveland, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From javascript at webdesignofficina.com Wed Jan 3 11:04:36 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Wed, 03 Jan 2007 18:04:36 +0100 Subject: [Javascript] Keypress and a name jump Message-ID: <459BE224.5070007@webdesignofficina.com> Hi folks and happy new year to everybody... I'm using the function below to detect a keypress and I'd like also when this key is pressed to jump to a in my document... How do I add this feature to the code below ? Thanks. Guillaume. function getKey(e){ if (e == null) { // ie keycode = event.keyCode; } else { // mozilla keycode = e.which; } key = String.fromCharCode(keycode).toLowerCase(); if(key == 't'){ myFunction(); } return false; } } From paul at juniperwebcraft.com Wed Jan 3 12:51:30 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Wed, 03 Jan 2007 10:51:30 -0800 Subject: [Javascript] Strictly speaking (Was Javascript Detection) In-Reply-To: References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> Message-ID: <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> At 1/3/2007 06:31 AM, Matt Warden wrote: >I find DOM manipulations to be elegant, once you wrap your ahead >around the fact that this is *not* markup anymore, but rather an >active document, represented by a tree structure. I've always considered document.write() to be sloppy, DOM-less coding, however the manual does say: "The text you write is parsed into the document's structure model. In the example above, the h1 element becomes a node in the document." http://developer.mozilla.org/en/docs/DOM:document.write This means that document.write() [according to the book] plays nicely with the DOM and doesn't dodge around it. The onus is on the programmer to feed it well-formed HTML, but then of course that's always the case. The extent to which it's cross-browser-compatible is another question. I don't anticipate using document.write() in my own work (if only because I use XHTML), but strictly speaking I suppose it isn't any more egregious than using pre-written HTML template chunks to assemble pages server-side. Paul From mwarden at gmail.com Wed Jan 3 13:05:47 2007 From: mwarden at gmail.com (Matt Warden) Date: Wed, 3 Jan 2007 14:05:47 -0500 Subject: [Javascript] Strictly speaking (Was Javascript Detection) In-Reply-To: <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> Message-ID: On 1/3/07, Paul Novitski wrote: > At 1/3/2007 06:31 AM, Matt Warden wrote: > >I find DOM manipulations to be elegant, once you wrap your ahead > >around the fact that this is *not* markup anymore, but rather an > >active document, represented by a tree structure. > > I've always considered document.write() to be sloppy, DOM-less > coding, however the manual does say: > > "The text you write is parsed into the document's structure model. In > the example above, the h1 element becomes a node in the document." > http://developer.mozilla.org/en/docs/DOM:document.write I'm not sure how else it would work. I can't think through my head how the markup itself could just be inserted as a text node but somehow still function as part of the document. > This means that document.write() [according to the book] plays nicely > with the DOM and doesn't dodge around it. The onus is on the > programmer to feed it well-formed HTML, but then of course that's > always the case. The point is more that HTML is just one serialization of a document. Once the markup is unserialized back into a document tree, it doesn't make sense to manipulate it with arguments that are serialized. It's really just the developer being lazy and avoiding the need to think about the document as a tree and not text/markup, which goes back to my original point. Not to mention that your javascript must be aware of how the document is serialized in the first place. -- Matt Warden Cleveland, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From riegel at clearimageonline.com Wed Jan 3 13:08:47 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Wed, 3 Jan 2007 14:08:47 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> Message-ID: Hello, I have an application that uses frames. I would like to set one frame to monitor what is going on in the other and turn a spinner on when it unloads, and turn it off when it loads. any quick thoughts on how I should proceed. Terry From riegel at clearimageonline.com Wed Jan 3 13:32:39 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Wed, 3 Jan 2007 14:32:39 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> Message-ID: This is what I have that fires sometimes. top.frames['details'].window.onload=top.frames['browse'].a; top.frames['details'].window.onunload=top.frames['browse'].b; My js library loads in the browse frame, and the a function turns the spinner off, the b turns it on. Terry On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: > Hello, > > I have an application that uses frames. I would like to set one > frame to monitor what is going on in the other and turn a spinner > on when it unloads, and turn it off when it loads. any quick > thoughts on how I should proceed. > > Terry > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From nick at nickfitz.co.uk Wed Jan 3 14:06:57 2007 From: nick at nickfitz.co.uk (Nick Fitzsimons) Date: Wed, 3 Jan 2007 20:06:57 +0000 Subject: [Javascript] Strictly speaking (Was Javascript Detection) In-Reply-To: References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> Message-ID: On 3 Jan 2007, at 19:05:47, Matt Warden wrote: > On 1/3/07, Paul Novitski wrote: >> At 1/3/2007 06:31 AM, Matt Warden wrote: >> >I find DOM manipulations to be elegant, once you wrap your ahead >> >around the fact that this is *not* markup anymore, but rather an >> >active document, represented by a tree structure. >> >> I've always considered document.write() to be sloppy, DOM-less >> coding, however the manual does say: >> >> "The text you write is parsed into the document's structure model. In >> the example above, the h1 element becomes a node in the document." >> http://developer.mozilla.org/en/docs/DOM:document.write > > I'm not sure how else it would work. I can't think through my head how > the markup itself could just be inserted as a text node but somehow > still function as part of the document. > I recently did a number of tests focused on this very issue (in relation to the WaSP's DSTF's invitation to assist the IE Team in prioritising DOM fixes for IE.next), and the conclusion I came to was that the string assigned to the innerHTML property is indeed passed through the HTML parser, at least on IE (and I assume on all browsers). I was able to prove this by triggering certain bugs in IE's parser when inserting supposedly-valid markup. One interesting side effect of this is that someElement.innerHTML = someMarkup; insertedMarkup = someElement.innerHTML; return insertedMarkup == someMarkup; doesn't necessarily return true; indeed, doing a more accurate comparison by walking the resultant DOM tree, allowing for things like capitalisation of tag names and attributes being unordered, will reveal that the DOM created by the parser won't necessarily be the same as if the equivalent DOM creation and manipulation methods are used. I'm still getting the results of the tests (which also cover assorted DOM oddities which modify the parser's behaviour on subsequent insertions of the same markup) written up, and will post a link when ready, for those who are interested. Regards, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ From riegel at clearimageonline.com Thu Jan 4 09:32:31 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Thu, 4 Jan 2007 10:32:31 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> Message-ID: <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> It may not be possible, but I am looking for a way to trigger an event everytime a web connection starts, then another event when it finishes. I have a Frames based page like... +---------------------------+ |buttons * | +---------------------------+ |path | +-------+-------------------+ |browse |details | | | | | | | | | | +-------+-------------------+ I am trying to figure out how to have "buttons" monitor activity on "details" when a page is requested turn on the spinner, when it is loaded turn off the spinner. Onload and onunload do not seem to be consistent for this. The content in details is from the same domain as all of the other pages, but will not be managed by this, so adding js to this page will not work. Any Ideas? Terry On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: > This is what I have that fires sometimes. > > top.frames['details'].window.onload=top.frames['browse'].a; > top.frames['details'].window.onunload=top.frames['browse'].b; > > My js library loads in the browse frame, and the a function turns > the spinner off, the b turns it on. > > Terry > > > On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: > >> Hello, >> >> I have an application that uses frames. I would like to set one >> frame to monitor what is going on in the other and turn a spinner >> on when it unloads, and turn it off when it loads. any quick >> thoughts on how I should proceed. >> >> Terry >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From riegel at clearimageonline.com Thu Jan 4 22:07:17 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Thu, 4 Jan 2007 23:07:17 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> Message-ID: <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> Well, no use beating a dead horse. I am guessing this problem is not doable? I for one have spent way to much time on it. Thanks, Terry On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: > It may not be possible, but I am looking for a way to trigger an > event everytime a web connection starts, then another event when it > finishes. > > I have a Frames based page like... > > +---------------------------+ > |buttons * | > +---------------------------+ > |path | > +-------+-------------------+ > |browse |details | > | | | > | | | > | | | > +-------+-------------------+ > > I am trying to figure out how to have "buttons" monitor activity on > "details" when a page is requested turn on the spinner, when it is > loaded turn off the spinner. Onload and onunload do not seem to be > consistent for this. The content in details is from the same domain > as all of the other pages, but will not be managed by this, so > adding js to this page will not work. > > Any Ideas? > > > Terry > > > > On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: > >> This is what I have that fires sometimes. >> >> top.frames['details'].window.onload=top.frames['browse'].a; >> top.frames['details'].window.onunload=top.frames['browse'].b; >> >> My js library loads in the browse frame, and the a function turns >> the spinner off, the b turns it on. >> >> Terry >> >> >> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >> >>> Hello, >>> >>> I have an application that uses frames. I would like to set one >>> frame to monitor what is going on in the other and turn a spinner >>> on when it unloads, and turn it off when it loads. any quick >>> thoughts on how I should proceed. >>> >>> Terry >>> _______________________________________________ >>> Javascript mailing list >>> Javascript at LaTech.edu >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From java.script at cutterscrossing.com Fri Jan 5 05:41:40 2007 From: java.script at cutterscrossing.com (Cutter (JS Related)) Date: Fri, 05 Jan 2007 05:41:40 -0600 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> Message-ID: <459E3974.9020404@cutterscrossing.com> http://www.ajaxload.info/ Cutter _____________________ http://blog.cutterscrossing.com Terry Riegel wrote: > Well, no use beating a dead horse. I am guessing this problem is not > doable? I for one have spent way to much time on it. > > Thanks, > > Terry > > > On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: > >> It may not be possible, but I am looking for a way to trigger an event >> everytime a web connection starts, then another event when it finishes. >> >> I have a Frames based page like... >> >> +---------------------------+ >> |buttons * | >> +---------------------------+ >> |path | >> +-------+-------------------+ >> |browse |details | >> | | | >> | | | >> | | | >> +-------+-------------------+ >> >> I am trying to figure out how to have "buttons" monitor activity on >> "details" when a page is requested turn on the spinner, when it is >> loaded turn off the spinner. Onload and onunload do not seem to be >> consistent for this. The content in details is from the same domain as >> all of the other pages, but will not be managed by this, so adding js >> to this page will not work. >> >> Any Ideas? >> >> >> Terry >> >> >> >> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: >> >>> This is what I have that fires sometimes. >>> >>> top.frames['details'].window.onload=top.frames['browse'].a; >>> top.frames['details'].window.onunload=top.frames['browse'].b; >>> >>> My js library loads in the browse frame, and the a function turns the >>> spinner off, the b turns it on. >>> >>> Terry >>> >>> >>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >>> >>>> Hello, >>>> >>>> I have an application that uses frames. I would like to set one >>>> frame to monitor what is going on in the other and turn a spinner on >>>> when it unloads, and turn it off when it loads. any quick thoughts >>>> on how I should proceed. >>>> >>>> Terry >>>> _______________________________________________ >>>> Javascript mailing list >>>> Javascript at LaTech.edu >>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>> >>> _______________________________________________ >>> Javascript mailing list >>> Javascript at LaTech.edu >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript -- Cutter ____________ http://blog.cutterscrossing.com "The Past is a Memory The Future a Dream But Today is a Gift That's why they call it The Present" From riegel at clearimageonline.com Fri Jan 5 07:32:40 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Fri, 5 Jan 2007 08:32:40 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <459E3974.9020404@cutterscrossing.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> <459E3974.9020404@cutterscrossing.com> Message-ID: <40FAB93E-09F1-40BE-B8C9-5D490FBB307E@clearimageonline.com> Cutter, I'm not sure what the url you sent is for. It appears to be a service for creating spinners. Terry On Jan 5, 2007, at 6:41 AM, Cutter (JS Related) wrote: > http://www.ajaxload.info/ > > Cutter > _____________________ > http://blog.cutterscrossing.com > > Terry Riegel wrote: >> Well, no use beating a dead horse. I am guessing this problem is >> not doable? I for one have spent way to much time on it. >> Thanks, >> Terry >> On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: >>> It may not be possible, but I am looking for a way to trigger an >>> event everytime a web connection starts, then another event when >>> it finishes. >>> >>> I have a Frames based page like... >>> >>> +---------------------------+ >>> |buttons * | >>> +---------------------------+ >>> |path | >>> +-------+-------------------+ >>> |browse |details | >>> | | | >>> | | | >>> | | | >>> +-------+-------------------+ >>> >>> I am trying to figure out how to have "buttons" monitor activity >>> on "details" when a page is requested turn on the spinner, when >>> it is loaded turn off the spinner. Onload and onunload do not >>> seem to be consistent for this. The content in details is from >>> the same domain as all of the other pages, but will not be >>> managed by this, so adding js to this page will not work. >>> >>> Any Ideas? >>> >>> >>> Terry >>> >>> >>> >>> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: >>> >>>> This is what I have that fires sometimes. >>>> >>>> top.frames['details'].window.onload=top.frames['browse'].a; >>>> top.frames['details'].window.onunload=top.frames['browse'].b; >>>> >>>> My js library loads in the browse frame, and the a function >>>> turns the spinner off, the b turns it on. >>>> >>>> Terry >>>> >>>> >>>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >>>> >>>>> Hello, >>>>> >>>>> I have an application that uses frames. I would like to set one >>>>> frame to monitor what is going on in the other and turn a >>>>> spinner on when it unloads, and turn it off when it loads. any >>>>> quick thoughts on how I should proceed. >>>>> >>>>> Terry >>>>> _______________________________________________ >>>>> Javascript mailing list >>>>> Javascript at LaTech.edu >>>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>>> >>>> _______________________________________________ >>>> Javascript mailing list >>>> Javascript at LaTech.edu >>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>> >>> _______________________________________________ >>> Javascript mailing list >>> Javascript at LaTech.edu >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > -- > > Cutter > ____________ > http://blog.cutterscrossing.com > > "The Past is a Memory > The Future a Dream > But Today is a Gift > That's why they call it > The Present" > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From toby at kidstimetogo.com Fri Jan 5 08:18:20 2007 From: toby at kidstimetogo.com (Tobias Parent) Date: Fri, 05 Jan 2007 09:18:20 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <459E3974.9020404@cutterscrossing.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> <459E3974.9020404@cutterscrossing.com> Message-ID: <459E5E2C.2030201@kidstimetogo.com> Actually, this may not be as painful as I thought, although it IS kludgy. Back about nine years ago, I'd done something similar - a page with four frames, one of which was simply a status list. What happens is, the frame you want to do the 'listening' (the one to be affected by the onLoad and onUnLoad), simply listens to a variable set in the parent frame (the first common parent to both frames). The frame to be listened to sets the variable as needed, so onLoad sets it to 'Complete', while onUnload sets it to 'Updating...'. This is just a concept, no proof to back it. Thought this through in the shower, and it seems workable. Sort of a modification of the 'Observer' pattern, somewhat. Regards! -Toby Parent http://www.tobytheballoonguy.com/ > Terry Riegel wrote: >> Well, no use beating a dead horse. I am guessing this problem is not >> doable? I for one have spent way to much time on it. >> >> Thanks, >> >> Terry >> >> >> On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: >> >>> It may not be possible, but I am looking for a way to trigger an >>> event everytime a web connection starts, then another event when it >>> finishes. >>> >>> I have a Frames based page like... >>> >>> +---------------------------+ >>> |buttons * | >>> +---------------------------+ >>> |path | >>> +-------+-------------------+ >>> |browse |details | >>> | | | >>> | | | >>> | | | >>> +-------+-------------------+ >>> >>> I am trying to figure out how to have "buttons" monitor activity on >>> "details" when a page is requested turn on the spinner, when it is >>> loaded turn off the spinner. Onload and onunload do not seem to be >>> consistent for this. The content in details is from the same domain >>> as all of the other pages, but will not be managed by this, so >>> adding js to this page will not work. >>> >>> Any Ideas? >>> >>> >>> Terry >>> >>> >>> >>> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: >>> >>>> This is what I have that fires sometimes. >>>> >>>> top.frames['details'].window.onload=top.frames['browse'].a; >>>> top.frames['details'].window.onunload=top.frames['browse'].b; >>>> >>>> My js library loads in the browse frame, and the a function turns >>>> the spinner off, the b turns it on. >>>> >>>> Terry >>>> >>>> >>>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >>>> >>>>> Hello, >>>>> >>>>> I have an application that uses frames. I would like to set one >>>>> frame to monitor what is going on in the other and turn a spinner >>>>> on when it unloads, and turn it off when it loads. any quick >>>>> thoughts on how I should proceed. >>>>> >>>>> Terry >>>>> _______________________________________________ >>>>> Javascript mailing list >>>>> Javascript at LaTech.edu >>>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>>> >>>> _______________________________________________ >>>> Javascript mailing list >>>> Javascript at LaTech.edu >>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>> >>> _______________________________________________ >>> Javascript mailing list >>> Javascript at LaTech.edu >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > From riegel at clearimageonline.com Fri Jan 5 08:21:40 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Fri, 5 Jan 2007 09:21:40 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> Message-ID: <45FE6090-C115-4E1B-A2E0-52234E65A11B@clearimageonline.com> After posting this last night I woke up and thought I am working in the wrong area. Instead of working on the individual frames to trigger the events I need to work on the actual Frame page. So I tried it this morning and was able to get it to work with the onload event. Here is what I did. The browse frame loads the javascript file, Since I have control over the activities that trigger the unload I can make the rest of my code without using the onunload trigger. Since the onload triggers every time regardless of what is in the frame I now have a working spinner that activates when a page is being requested, and deactivates when the page is loaded. On Jan 4, 2007, at 11:07 PM, Terry Riegel wrote: > Well, no use beating a dead horse. I am guessing this problem is > not doable? I for one have spent way to much time on it. > > Thanks, > > Terry > > > On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: > >> It may not be possible, but I am looking for a way to trigger an >> event everytime a web connection starts, then another event when >> it finishes. >> >> I have a Frames based page like... >> >> +---------------------------+ >> |buttons * | >> +---------------------------+ >> |path | >> +-------+-------------------+ >> |browse |details | >> | | | >> | | | >> | | | >> +-------+-------------------+ >> >> I am trying to figure out how to have "buttons" monitor activity >> on "details" when a page is requested turn on the spinner, when it >> is loaded turn off the spinner. Onload and onunload do not seem to >> be consistent for this. The content in details is from the same >> domain as all of the other pages, but will not be managed by this, >> so adding js to this page will not work. >> >> Any Ideas? >> >> >> Terry >> >> >> >> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: >> >>> This is what I have that fires sometimes. >>> >>> top.frames['details'].window.onload=top.frames['browse'].a; >>> top.frames['details'].window.onunload=top.frames['browse'].b; >>> >>> My js library loads in the browse frame, and the a function turns >>> the spinner off, the b turns it on. >>> >>> Terry >>> >>> >>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >>> >>>> Hello, >>>> >>>> I have an application that uses frames. I would like to set one >>>> frame to monitor what is going on in the other and turn a >>>> spinner on when it unloads, and turn it off when it loads. any >>>> quick thoughts on how I should proceed. >>>> >>>> Terry >>>> _______________________________________________ >>>> Javascript mailing list >>>> Javascript at LaTech.edu >>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>> >>> _______________________________________________ >>> Javascript mailing list >>> Javascript at LaTech.edu >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From riegel at clearimageonline.com Fri Jan 5 08:27:38 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Fri, 5 Jan 2007 09:27:38 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <459E5E2C.2030201@kidstimetogo.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> <459E3974.9020404@cutterscrossing.com> <459E5E2C.2030201@kidstimetogo.com> Message-ID: Tobias, Thanks for the response, but the problem is I do not know what is going to be displayed in the "listened to" frame and do not have control over its html (it is a filemanager). I do have a similar working solution for the pages I do control. The solution I posted a few minutes ago doesn't care what is in the "listened to" frame, it could be an html page or an image or anything. Basically my solution relies on the onload event as the onunload event doesn't seem to fire for a frameset. So I only have to control when I turn on the spinner. It will always be turned off when the content loads into the page. Thanks for the reply. Terry Riegel On Jan 5, 2007, at 9:18 AM, Tobias Parent wrote: > Actually, this may not be as painful as I thought, although it IS > kludgy. Back about nine years ago, I'd done something similar - a > page with four frames, one of which was simply a status list. What > happens is, the frame you want to do the 'listening' (the one to be > affected by the onLoad and onUnLoad), simply listens to a variable > set in the parent frame (the first common parent to both frames). > The frame to be listened to sets the variable as needed, so onLoad > sets it to 'Complete', while onUnload sets it to 'Updating...'. > This is just a concept, no proof to back it. Thought this through > in the shower, and it seems workable. Sort of a modification of the > 'Observer' pattern, somewhat. > > Regards! > -Toby Parent > http://www.tobytheballoonguy.com/ > >> Terry Riegel wrote: >>> Well, no use beating a dead horse. I am guessing this problem is >>> not doable? I for one have spent way to much time on it. >>> >>> Thanks, >>> >>> Terry >>> >>> >>> On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: >>> >>>> It may not be possible, but I am looking for a way to trigger an >>>> event everytime a web connection starts, then another event when >>>> it finishes. >>>> >>>> I have a Frames based page like... >>>> >>>> +---------------------------+ >>>> |buttons * | >>>> +---------------------------+ >>>> |path | >>>> +-------+-------------------+ >>>> |browse |details | >>>> | | | >>>> | | | >>>> | | | >>>> +-------+-------------------+ >>>> >>>> I am trying to figure out how to have "buttons" monitor activity >>>> on "details" when a page is requested turn on the spinner, when >>>> it is loaded turn off the spinner. Onload and onunload do not >>>> seem to be consistent for this. The content in details is from >>>> the same domain as all of the other pages, but will not be >>>> managed by this, so adding js to this page will not work. >>>> >>>> Any Ideas? >>>> >>>> >>>> Terry >>>> >>>> >>>> >>>> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: >>>> >>>>> This is what I have that fires sometimes. >>>>> >>>>> top.frames['details'].window.onload=top.frames['browse'].a; >>>>> top.frames['details'].window.onunload=top.frames['browse'].b; >>>>> >>>>> My js library loads in the browse frame, and the a function >>>>> turns the spinner off, the b turns it on. >>>>> >>>>> Terry >>>>> >>>>> >>>>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >>>>> >>>>>> Hello, >>>>>> >>>>>> I have an application that uses frames. I would like to set >>>>>> one frame to monitor what is going on in the other and turn a >>>>>> spinner on when it unloads, and turn it off when it loads. any >>>>>> quick thoughts on how I should proceed. >>>>>> >>>>>> Terry >>>>>> _______________________________________________ >>>>>> Javascript mailing list >>>>>> Javascript at LaTech.edu >>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>>>> >>>>> _______________________________________________ >>>>> Javascript mailing list >>>>> Javascript at LaTech.edu >>>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>>> >>>> _______________________________________________ >>>> Javascript mailing list >>>> Javascript at LaTech.edu >>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>> >>> _______________________________________________ >>> Javascript mailing list >>> Javascript at LaTech.edu >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From toby at kidstimetogo.com Fri Jan 5 07:20:29 2007 From: toby at kidstimetogo.com (Tobias Parent) Date: Fri, 05 Jan 2007 08:20:29 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> Message-ID: <459E509D.40908@kidstimetogo.com> Terry - Are you wed to the frames idea? Doing this with AJAX would be trivial, as an XMLHttp returns status codes, which you can use to trigger exactly what you're talking about. Regards! -Toby Terry Riegel wrote: > Well, no use beating a dead horse. I am guessing this problem is not > doable? I for one have spent way to much time on it. > > Thanks, > > Terry > > > On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: > >> It may not be possible, but I am looking for a way to trigger an >> event everytime a web connection starts, then another event when it >> finishes. >> >> I have a Frames based page like... >> >> +---------------------------+ >> |buttons * | >> +---------------------------+ >> |path | >> +-------+-------------------+ >> |browse |details | >> | | | >> | | | >> | | | >> +-------+-------------------+ >> >> I am trying to figure out how to have "buttons" monitor activity on >> "details" when a page is requested turn on the spinner, when it is >> loaded turn off the spinner. Onload and onunload do not seem to be >> consistent for this. The content in details is from the same domain >> as all of the other pages, but will not be managed by this, so adding >> js to this page will not work. >> >> Any Ideas? >> >> >> Terry >> >> >> >> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: >> >>> This is what I have that fires sometimes. >>> >>> top.frames['details'].window.onload=top.frames['browse'].a; >>> top.frames['details'].window.onunload=top.frames['browse'].b; >>> >>> My js library loads in the browse frame, and the a function turns >>> the spinner off, the b turns it on. >>> >>> Terry >>> >>> >>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >>> >>>> Hello, >>>> >>>> I have an application that uses frames. I would like to set one >>>> frame to monitor what is going on in the other and turn a spinner >>>> on when it unloads, and turn it off when it loads. any quick >>>> thoughts on how I should proceed. >>>> >>>> Terry >>>> _______________________________________________ >>>> Javascript mailing list >>>> Javascript at LaTech.edu >>>> https://lists.LaTech.edu/mailman/listinfo/javascript >>> >>> _______________________________________________ >>> Javascript mailing list >>> Javascript at LaTech.edu >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From javascript at webdesignofficina.com Fri Jan 5 11:03:59 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Fri, 05 Jan 2007 18:03:59 +0100 Subject: [Javascript] Keypress and a name jump Message-ID: <459E84FF.9070307@webdesignofficina.com> Sorry this is a recall... I feel realy sorry if this one is disturbing your inbox... I can't believe no one has an answer: I'm using the function below to detect a keypress and I'd like also when this key is pressed to jump to a in my document... Just as you would jump to a content when you click on a control over its html (it is a filemanager). I do have a similar > working solution for the pages I do control. > > The solution I posted a few minutes ago doesn't care what is in the > "listened to" frame, it could be an html page or an image or anything. > > Basically my solution relies on the onload event as the onunload > event doesn't seem to fire for a frameset. So I only have to control > when I turn on the spinner. It will always be turned off when the > content loads into the page. > > Thanks for the reply. > > > Terry Riegel > > > > On Jan 5, 2007, at 9:18 AM, Tobias Parent wrote: > > > Actually, this may not be as painful as I thought, although it IS > > kludgy. Back about nine years ago, I'd done something similar - a > > page with four frames, one of which was simply a status list. What > > happens is, the frame you want to do the 'listening' (the one to be > > affected by the onLoad and onUnLoad), simply listens to a variable > > set in the parent frame (the first common parent to both frames). > > The frame to be listened to sets the variable as needed, so onLoad > > sets it to 'Complete', while onUnload sets it to 'Updating...'. > > This is just a concept, no proof to back it. Thought this through > > in the shower, and it seems workable. Sort of a modification of the > > 'Observer' pattern, somewhat. > > > > Regards! > > -Toby Parent > > http://www.tobytheballoonguy.com/ > > > >> Terry Riegel wrote: > >>> Well, no use beating a dead horse. I am guessing this problem is > >>> not doable? I for one have spent way to much time on it. > >>> > >>> Thanks, > >>> > >>> Terry > >>> > >>> > >>> On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: > >>> > >>>> It may not be possible, but I am looking for a way to trigger an > >>>> event everytime a web connection starts, then another event when > >>>> it finishes. > >>>> > >>>> I have a Frames based page like... > >>>> > >>>> +---------------------------+ > >>>> |buttons * | > >>>> +---------------------------+ > >>>> |path | > >>>> +-------+-------------------+ > >>>> |browse |details | > >>>> | | | > >>>> | | | > >>>> | | | > >>>> +-------+-------------------+ > >>>> > >>>> I am trying to figure out how to have "buttons" monitor activity > >>>> on "details" when a page is requested turn on the spinner, when > >>>> it is loaded turn off the spinner. Onload and onunload do not > >>>> seem to be consistent for this. The content in details is from > >>>> the same domain as all of the other pages, but will not be > >>>> managed by this, so adding js to this page will not work. > >>>> > >>>> Any Ideas? > >>>> > >>>> > >>>> Terry > >>>> > >>>> > >>>> > >>>> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: > >>>> > >>>>> This is what I have that fires sometimes. > >>>>> > >>>>> top.frames['details'].window.onload=top.frames['browse'].a; > >>>>> top.frames['details'].window.onunload=top.frames['browse'].b; > >>>>> > >>>>> My js library loads in the browse frame, and the a function > >>>>> turns the spinner off, the b turns it on. > >>>>> > >>>>> Terry > >>>>> > >>>>> > >>>>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: > >>>>> > >>>>>> Hello, > >>>>>> > >>>>>> I have an application that uses frames. I would like to set > >>>>>> one frame to monitor what is going on in the other and turn a > >>>>>> spinner on when it unloads, and turn it off when it loads. any > >>>>>> quick thoughts on how I should proceed. > >>>>>> > >>>>>> Terry > >>>>>> _______________________________________________ > >>>>>> Javascript mailing list > >>>>>> Javascript at LaTech.edu > >>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript > >>>>> > >>>>> _______________________________________________ > >>>>> Javascript mailing list > >>>>> Javascript at LaTech.edu > >>>>> https://lists.LaTech.edu/mailman/listinfo/javascript > >>>> > >>>> _______________________________________________ > >>>> Javascript mailing list > >>>> Javascript at LaTech.edu > >>>> https://lists.LaTech.edu/mailman/listinfo/javascript > >>> > >>> _______________________________________________ > >>> Javascript mailing list > >>> Javascript at LaTech.edu > >>> https://lists.LaTech.edu/mailman/listinfo/javascript > >> > > > > _______________________________________________ > > Javascript mailing list > > Javascript at LaTech.edu > > https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick at nickfitz.co.uk Fri Jan 5 11:29:05 2007 From: nick at nickfitz.co.uk (Nick Fitzsimons) Date: Fri, 5 Jan 2007 17:29:05 +0000 Subject: [Javascript] Keypress and a name jump In-Reply-To: <459E84FF.9070307@webdesignofficina.com> References: <459E84FF.9070307@webdesignofficina.com> Message-ID: <49FFAF5B-600A-4747-9A70-7CD181904D5A@nickfitz.co.uk> On 5 Jan 2007, at 17:03:59, Guillaume wrote: > > I'm using the function below to detect a keypress and I'd like also > when this key is pressed to jump to a in my > document... > Just as you would jump to a content when you > click on a References: <459E84FF.9070307@webdesignofficina.com> <49FFAF5B-600A-4747-9A70-7CD181904D5A@nickfitz.co.uk> Message-ID: <3E967349-6F80-4313-9960-DD2E2A3034C5@nickfitz.co.uk> On 5 Jan 2007, at 17:29:05, Nick Fitzsimons wrote: > > if (key == "t") { self.location.href = "#thereUgo"; } > Oops, that should be if (key == "t") { self.location.hash = "thereUgo"; } Doh! -- Nick Fitzsimons http://www.nickfitz.co.uk/ From riegel at clearimageonline.com Fri Jan 5 12:28:39 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Fri, 5 Jan 2007 13:28:39 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <7cc847460701050918h79d05c47s3d3b934ecf874e34@mail.gmail.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> <459E3974.9020404@cutterscrossing.com> <459E5E2C.2030201@kidstimetogo.com> <7cc847460701050918h79d05c47s3d3b934ecf874e34@mail.gmail.com> Message-ID: <4277C90E-E51C-4849-8C94-988EEC14136A@clearimageonline.com> Aaron, Thanks for the idea. I had tried that earlier, the problem is the scr attribute doesn't change when the same page is being loaded again as is the case in my application. Terry On Jan 5, 2007, at 12:18 PM, Aaron Bassett wrote: > When you load a new page into the frame it should change the frames > src attribute. You can have a function that checked ever Xsecs to > see if the last known and current src are different. If they are > start spinner. > > Then on the load event change the last known to current and stop > the spinner. > > Might be another way of approaching it?? > > > > On 1/5/07, Terry Riegel wrote: > Tobias, > > Thanks for the response, but the problem is I do not know what is > going to be displayed in the "listened to" frame and do not have > control over its html (it is a filemanager). I do have a similar > working solution for the pages I do control. > > The solution I posted a few minutes ago doesn't care what is in the > "listened to" frame, it could be an html page or an image or anything. > > Basically my solution relies on the onload event as the onunload > event doesn't seem to fire for a frameset. So I only have to control > when I turn on the spinner. It will always be turned off when the > content loads into the page. > > Thanks for the reply. > > > Terry Riegel > > > > On Jan 5, 2007, at 9:18 AM, Tobias Parent wrote: > > > Actually, this may not be as painful as I thought, although it IS > > kludgy. Back about nine years ago, I'd done something similar - a > > page with four frames, one of which was simply a status list. What > > happens is, the frame you want to do the 'listening' (the one to be > > affected by the onLoad and onUnLoad), simply listens to a variable > > set in the parent frame (the first common parent to both frames). > > The frame to be listened to sets the variable as needed, so onLoad > > sets it to 'Complete', while onUnload sets it to 'Updating...'. > > This is just a concept, no proof to back it. Thought this through > > in the shower, and it seems workable. Sort of a modification of the > > 'Observer' pattern, somewhat. > > > > Regards! > > -Toby Parent > > http://www.tobytheballoonguy.com/ > > > >> Terry Riegel wrote: > >>> Well, no use beating a dead horse. I am guessing this problem is > >>> not doable? I for one have spent way to much time on it. > >>> > >>> Thanks, > >>> > >>> Terry > >>> > >>> > >>> On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: > >>> > >>>> It may not be possible, but I am looking for a way to trigger an > >>>> event everytime a web connection starts, then another event when > >>>> it finishes. > >>>> > >>>> I have a Frames based page like... > >>>> > >>>> +---------------------------+ > >>>> |buttons * | > >>>> +---------------------------+ > >>>> |path | > >>>> +-------+-------------------+ > >>>> |browse |details | > >>>> | | | > >>>> | | | > >>>> | | | > >>>> +-------+-------------------+ > >>>> > >>>> I am trying to figure out how to have "buttons" monitor activity > >>>> on "details" when a page is requested turn on the spinner, when > >>>> it is loaded turn off the spinner. Onload and onunload do not > >>>> seem to be consistent for this. The content in details is from > >>>> the same domain as all of the other pages, but will not be > >>>> managed by this, so adding js to this page will not work. > >>>> > >>>> Any Ideas? > >>>> > >>>> > >>>> Terry > >>>> > >>>> > >>>> > >>>> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: > >>>> > >>>>> This is what I have that fires sometimes. > >>>>> > >>>>> top.frames['details'].window.onload=top.frames['browse'].a; > >>>>> top.frames['details'].window.onunload=top.frames['browse'].b; > >>>>> > >>>>> My js library loads in the browse frame, and the a function > >>>>> turns the spinner off, the b turns it on. > >>>>> > >>>>> Terry > >>>>> > >>>>> > >>>>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: > >>>>> > >>>>>> Hello, > >>>>>> > >>>>>> I have an application that uses frames. I would like to set > >>>>>> one frame to monitor what is going on in the other and turn a > >>>>>> spinner on when it unloads, and turn it off when it loads. any > >>>>>> quick thoughts on how I should proceed. > >>>>>> > >>>>>> Terry > >>>>>> _______________________________________________ > >>>>>> Javascript mailing list > >>>>>> Javascript at LaTech.edu > >>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript > >>>>> > >>>>> _______________________________________________ > >>>>> Javascript mailing list > >>>>> Javascript at LaTech.edu > >>>>> https://lists.LaTech.edu/mailman/listinfo/javascript > >>>> > >>>> _______________________________________________ > >>>> Javascript mailing list > >>>> Javascript at LaTech.edu > >>>> https://lists.LaTech.edu/mailman/listinfo/javascript > >>> > >>> _______________________________________________ > >>> Javascript mailing list > >>> Javascript at LaTech.edu > >>> https://lists.LaTech.edu/mailman/listinfo/javascript > >> > > > > _______________________________________________ > > Javascript mailing list > > Javascript at LaTech.edu > > https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript -------------- next part -------------- An HTML attachment was scrubbed... URL: From aaronbassett at gmail.com Fri Jan 5 12:37:33 2007 From: aaronbassett at gmail.com (Aaron Bassett) Date: Fri, 5 Jan 2007 18:37:33 +0000 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <4277C90E-E51C-4849-8C94-988EEC14136A@clearimageonline.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> <459E3974.9020404@cutterscrossing.com> <459E5E2C.2030201@kidstimetogo.com> <7cc847460701050918h79d05c47s3d3b934ecf874e34@mail.gmail.com> <4277C90E-E51C-4849-8C94-988EEC14136A@clearimageonline.com> Message-ID: <7cc847460701051037w7b3b85abj417955e731fbd7ec@mail.gmail.com> Could you attach a random query string variable to the end of the links? So even if it is the same page it will change the src like have 2 links to the same page but with a random variable such as mypage.php?rnd=3r09fj340f mypage.php?rnd=sdfojh30sd or are these links within the frame which you have no control over? The only other way that comes to mind atm is to use a server side proxy. All links actually point at the proxy and pass the correct link url in as a param. The proxy does a get on the param page and displays it in the frame. That way you could locate the proxy page on the same domain so javascript could interact with it and you could include additional code in the page to trigger functions in the page holding the frame? (long way round for a shortcut I know - lol!!) Aaron On 1/5/07, Terry Riegel wrote: > > Aaron, > Thanks for the idea. I had tried that earlier, the problem is the scr > attribute doesn't change when the same page is being loaded again as is the > case in my application. > > Terry > > > On Jan 5, 2007, at 12:18 PM, Aaron Bassett wrote: > > When you load a new page into the frame it should change the frames src > attribute. You can have a function that checked ever Xsecs to see if the > last known and current src are different. If they are start spinner. > > Then on the load event change the last known to current and stop the > spinner. > > Might be another way of approaching it?? > > > > On 1/5/07, Terry Riegel wrote: > > > > Tobias, > > > > Thanks for the response, but the problem is I do not know what is > > going to be displayed in the "listened to" frame and do not have > > control over its html (it is a filemanager). I do have a similar > > working solution for the pages I do control. > > > > The solution I posted a few minutes ago doesn't care what is in the > > "listened to" frame, it could be an html page or an image or anything. > > > > Basically my solution relies on the onload event as the onunload > > event doesn't seem to fire for a frameset. So I only have to control > > when I turn on the spinner. It will always be turned off when the > > content loads into the page. > > > > Thanks for the reply. > > > > > > Terry Riegel > > > > > > > > On Jan 5, 2007, at 9:18 AM, Tobias Parent wrote: > > > > > Actually, this may not be as painful as I thought, although it IS > > > kludgy. Back about nine years ago, I'd done something similar - a > > > page with four frames, one of which was simply a status list. What > > > happens is, the frame you want to do the 'listening' (the one to be > > > affected by the onLoad and onUnLoad), simply listens to a variable > > > set in the parent frame (the first common parent to both frames). > > > The frame to be listened to sets the variable as needed, so onLoad > > > sets it to 'Complete', while onUnload sets it to 'Updating...'. > > > This is just a concept, no proof to back it. Thought this through > > > in the shower, and it seems workable. Sort of a modification of the > > > 'Observer' pattern, somewhat. > > > > > > Regards! > > > -Toby Parent > > > http://www.tobytheballoonguy.com/ > > > > > >> Terry Riegel wrote: > > >>> Well, no use beating a dead horse. I am guessing this problem is > > >>> not doable? I for one have spent way to much time on it. > > >>> > > >>> Thanks, > > >>> > > >>> Terry > > >>> > > >>> > > >>> On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: > > >>> > > >>>> It may not be possible, but I am looking for a way to trigger an > > >>>> event everytime a web connection starts, then another event when > > >>>> it finishes. > > >>>> > > >>>> I have a Frames based page like... > > >>>> > > >>>> +---------------------------+ > > >>>> |buttons * | > > >>>> +---------------------------+ > > >>>> |path | > > >>>> +-------+-------------------+ > > >>>> |browse |details | > > >>>> | | | > > >>>> | | | > > >>>> | | | > > >>>> +-------+-------------------+ > > >>>> > > >>>> I am trying to figure out how to have "buttons" monitor activity > > >>>> on "details" when a page is requested turn on the spinner, when > > >>>> it is loaded turn off the spinner. Onload and onunload do not > > >>>> seem to be consistent for this. The content in details is from > > >>>> the same domain as all of the other pages, but will not be > > >>>> managed by this, so adding js to this page will not work. > > >>>> > > >>>> Any Ideas? > > >>>> > > >>>> > > >>>> Terry > > >>>> > > >>>> > > >>>> > > >>>> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: > > >>>> > > >>>>> This is what I have that fires sometimes. > > >>>>> > > >>>>> top.frames['details'].window.onload=top.frames['browse'].a; > > >>>>> top.frames['details'].window.onunload=top.frames['browse'].b; > > >>>>> > > >>>>> My js library loads in the browse frame, and the a function > > >>>>> turns the spinner off, the b turns it on. > > >>>>> > > >>>>> Terry > > >>>>> > > >>>>> > > >>>>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: > > >>>>> > > >>>>>> Hello, > > >>>>>> > > >>>>>> I have an application that uses frames. I would like to set > > >>>>>> one frame to monitor what is going on in the other and turn a > > >>>>>> spinner on when it unloads, and turn it off when it loads. any > > >>>>>> quick thoughts on how I should proceed. > > >>>>>> > > >>>>>> Terry > > >>>>>> _______________________________________________ > > >>>>>> Javascript mailing list > > >>>>>> Javascript at LaTech.edu > > >>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript > > >>>>> > > >>>>> _______________________________________________ > > >>>>> Javascript mailing list > > >>>>> Javascript at LaTech.edu > > >>>>> https://lists.LaTech.edu/mailman/listinfo/javascript > > >>>> > > >>>> _______________________________________________ > > >>>> Javascript mailing list > > >>>> Javascript at LaTech.edu > > >>>> https://lists.LaTech.edu/mailman/listinfo/javascript > > >>> > > >>> _______________________________________________ > > >>> Javascript mailing list > > >>> Javascript at LaTech.edu > > >>> https://lists.LaTech.edu/mailman/listinfo/javascript > > >> > > > > > > _______________________________________________ > > > Javascript mailing list > > > Javascript at LaTech.edu > > > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > _______________________________________________ > > Javascript mailing list > > Javascript at LaTech.edu > > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdougherty at pbp.com Fri Jan 5 12:41:29 2007 From: mdougherty at pbp.com (Mike Dougherty) Date: Fri, 05 Jan 2007 13:41:29 -0500 Subject: [Javascript] Keypress and a name jump In-Reply-To: <459E84FF.9070307@webdesignofficina.com> References: <459E84FF.9070307@webdesignofficina.com> Message-ID: if you have the anchor an id you could also do this (i think/untested) var obj = document.getElementById("jumptoId"); if (obj) { try{ obj.focus() } catch(e){ /* oops */ } } ok, it's not pretty but it is fairly defensive On Fri, 05 Jan 2007 18:03:59 +0100 Guillaume wrote: > Sorry this is a recall... I feel realy sorry if this one is disturbing your inbox... > > I can't believe no one has an answer: > > I'm using the function below to detect a keypress and I'd like also when this key is pressed to >jump to a in my document... > Just as you would jump to a content when you click on a href="#thereUgo>... Except that I try to do this with the keypress script below... > > Any ressource to point or solution to suggest ? > > Thanks. > > Guillaume. > > Here's the keypress script I use: > > > function getKey(e){ > > if (e == null) { // ie > > keycode = event.keyCode; > > } else { // mozilla > > keycode = e.which; > > } > > key = String.fromCharCode(keycode).toLowerCase(); > > > if(key == 't'){ myFunction(); } > > > return false; } > > } > From riegel at clearimageonline.com Fri Jan 5 13:10:41 2007 From: riegel at clearimageonline.com (Terry Riegel) Date: Fri, 5 Jan 2007 14:10:41 -0500 Subject: [Javascript] Onload and onunload spinner In-Reply-To: <7cc847460701051037w7b3b85abj417955e731fbd7ec@mail.gmail.com> References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <601D005B-0A27-4307-9B74-27DE1A35F286@clearimageonline.com> <7F9AC5E6-EFC4-4B8B-AC5B-B9BD84A40A21@clearimageonline.com> <459E3974.9020404@cutterscrossing.com> <459E5E2C.2030201@kidstimetogo.com> <7cc847460701050918h79d05c47s3d3b934ecf874e34@mail.gmail.com> <4277C90E-E51C-4849-8C94-988EEC14136A@clearimageonline.com> <7cc847460701051037w7b3b85abj417955e731fbd7ec@mail.gmail.com> Message-ID: Wow, that seems like a lot of work, but it does sound like a cool idea. I did fimally get it to work by placing the onload in the actual frames page instead of on the monitoring page Terry On Jan 5, 2007, at 1:37 PM, Aaron Bassett wrote: > Could you attach a random query string variable to the end of the > links? > So even if it is the same page it will change the src like have 2 > links to the same page but with a random variable such as > > mypage.php?rnd=3r09fj340f > mypage.php?rnd=sdfojh30sd > > or are these links within the frame which you have no control over? > > The only other way that comes to mind atm is to use a server side > proxy. All links actually point at the proxy and pass the correct > link url in as a param. The proxy does a get on the param page and > displays it in the frame. That way you could locate the proxy page > on the same domain so javascript could interact with it and you > could include additional code in the page to trigger functions in > the page holding the frame? (long way round for a shortcut I know - > lol!!) > > Aaron > > On 1/5/07, Terry Riegel wrote: > Aaron, > > Thanks for the idea. I had tried that earlier, the problem is the > scr attribute doesn't change when the same page is being loaded > again as is the case in my application. > > Terry > > > On Jan 5, 2007, at 12:18 PM, Aaron Bassett wrote: > >> When you load a new page into the frame it should change the >> frames src attribute. You can have a function that checked ever >> Xsecs to see if the last known and current src are different. If >> they are start spinner. >> >> Then on the load event change the last known to current and stop >> the spinner. >> >> Might be another way of approaching it?? >> >> >> >> On 1/5/07, Terry Riegel wrote: >> Tobias, >> >> Thanks for the response, but the problem is I do not know what is >> going to be displayed in the "listened to" frame and do not have >> control over its html (it is a filemanager). I do have a similar >> working solution for the pages I do control. >> >> The solution I posted a few minutes ago doesn't care what is in the >> "listened to" frame, it could be an html page or an image or >> anything. >> >> Basically my solution relies on the onload event as the onunload >> event doesn't seem to fire for a frameset. So I only have to control >> when I turn on the spinner. It will always be turned off when the >> content loads into the page. >> >> Thanks for the reply. >> >> >> Terry Riegel >> >> >> >> On Jan 5, 2007, at 9:18 AM, Tobias Parent wrote: >> >> > Actually, this may not be as painful as I thought, although it IS >> > kludgy. Back about nine years ago, I'd done something similar - a >> > page with four frames, one of which was simply a status list. What >> > happens is, the frame you want to do the 'listening' (the one to be >> > affected by the onLoad and onUnLoad), simply listens to a variable >> > set in the parent frame (the first common parent to both frames). >> > The frame to be listened to sets the variable as needed, so onLoad >> > sets it to 'Complete', while onUnload sets it to 'Updating...'. >> > This is just a concept, no proof to back it. Thought this through >> > in the shower, and it seems workable. Sort of a modification of the >> > 'Observer' pattern, somewhat. >> > >> > Regards! >> > -Toby Parent >> > http://www.tobytheballoonguy.com/ >> > >> >> Terry Riegel wrote: >> >>> Well, no use beating a dead horse. I am guessing this problem is >> >>> not doable? I for one have spent way to much time on it. >> >>> >> >>> Thanks, >> >>> >> >>> Terry >> >>> >> >>> >> >>> On Jan 4, 2007, at 10:32 AM, Terry Riegel wrote: >> >>> >> >>>> It may not be possible, but I am looking for a way to trigger an >> >>>> event everytime a web connection starts, then another event when >> >>>> it finishes. >> >>>> >> >>>> I have a Frames based page like... >> >>>> >> >>>> +---------------------------+ >> >>>> |buttons * | >> >>>> +---------------------------+ >> >>>> |path | >> >>>> +-------+-------------------+ >> >>>> |browse |details | >> >>>> | | | >> >>>> | | | >> >>>> | | | >> >>>> +-------+-------------------+ >> >>>> >> >>>> I am trying to figure out how to have "buttons" monitor activity >> >>>> on "details" when a page is requested turn on the spinner, when >> >>>> it is loaded turn off the spinner. Onload and onunload do not >> >>>> seem to be consistent for this. The content in details is from >> >>>> the same domain as all of the other pages, but will not be >> >>>> managed by this, so adding js to this page will not work. >> >>>> >> >>>> Any Ideas? >> >>>> >> >>>> >> >>>> Terry >> >>>> >> >>>> >> >>>> >> >>>> On Jan 3, 2007, at 2:32 PM, Terry Riegel wrote: >> >>>> >> >>>>> This is what I have that fires sometimes. >> >>>>> >> >>>>> top.frames['details'].window.onload=top.frames['browse'].a; >> >>>>> top.frames['details'].window.onunload=top.frames['browse'].b; >> >>>>> >> >>>>> My js library loads in the browse frame, and the a function >> >>>>> turns the spinner off, the b turns it on. >> >>>>> >> >>>>> Terry >> >>>>> >> >>>>> >> >>>>> On Jan 3, 2007, at 2:08 PM, Terry Riegel wrote: >> >>>>> >> >>>>>> Hello, >> >>>>>> >> >>>>>> I have an application that uses frames. I would like to set >> >>>>>> one frame to monitor what is going on in the other and turn a >> >>>>>> spinner on when it unloads, and turn it off when it loads. any >> >>>>>> quick thoughts on how I should proceed. >> >>>>>> >> >>>>>> Terry >> >>>>>> _______________________________________________ >> >>>>>> Javascript mailing list >> >>>>>> Javascript at LaTech.edu >> >>>>>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >>>>> >> >>>>> _______________________________________________ >> >>>>> Javascript mailing list >> >>>>> Javascript at LaTech.edu >> >>>>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >>>> >> >>>> _______________________________________________ >> >>>> Javascript mailing list >> >>>> Javascript at LaTech.edu >> >>>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >>> >> >>> _______________________________________________ >> >>> Javascript mailing list >> >>> Javascript at LaTech.edu >> >>> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> >> > >> > _______________________________________________ >> > Javascript mailing list >> > Javascript at LaTech.edu >> > https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript -------------- next part -------------- An HTML attachment was scrubbed... URL: From javascript at webdesignofficina.com Sat Jan 6 10:48:14 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Sat, 06 Jan 2007 17:48:14 +0100 Subject: [Javascript] Keypress and a name jump In-Reply-To: <3E967349-6F80-4313-9960-DD2E2A3034C5@nickfitz.co.uk> References: <459E84FF.9070307@webdesignofficina.com> <49FFAF5B-600A-4747-9A70-7CD181904D5A@nickfitz.co.uk> <3E967349-6F80-4313-9960-DD2E2A3034C5@nickfitz.co.uk> Message-ID: <459FD2CE.1010603@webdesignofficina.com> Nick that is working perfectly ( ff and Safari )... Not tested in Ie yet... Href produces something totaly different but interesting: keypressing switches url... Mike thanks for your answer... I did not test it as I have already several page templates, avoiding so to add ids manually... Anyway, thanks for the both of you... Regards. Guillaume > On 5 Jan 2007, at 17:29:05, Nick Fitzsimons wrote: > >> >> if (key == "t") { self.location.href = "#thereUgo"; } >> > > Oops, that should be > > if (key == "t") { self.location.hash = "thereUgo"; } > > Doh! > From h.danielsson at gmail.com Sat Jan 6 21:07:06 2007 From: h.danielsson at gmail.com (Henrik Danielsson) Date: Sun, 7 Jan 2007 04:07:06 +0100 Subject: [Javascript] Strictly speaking (Was Javascript Detection) In-Reply-To: References: <003d01c72f37$5e4315b0$6564a8c0@WONSILT42> <7.0.1.0.2.20070103101535.021b7b88@juniperwebcraft.com> Message-ID: <6b0ef8950701061907s664113ecj99d948a72d45cb45@mail.gmail.com> 2007/1/3, Nick Fitzsimons : > > On 3 Jan 2007, at 19:05:47, Matt Warden wrote: > > > On 1/3/07, Paul Novitski wrote: > >> At 1/3/2007 06:31 AM, Matt Warden wrote: > >> >I find DOM manipulations to be elegant, once you wrap your ahead > >> >around the fact that this is *not* markup anymore, but rather an > >> >active document, represented by a tree structure. > >> > >> I've always considered document.write() to be sloppy, DOM-less > >> coding, however the manual does say: > >> > >> "The text you write is parsed into the document's structure model. In > >> the example above, the h1 element becomes a node in the document." > >> http://developer.mozilla.org/en/docs/DOM:document.write > > > > I'm not sure how else it would work. I can't think through my head how > > the markup itself could just be inserted as a text node but somehow > > still function as part of the document. > > > > I recently did a number of tests focused on this very issue (in > relation to the WaSP's DSTF's invitation to assist the IE Team in > prioritising DOM fixes for IE.next), and the conclusion I came to was > that the string assigned to the innerHTML property is indeed passed > through the HTML parser, at least on IE (and I assume on all > browsers). I was able to prove this by triggering certain bugs in > IE's parser when inserting supposedly-valid markup. > > One interesting side effect of this is that > > someElement.innerHTML = someMarkup; > insertedMarkup = someElement.innerHTML; > return insertedMarkup == someMarkup; > > doesn't necessarily return true; indeed, doing a more accurate > comparison by walking the resultant DOM tree, allowing for things > like capitalisation of tag names and attributes being unordered, will > reveal that the DOM created by the parser won't necessarily be the > same as if the equivalent DOM creation and manipulation methods are > used. > > I'm still getting the results of the tests (which also cover assorted > DOM oddities which modify the parser's behaviour on subsequent > insertions of the same markup) written up, and will post a link when > ready, for those who are interested. > > Regards, > > Nick. > -- > Nick Fitzsimons > http://www.nickfitz.co.uk/ Hello all, I'm not a frequent writer on this list, but I do read a lot of what's said and this got me interested. I'm just wondering why there's ever been a doubt wether or not HTML inserted via either document.write() or .inner/outerHTML passes through the HTML parser? I thought that was obvious (atleast for .innerHTML) since whatever you assign to it is supposed to be interpreted as HTML, and what else than the browser's HTML would be used for that? And if it's parsed as HTML, why not insert it into the DOM tree? Figuring out that it works is easy since whatever (valid) HTML put in there is accessible via the DOM. It's also likely that the dynamically generated DOM would not be 100% equal to the DOM generated by static HTML since the browser would "consider" different contexts when parsing static vs inserted code. Some browsers also have a thing for "correcting" code by adding/removing/editing tags to fit their preferred profile, which is why reading back inserted code would not return the original serialization, but a modified version of it. Please note that I have no insight whatsoever into the inner workings of browsers, this is simply what I've observed and concluded while developing web-based applications. About the use of document.write() and .innerHTML... I prefer to stay away from document.write() for various reasons, but .innerHTML (and also outerHTML) does come in handy every now and then. Sometimes I might simply use it's because it's faster (during runtime) than the equivilent DOM methods, but that's a whole other discussion. I think .innerHTML will be around for quite a while, and probably document.write() too. They are also good when you need to test something fast, but for more things made to be released, DOM is the future. Regards, Henrik -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.arensmeier at nikehydraulics.se Mon Jan 8 04:34:17 2007 From: frank.arensmeier at nikehydraulics.se (Frank Arensmeier) Date: Mon, 8 Jan 2007 11:34:17 +0100 Subject: [Javascript] Strange margins with scriptaculous Message-ID: Hello. I apologize if my question is more related to CSS than it is to Javascript. Yesterday I updated one of my pages with some effects from the scriptaculous lib. Now, I have some strange problems when showing divs. When toggling an effect, some divs have a strange bottom margin. Have a look at: http://www.nikehydraulics.se/downloads/leaflets_gb.php Click on one of the categories e.g. "Automotive tools". When the div slides down, it has a really annoying margin at the bottom (the larger the content, the larger the bottom margin). When the div is expanded, the divs below are pushed into the correct positions. I might also say that I have noticed this behavior in Safari 2.0.4, Firefox 2 and Opera 9.02 (all Mac versions). MS Explorer 6 on PC works as aspected. Besides that, when "canceling" an effect by hitting the show/hide triangle once more, Safari (at least) will not push the divs below to the proper positions. Instead, divs below will overlap with the expanded div. The exact same page on my local testing machine, behaves ok. Hope you get what I mean. Any ideas? I was not able to get any hints on the scriptaculous site. /frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.arensmeier at nikehydraulics.se Mon Jan 8 04:48:54 2007 From: frank.arensmeier at nikehydraulics.se (Frank Arensmeier) Date: Mon, 8 Jan 2007 11:48:54 +0100 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: References: Message-ID: <4668CE42-0FAC-4944-B83A-88FA5402D037@nikehydraulics.se> Never mind. I found the reason. /frank 8 jan 2007 kl. 11.34 skrev Frank Arensmeier: > Hello. > > I apologize if my question is more related to CSS than it is to > Javascript. > > Yesterday I updated one of my pages with some effects from the > scriptaculous lib. Now, I have some strange problems when showing > divs. When toggling an effect, some divs have a strange bottom > margin. Have a look at: > > http://www.nikehydraulics.se/downloads/leaflets_gb.php > > Click on one of the categories e.g. "Automotive tools". When the > div slides down, it has a really annoying margin at the bottom (the > larger the content, the larger the bottom margin). When the div is > expanded, the divs below are pushed into the correct positions. I > might also say that I have noticed this behavior in Safari 2.0.4, > Firefox 2 and Opera 9.02 (all Mac versions). MS Explorer 6 on PC > works as aspected. > > Besides that, when "canceling" an effect by hitting the show/hide > triangle once more, Safari (at least) will not push the divs below > to the proper positions. Instead, divs below will overlap with the > expanded div. > > The exact same page on my local testing machine, behaves ok. > > Hope you get what I mean. > > Any ideas? I was not able to get any hints on the scriptaculous site. > > /frank > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript Frank Arensmeier ........................................................................ ........................ Marketing Support & Webmaster NIKE Hydraulics AB Box 1107 631 80 Eskilstuna Sweden phone +46 - (0)16 16 82 34 fax +46 - (0)16 13 93 16 frank.arensmeier at nikehydraulics.se www.nikehydraulics.se ........................................................................ ........................ -------------- next part -------------- An HTML attachment was scrubbed... URL: From john at jwarner.com Mon Jan 8 07:00:21 2007 From: john at jwarner.com (John Warner) Date: Mon, 8 Jan 2007 08:00:21 -0500 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: <4668CE42-0FAC-4944-B83A-88FA5402D037@nikehydraulics.se> Message-ID: <001201c73324$f4cbbaa0$4701a8c0@earth> Could you share with the archive in case this happens to someone else in the future? John Warner -----Original Message----- From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu] On Behalf Of Frank Arensmeier Sent: Monday, January 08, 2007 5:49 AM To: [JavaScript List] Subject: Re: [Javascript] Strange margins with scriptaculous Never mind. I found the reason. /frank 8 jan 2007 kl. 11.34 skrev Frank Arensmeier: Hello. I apologize if my question is more related to CSS than it is to Javascript. Yesterday I updated one of my pages with some effects from the scriptaculous lib. Now, I have some strange problems when showing divs. When toggling an effect, some divs have a strange bottom margin. Have a look at: http://www.nikehydraulics.se/downloads/leaflets_gb.php Click on one of the categories e.g. "Automotive tools". When the div slides down, it has a really annoying margin at the bottom (the larger the content, the larger the bottom margin). When the div is expanded, the divs below are pushed into the correct positions. I might also say that I have noticed this behavior in Safari 2.0.4, Firefox 2 and Opera 9.02 (all Mac versions). MS Explorer 6 on PC works as aspected. Besides that, when "canceling" an effect by hitting the show/hide triangle once more, Safari (at least) will not push the divs below to the proper positions. Instead, divs below will overlap with the expanded div. The exact same page on my local testing machine, behaves ok. Hope you get what I mean. Any ideas? I was not able to get any hints on the scriptaculous site. /frank _______________________________________________ Javascript mailing list Javascript at LaTech.edu https://lists.LaTech.edu/mailman/listinfo/javascript Frank Arensmeier ........................................................................ ........................ Marketing Support & Webmaster NIKE Hydraulics AB Box 1107 631 80 Eskilstuna Sweden phone +46 - (0)16 16 82 34 fax +46 - (0)16 13 93 16 frank.arensmeier at nikehydraulics.se www.nikehydraulics.se ........................................................................ ........................ -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.432 / Virus Database: 268.16.7/619 - Release Date: 1/7/2007 6:29 PM -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.arensmeier at nikehydraulics.se Mon Jan 8 08:59:56 2007 From: frank.arensmeier at nikehydraulics.se (Frank Arensmeier) Date: Mon, 8 Jan 2007 15:59:56 +0100 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: <001201c73324$f4cbbaa0$4701a8c0@earth> References: <001201c73324$f4cbbaa0$4701a8c0@earth> Message-ID: Well, actually, there was nothing wrong/wired with neither the divs, the script nor the CSS. When visiting the page from our Intranet, users are able to print the downloadable pdf docs directly from that page. This is done by hitting a little printer icon to the right form the download link. This icon is right floated. And it seems that the browsers mentioned have some difficulties to calculate the accurate hight of the div. Because I switched off this function on my test box, everything was as ok. Since I am the only one here using Safari, I thought it was no big deal (MS Explorer has no problems). Setting the bottom margin to -10px (icon is 10x10px) to the printer icon, fixed the "ghost" margin at the bottom - margin was 0px before. However, as mentioned before, there is still one more problem which I haven't found a solution for yet. Hitting the show/hide triangle when the div is not entirely expanded, the div content will overlap with the following div when sliding down again. Once more, I was able to observe this behaviour in Safari, Firefox and Opera only. MS Explorer - no problem. Those browsers do not seem to calculate the height for the entire div content but will keep the height for the partly expanded div. //frank 8 jan 2007 kl. 14.00 skrev John Warner: > Could you share with the archive in case this happens to someone > else in the future? > > > John Warner > -----Original Message----- > From: javascript-bounces at LaTech.edu [mailto:javascript- > bounces at LaTech.edu] On Behalf Of Frank Arensmeier > Sent: Monday, January 08, 2007 5:49 AM > To: [JavaScript List] > Subject: Re: [Javascript] Strange margins with scriptaculous > > Never mind. I found the reason. > > /frank > > 8 jan 2007 kl. 11.34 skrev Frank Arensmeier: > >> Hello. >> >> I apologize if my question is more related to CSS than it is to >> Javascript. >> >> Yesterday I updated one of my pages with some effects from the >> scriptaculous lib. Now, I have some strange problems when showing >> divs. When toggling an effect, some divs have a strange bottom >> margin. Have a look at: >> >> http://www.nikehydraulics.se/downloads/leaflets_gb.php >> >> Click on one of the categories e.g. "Automotive tools". When the >> div slides down, it has a really annoying margin at the bottom >> (the larger the content, the larger the bottom margin). When the >> div is expanded, the divs below are pushed into the correct >> positions. I might also say that I have noticed this behavior in >> Safari 2.0.4, Firefox 2 and Opera 9.02 (all Mac versions). MS >> Explorer 6 on PC works as aspected. >> >> Besides that, when "canceling" an effect by hitting the show/hide >> triangle once more, Safari (at least) will not push the divs below >> to the proper positions. Instead, divs below will overlap with the >> expanded div. >> >> The exact same page on my local testing machine, behaves ok. >> >> Hope you get what I mean. >> >> Any ideas? I was not able to get any hints on the scriptaculous site. >> >> /frank >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.432 / Virus Database: 268.16.7/619 - Release Date: > 1/7/2007 6:29 PM > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript -------------- next part -------------- An HTML attachment was scrubbed... URL: From tedd at sperling.com Mon Jan 8 09:35:03 2007 From: tedd at sperling.com (tedd) Date: Mon, 8 Jan 2007 10:35:03 -0500 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: References: Message-ID: At 11:34 AM +0100 1/8/07, Frank Arensmeier wrote: > >http://www.nikehydraulics.se/downloads/leaflets_gb.php > >Click on one of the categories e.g. "Automotive tools". When the div >slides down, it has a really annoying margin at the bottom (the >larger the content, the larger the bottom margin). When the div is >expanded, the divs below are pushed into the correct positions. I >might also say that I have noticed this behavior in Safari 2.0.4, >Firefox 2 and Opera 9.02 (all Mac versions). MS Explorer 6 on PC >works as aspected. > >Besides that, when "canceling" an effect by hitting the show/hide >triangle once more, Safari (at least) will not push the divs below >to the proper positions. Instead, divs below will overlap with the >expanded div. >Any ideas? I was not able to get any hints on the scriptaculous site. > >/frank frank: I run Mac OS 10.4.8 / Safari 2.0.4 and I don't see the problem you describe -- works good for me. But, you might check validation. Home is OK, but some of the other pages fail. tedd PS: Awesome site -- great work! -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From aaronbassett at gmail.com Mon Jan 8 11:31:27 2007 From: aaronbassett at gmail.com (Aaron Bassett) Date: Mon, 8 Jan 2007 17:31:27 +0000 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: References: Message-ID: <7cc847460701080931x729ddf13xb9e71f968f6bf6a7@mail.gmail.com> Just to let you know on FF2 win 2k it fails the CLAI (Click Like An Idiot) test. Any kind of rapid clicking (even a double click) breaks it, the content expands but the container doesn't, neither does the item below it move so you get a weird overlap. On 1/8/07, tedd wrote: > > At 11:34 AM +0100 1/8/07, Frank Arensmeier wrote: > > > > > http://www.nikehydraulics.se/downloads/leaflets_gb.php > > > >Click on one of the categories e.g. "Automotive tools". When the div > >slides down, it has a really annoying margin at the bottom (the > >larger the content, the larger the bottom margin). When the div is > >expanded, the divs below are pushed into the correct positions. I > >might also say that I have noticed this behavior in Safari 2.0.4, > >Firefox 2 and Opera 9.02 (all Mac versions). MS Explorer 6 on PC > >works as aspected. > > > >Besides that, when "canceling" an effect by hitting the show/hide > >triangle once more, Safari (at least) will not push the divs below > >to the proper positions. Instead, divs below will overlap with the > >expanded div. > >Any ideas? I was not able to get any hints on the scriptaculous site. > > > >/frank > > frank: > > I run Mac OS 10.4.8 / Safari 2.0.4 and I don't see the problem you > describe -- works good for me. But, you might check validation. Home > is OK, but some of the other pages fail. > > tedd > > PS: Awesome site -- great work! > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank.arensmeier at nikehydraulics.se Mon Jan 8 15:18:48 2007 From: frank.arensmeier at nikehydraulics.se (Frank Arensmeier) Date: Mon, 8 Jan 2007 22:18:48 +0100 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: <7cc847460701080931x729ddf13xb9e71f968f6bf6a7@mail.gmail.com> References: <7cc847460701080931x729ddf13xb9e71f968f6bf6a7@mail.gmail.com> Message-ID: <2B1DC719-B0A0-4AA4-A30E-C0FAE08FA33E@nikehydraulics.se> CLAI - thats what I ment. Weird, because Explorer (6 at least) does not seem to suffer from this problem. I think there must be a way to cancel an slide down effect. I read somewhere about the function .cancel(). I tried to assign the slide down effect like myEffect = new Effect.SlideDown(divId, {duration:1}); When hitting the show/hide image again I have a myEffect.cancel(); in my java script. But this does not seem to have the desired effect (=cancel and unset the current effect object). I will get back when I have a solution. /frank 8 jan 2007 kl. 18.31 skrev Aaron Bassett: > > Just to let you know on FF2 win 2k it fails the CLAI (Click Like An > Idiot) test. > Any kind of rapid clicking (even a double click) breaks it, the > content expands but the container doesn't, neither does the item > below it move so you get a weird overlap. > > > On 1/8/07, tedd wrote: > At 11:34 AM +0100 1/8/07, Frank Arensmeier wrote: > > > > http:// > www.nikehydraulics.se/downloads/leaflets_gb.php > > > >Click on one of the categories e.g. "Automotive tools". When the div > >slides down, it has a really annoying margin at the bottom (the > >larger the content, the larger the bottom margin). When the div is > >expanded, the divs below are pushed into the correct positions. I > >might also say that I have noticed this behavior in Safari 2.0.4, > >Firefox 2 and Opera 9.02 (all Mac versions). MS Explorer 6 on PC > >works as aspected. > > > >Besides that, when "canceling" an effect by hitting the show/hide > >triangle once more, Safari (at least) will not push the divs below > >to the proper positions. Instead, divs below will overlap with the > >expanded div. > >Any ideas? I was not able to get any hints on the scriptaculous site. > > > >/frank > > frank: > > I run Mac OS 10.4.8 / Safari 2.0.4 and I don't see the problem you > describe -- works good for me. But, you might check validation. Home > is OK, but some of the other pages fail. > > tedd > > PS: Awesome site -- great work! > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdougherty at pbp.com Mon Jan 8 18:37:45 2007 From: mdougherty at pbp.com (Mike Dougherty) Date: Mon, 08 Jan 2007 19:37:45 -0500 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: <2B1DC719-B0A0-4AA4-A30E-C0FAE08FA33E@nikehydraulics.se> References: <7cc847460701080931x729ddf13xb9e71f968f6bf6a7@mail.gmail.com> <2B1DC719-B0A0-4AA4-A30E-C0FAE08FA33E@nikehydraulics.se> Message-ID: On Mon, 8 Jan 2007 22:18:48 +0100 Frank Arensmeier wrote: > CLAI - thats what I ment. Weird, because Explorer (6 at least) does not seem to suffer from >this problem. I think there must be a way to cancel an slide down effect. I read somewhere about >the function .cancel(). I tried to assign the slide down effect like > myEffect = new Effect.SlideDown(divId, {duration:1}); > > When hitting the show/hide image again I have a myEffect.cancel(); in my java script. But this >does not seem to have the desired effect (=cancel and unset the current effect object). > > I will get back when I have a solution. ie: cancelBubble else: stopPropagation see this: http://www.quirksmode.org/js/events_order.html 'hope it helps From frank.arensmeier at nikehydraulics.se Tue Jan 9 02:31:25 2007 From: frank.arensmeier at nikehydraulics.se (Frank Arensmeier) Date: Tue, 9 Jan 2007 09:31:25 +0100 Subject: [Javascript] Strange margins with scriptaculous In-Reply-To: References: <7cc847460701080931x729ddf13xb9e71f968f6bf6a7@mail.gmail.com> <2B1DC719-B0A0-4AA4-A30E-C0FAE08FA33E@nikehydraulics.se> Message-ID: <79AF4C0A-4773-4C1A-89EB-989D6EDE8635@nikehydraulics.se> Setting the hight of the content div back to "auto" when collapsing did the trick. //frank 9 jan 2007 kl. 01.37 skrev Mike Dougherty: > On Mon, 8 Jan 2007 22:18:48 +0100 > Frank Arensmeier wrote: >> CLAI - thats what I ment. Weird, because Explorer (6 at least) >> does not seem to suffer from this problem. I think there must be >> a way to cancel an slide down effect. I read somewhere about the >> function .cancel(). I tried to assign the slide down effect like >> myEffect = new Effect.SlideDown(divId, {duration:1}); >> When hitting the show/hide image again I have a myEffect.cancel(); >> in my java script. But this does not seem to have the desired >> effect (=cancel and unset the current effect object). >> I will get back when I have a solution. > > > ie: cancelBubble > else: stopPropagation > > see this: http://www.quirksmode.org/js/events_order.html > > 'hope it helps > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From Info at Abyss.ws Wed Jan 10 05:51:29 2007 From: Info at Abyss.ws (Information - Abyss) Date: Wed, 10 Jan 2007 22:51:29 +1100 Subject: [Javascript] Browser sniffing! Message-ID: <000801c734ad$b3586610$6401a8c0@hawkeye> Good Evening, I am wanting to write a Javacript file that will find a browsers name and browser version so that anything less then IE 7 it displays an error message I tried the follwoing window.onload = fncOnLoad; function fncOnLoad() { alert("APP NAME:" + navigator.appName); alert("appVersion: " + navigator.appVersion); alert("Product: " + navigator.product); alert(" vendor:" + navigator.vendor ); alert(" app code name:" + navigator.appCodeName ); } but that did not return what i wanted.... eg it would return Mozilla (rather then FireFox) and it would return version 4 for IE6.. would someone please be able to shed some light on this? Thank you for your help Abyss. -------------- next part -------------- An HTML attachment was scrubbed... URL: From david at dorward.me.uk Wed Jan 10 08:25:48 2007 From: david at dorward.me.uk (David Dorward) Date: Wed, 10 Jan 2007 14:25:48 +0000 Subject: [Javascript] Browser sniffing! In-Reply-To: <000801c734ad$b3586610$6401a8c0@hawkeye> References: <000801c734ad$b3586610$6401a8c0@hawkeye> Message-ID: <20070110142548.GA25400@us-lot.org> On Wed, Jan 10, 2007 at 10:51:29PM +1100, Information - Abyss wrote: > I am wanting to write a Javacript file that will find a browsers > name and browser version so that anything less then IE 7 it > displays an error message http://www.jibbering.com/faq/#FAQ4_26 -- David Dorward http://dorward.me.uk From nick at nickfitz.co.uk Wed Jan 10 08:49:17 2007 From: nick at nickfitz.co.uk (Nick Fitzsimons) Date: Wed, 10 Jan 2007 14:49:17 +0000 Subject: [Javascript] Browser sniffing! In-Reply-To: <000801c734ad$b3586610$6401a8c0@hawkeye> References: <000801c734ad$b3586610$6401a8c0@hawkeye> Message-ID: <85170DB8-7679-454A-B275-B4C3E225BC94@nickfitz.co.uk> On 10 Jan 2007, at 11:51:29, Information - Abyss wrote: > Good Evening, > > I am wanting to write a Javacript file that will find a browsers > name and browser version > > so that anything less then IE 7 it displays an error message I > tried the follwoing > Not sure what you mean by "less than IE 7": is Safari 2.0.4 (419.3) "less than" it, for example? PPK has a definitive browser detection script attached to his article: although you should take note of his comment that "If you think you need browser detects, you can be sure you don't know enough about browsers", which he expands upon in his follow-up article: HTH, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ From Info at Abyss.ws Wed Jan 10 16:09:27 2007 From: Info at Abyss.ws (Information - Abyss) Date: Thu, 11 Jan 2007 09:09:27 +1100 Subject: [Javascript] Browser sniffing! References: <000801c734ad$b3586610$6401a8c0@hawkeye> <85170DB8-7679-454A-B275-B4C3E225BC94@nickfitz.co.uk> Message-ID: <000d01c73504$015a39a0$6401a8c0@hawkeye> Thank you for your response I appreciate it Regards Abyss ----- Original Message ----- From: "Nick Fitzsimons" To: "[JavaScript List]" Sent: Thursday, January 11, 2007 1:49 AM Subject: Re: [Javascript] Browser sniffing! > On 10 Jan 2007, at 11:51:29, Information - Abyss wrote: > >> Good Evening, >> >> I am wanting to write a Javacript file that will find a browsers >> name and browser version >> >> so that anything less then IE 7 it displays an error message I >> tried the follwoing >> > > Not sure what you mean by "less than IE 7": is Safari 2.0.4 (419.3) > "less than" it, for example? > > PPK has a definitive browser detection script attached to his article: > > although you should take note of his comment that "If you think you > need browser detects, you can be sure you don't know enough about > browsers", which he expands upon in his follow-up article: > > > HTH, > > Nick. > -- > Nick Fitzsimons > http://www.nickfitz.co.uk/ > > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > From Info at Abyss.ws Wed Jan 10 16:08:22 2007 From: Info at Abyss.ws (Information - Abyss) Date: Thu, 11 Jan 2007 09:08:22 +1100 Subject: [Javascript] Browser sniffing! References: <000801c734ad$b3586610$6401a8c0@hawkeye> <20070110142548.GA25400@us-lot.org> Message-ID: <000701c73503$db5abf40$6401a8c0@hawkeye> Thank you for your response I appreciate it Regards Abyss From paul at juniperwebcraft.com Wed Jan 10 18:12:59 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Wed, 10 Jan 2007 16:12:59 -0800 Subject: [Javascript] Browser sniffing! In-Reply-To: <000801c734ad$b3586610$6401a8c0@hawkeye> References: <000801c734ad$b3586610$6401a8c0@hawkeye> Message-ID: <7.0.1.0.2.20070110155641.021a3730@juniperwebcraft.com> At 1/10/2007 03:51 AM, Information - Abyss wrote: >I am wanting to write a Javacript file that will find a browsers >name and browser version > >so that anything less then IE 7 it displays an error message ... The main problem with browser-sniffing with javascript is that it assumes, erroneously, that HTTP_USER_AGENT always correctly reports the browser name and version. It doesn't. I don't know if this falls within the scope of what you're trying to achieve, but instead of javascript you could simply use Microsoft's conditional comments. They have the advantage of being executed -- accurately and only -- by Internet Explorer: http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp http://www.quirksmode.org/css/condcom.html Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From Info at Abyss.ws Wed Jan 10 20:00:04 2007 From: Info at Abyss.ws (Information - Abyss) Date: Thu, 11 Jan 2007 13:00:04 +1100 Subject: [Javascript] Browser sniffing! References: <000801c734ad$b3586610$6401a8c0@hawkeye> <7.0.1.0.2.20070110155641.021a3730@juniperwebcraft.com> Message-ID: <000301c73524$385f4150$6401a8c0@hawkeye> Thank you for your reply I appreciate it Regards Abyss ----- Original Message ----- From: "Paul Novitski" To: Sent: Thursday, January 11, 2007 11:12 AM Subject: Re: [Javascript] Browser sniffing! > At 1/10/2007 03:51 AM, Information - Abyss wrote: >>I am wanting to write a Javacript file that will find a browsers >>name and browser version >> >>so that anything less then IE 7 it displays an error message > ... > > > The main problem with browser-sniffing with javascript is that it > assumes, erroneously, that HTTP_USER_AGENT always correctly reports > the browser name and version. It doesn't. > > I don't know if this falls within the scope of what you're trying to > achieve, but instead of javascript you could simply use Microsoft's > conditional comments. They have the advantage of being executed -- > accurately and only -- by Internet Explorer: > > > > http://msdn.microsoft.com/workshop/author/dhtml/overview/ccomment_ovw.asp > http://www.quirksmode.org/css/condcom.html > > Regards, > Paul > __________________________ > > Juniper Webcraft Ltd. > http://juniperwebcraft.com > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > From javascript at webdesignofficina.com Thu Jan 11 10:59:12 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Thu, 11 Jan 2007 17:59:12 +0100 Subject: [Javascript] Monitor an offsetHeight value Message-ID: <45A66CE0.4050705@webdesignofficina.com> Hi all, I'm trying to build a function that would monitor an offsetHeight value, to test if this value is changing from it's initial value to something smaller or bigger when a user plays with the page: either resize the browser window or the text size. I have already come across scripts that would monitor if the font size has changed. In my situation I have also to monitor an existing element of the layout height. So I have two values: el1 = elem.offsetHeight; >> That's the value fired when the page is first loaded el2 = elem.offsetheight >> That's the same value but in a setTimeout, that needs to be checked Does anyone have any idea on how to achieve this or ressources to point to. Thanks ! Here's my unlucky attempt below: function checkOptJ(){ var opts1 = document.getElementById("options"); moveBy1 = opts1.offsetHeight;// Initial value function checkOptK(){ opts44 = document.getElementById("options"); moveBy22 = opts44.offsetHeight;// Value to be checked } setTimeout("checkOptK();", 2000); if ( moveBy1 !== moveBy22) { alert( "things have moved" ); } } From stephanwehner at gmail.com Thu Jan 11 11:18:52 2007 From: stephanwehner at gmail.com (Stephan Wehner) Date: Thu, 11 Jan 2007 09:18:52 -0800 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <45A66CE0.4050705@webdesignofficina.com> References: <45A66CE0.4050705@webdesignofficina.com> Message-ID: On 1/11/07, Guillaume wrote: > Hi all, > > I'm trying to build a function that would monitor an offsetHeight value, > to test if this value is changing from it's initial value to something > smaller or bigger when a user plays with the page: either resize the > browser window or the text size. If those are the only cases, you can set up listeners for those two kinds of events and have the action test for changes to the offsetHeight value. Or am I missing something? > I have already come across scripts that would monitor if the font size > has changed. And the window resize detection comes directly from the browser. Stephan -- Stephan Wehner > http://stephan.sugarmotor.org > http://stephansmap.org > http://www.trafficlife.com > http://www.buckmaster.ca From javascript at webdesignofficina.com Thu Jan 11 11:41:35 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Thu, 11 Jan 2007 18:41:35 +0100 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: References: <45A66CE0.4050705@webdesignofficina.com> Message-ID: <45A676CF.4090602@webdesignofficina.com> Stephan, You are right that's exactly what I'm trying to do with my script except that this one doesn't work... > On 1/11/07, Guillaume wrote: >> Hi all, >> >> I'm trying to build a function that would monitor an offsetHeight value, >> to test if this value is changing from it's initial value to something >> smaller or bigger when a user plays with the page: either resize the >> browser window or the text size. > > If those are the only cases, you can set up listeners for those two kinds > of events and have the action test for changes to the offsetHeight value. > > Or am I missing something? > > >> I have already come across scripts that would monitor if the font size >> has changed. > > And the window resize detection comes directly from the browser. > > Stephan > > From stephanwehner at gmail.com Thu Jan 11 12:58:06 2007 From: stephanwehner at gmail.com (Stephan Wehner) Date: Thu, 11 Jan 2007 10:58:06 -0800 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <45A676CF.4090602@webdesignofficina.com> References: <45A66CE0.4050705@webdesignofficina.com> <45A676CF.4090602@webdesignofficina.com> Message-ID: On 1/11/07, Guillaume wrote: > Stephan, > > You are right that's exactly what I'm trying to do with my script except > that this one doesn't work... Are you calling checkOptJ() You could post the whole code. Shouldn't be too long if you just cover the window-resize event handling for now. Stephan > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -- Stephan Wehner > http://stephan.sugarmotor.org > http://stephansmap.org > http://www.trafficlife.com > http://www.buckmaster.ca From javascript at webdesignofficina.com Thu Jan 11 13:12:57 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Thu, 11 Jan 2007 20:12:57 +0100 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: References: <45A66CE0.4050705@webdesignofficina.com> <45A676CF.4090602@webdesignofficina.com> Message-ID: <45A68C39.1090101@webdesignofficina.com> Stephan, Thank you for your reply. See my comments below: > > Are you calling checkOptJ() Yes in the onload > > You could post the whole code. The code is just the one I've already posted, there it is again: function checkOptJ(){ // Fired in the onload var opts1 = document.getElementById("options"); moveBy1 = opts1.offsetHeight;// Initial value function checkOptK(){ opts44 = document.getElementById("options"); moveBy22 = opts44.offsetHeight;// Value to be checked: same as above but with a listener to see if it's changing } setTimeout("checkOptK();", 2000); if ( moveBy1 !== moveBy22) { // Compare these two values if they are different, if moveBy22 has grown or shrink do this below alert( "things have moved" ); } } Hope this makes sense. Regards. Guillaume From stephanwehner at gmail.com Thu Jan 11 13:30:51 2007 From: stephanwehner at gmail.com (Stephan Wehner) Date: Thu, 11 Jan 2007 11:30:51 -0800 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <45A68C39.1090101@webdesignofficina.com> References: <45A66CE0.4050705@webdesignofficina.com> <45A676CF.4090602@webdesignofficina.com> <45A68C39.1090101@webdesignofficina.com> Message-ID: On 1/11/07, Guillaume wrote: > Stephan, > > Thank you for your reply. See my comments below: > > > > Are you calling checkOptJ() > > Yes in the onload > > > > You could post the whole code. > > The code is just the one I've already posted, there it is again: > > function checkOptJ(){ // Fired in the onload > var opts1 = document.getElementById("options"); > > moveBy1 = opts1.offsetHeight;// Initial value > > > > function checkOptK(){ > > opts44 = document.getElementById("options"); > > moveBy22 = opts44.offsetHeight;// Value to be checked: same as > above but with a listener to see if it's changing > } > setTimeout("checkOptK();", 2000); The following code seems to be executed only once, should it be included in the checkOptK method? > > if ( moveBy1 !== moveBy22) { // Compare these two values if they > are different, if moveBy22 has grown or shrink do this below > > alert( "things have moved" ); > } > > } > > Hope this makes sense. > Regards. > > Guillaume > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -- Stephan Wehner > http://stephan.sugarmotor.org > http://stephansmap.org > http://www.trafficlife.com > http://www.buckmaster.ca From paul at juniperwebcraft.com Thu Jan 11 13:33:25 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Thu, 11 Jan 2007 11:33:25 -0800 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <45A66CE0.4050705@webdesignofficina.com> References: <45A66CE0.4050705@webdesignofficina.com> Message-ID: <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> At 1/11/2007 08:59 AM, Guillaume wrote: >I'm trying to build a function that would monitor an offsetHeight value ... >Here's my unlucky attempt below: > > function checkOptJ(){ > var opts1 = document.getElementById("options"); > > moveBy1 = opts1.offsetHeight;// Initial value > > > > function checkOptK(){ > > opts44 = document.getElementById("options"); > > moveBy22 = opts44.offsetHeight;// Value to be checked > } > > setTimeout("checkOptK();", 2000); > > > if ( moveBy1 !== moveBy22) { > > alert( "things have moved" ); > > } > > } I see two errors: 1) You haven't closed the curly brace for function checkOptJ() 2) You haven't declared moveBy1 in your root code outside of these functions so it will exist as a global variable and thus be known inside function checkOptK(). Regards, Paul From moseley at hank.org Thu Jan 11 17:57:58 2007 From: moseley at hank.org (Bill Moseley) Date: Thu, 11 Jan 2007 15:57:58 -0800 Subject: [Javascript] Help with closures Message-ID: <20070111235757.GA3693@hank.org> Or I think this is a closure issue. I have a really simple and common task (that I'm likely making hard), where I want to create a hide/show block. So, the block of HTML looks basically like this:
Hide this content
content here
So clicking on "Show" or "Hide", well shows or hides that block with content. The problem is when I have two of those blocks clicking on the "hide" seems to get the right event but is hiding the wrong block. Here's a working demo: http://hank.org/hide.html So, a page can have any number of the above blocks. The javascript finds the blocks by looking for all "hidable" classes using Prototype's getElementsByClassName(); The onclick events are assigned to the spans with "click". When the even first I look at the parentNode's class name to know if should hide or to show. Basically in pseudo code I set up the events like so: for div in get_by_class( 'hidable' ) { // get
elements for the two inner sections var content_div = get_class( 'content', div ); var hidden_div = get_class( 'hidden', div ); // get the span for setting the events var show_span = get_class( 'click', content_div ); var hide_span = get_class( 'click', hidden_div ); // closure to call the toggle passing in the two
s var click_event = function(e) { toggle( e, content_div, hidden_div ); } Event.observe( show_span, 'click', show_event, false ); Event.observe( hide_span, 'click', show_event, false ); } Then the event does: function toggle ( event, content_div, hidden_div ) { look at event element's parent's class name to determine if should hide or show. } -- Bill Moseley moseley at hank.org From Alex.Turner at Project-Network.com Fri Jan 12 04:33:48 2007 From: Alex.Turner at Project-Network.com (Alex Turner) Date: Fri, 12 Jan 2007 10:33:48 -0000 Subject: [Javascript] Help with closures References: <20070111235757.GA3693@hank.org> Message-ID: <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> Dood, I would place call onclick like this: Hide this content Then the toggle event handler gets a reference to the node from which it was called and hence has no chance of ambiguity :-) The other way that is also easy - but messier - is the way I did the selectable rows in a table - see nerds-central.blogspot.com Cheers AJ Dr Alexander J Turner Project Network +44 (0) 7917 065072 Con Call: 0870 241 3425/3342654# ________________________________ From: javascript-bounces at LaTech.edu on behalf of Bill Moseley Sent: Thu 1/11/2007 23:57 To: javascript at LaTech.edu Subject: [Javascript] Help with closures Or I think this is a closure issue. I have a really simple and common task (that I'm likely making hard), where I want to create a hide/show block. So, the block of HTML looks basically like this:
Hide this content
content here
So clicking on "Show" or "Hide", well shows or hides that block with content. The problem is when I have two of those blocks clicking on the "hide" seems to get the right event but is hiding the wrong block. Here's a working demo: http://hank.org/hide.html So, a page can have any number of the above blocks. The javascript finds the blocks by looking for all "hidable" classes using Prototype's getElementsByClassName(); The onclick events are assigned to the spans with "click". When the even first I look at the parentNode's class name to know if should hide or to show. Basically in pseudo code I set up the events like so: for div in get_by_class( 'hidable' ) { // get
elements for the two inner sections var content_div = get_class( 'content', div ); var hidden_div = get_class( 'hidden', div ); // get the span for setting the events var show_span = get_class( 'click', content_div ); var hide_span = get_class( 'click', hidden_div ); // closure to call the toggle passing in the two
s var click_event = function(e) { toggle( e, content_div, hidden_div ); } Event.observe( show_span, 'click', show_event, false ); Event.observe( hide_span, 'click', show_event, false ); } Then the event does: function toggle ( event, content_div, hidden_div ) { look at event element's parent's class name to determine if should hide or show. } -- Bill Moseley moseley at hank.org _______________________________________________ Javascript mailing list Javascript at LaTech.edu https://lists.LaTech.edu/mailman/listinfo/javascript -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/ms-tnef Size: 8204 bytes Desc: not available URL: From david at dorward.me.uk Fri Jan 12 04:48:00 2007 From: david at dorward.me.uk (David Dorward) Date: Fri, 12 Jan 2007 10:48:00 +0000 Subject: [Javascript] Help with closures In-Reply-To: <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> Message-ID: <20070112104800.GA617@us-lot.org> On Fri, Jan 12, 2007 at 10:33:48AM -0000, Alex Turner wrote: > I would place call onclick like this: > Hide this content I wouldn't. It displays "Hide this content" even when the JavaScript won't work, and isn't in the tab order so its inaccessible to users of non-pointing devices. Instead, I would use JavaScript to dynamically add a button or anchor to the document. -- David Dorward http://dorward.me.uk From aaronbassett at gmail.com Fri Jan 12 04:53:32 2007 From: aaronbassett at gmail.com (Aaron Bassett) Date: Fri, 12 Jan 2007 10:53:32 +0000 Subject: [Javascript] Help with closures In-Reply-To: <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> Message-ID: <7cc847460701120253r69ecd948xb7fc069f72ee6d35@mail.gmail.com> I got asked about something similar on a forum not long ago I'll c&p my response here incase its of use to you: Ok this isn't the quickest way to go about it but it allows you to use classes to toggle visibility rather than applying the style directly. The most part of it is a butchered piece of prototype.js so if you are using a library/framework with its own class handling methods you can simply use them instead. Oh and this is in no way actually guaranteed to work - I've just written this out quickly and it is completely 100% untested. Its only meant as an idea incase you want to do something similar. Code: /* * Example usage: * notice.toggle(id); * notice.show(id); * notice.hide(id); */ notice={ hideClass"hide", toggle:function(id) { if(this.hasClassName(id this.hideClass)) { this.removeClassName(id this.hideClass); } else { this.addClassName(id this.hideClass); } }, show:function(id) { this.addClassName(id this.hideClass); }, hide:function(id) { this.removeClassName(id this.hideClass); }, // Modified from prototype.js [ http://prototype.conio.net/ ] hasClassName:function(id, cName) { if(!document.getElementById(id)) return; var elClass = document.getElementById(id).className; if (elClass.length == 0) return false; if (elClass == cName || elClass.match(new RegExp("(^|\\s)" + cName + "(\\s|$)"))) return true; return false; }, addClassName: function(id, cName) { if(!document.getElementById(id)) return; var el = document.getElementById(id); if(!this.hasClassName(id, cName)) el.className = el.className + " " + cName; }, removeClassName:function(id, cName) { if(!document.getElementById(id)) return; if(!this.hasClassName(id, cName)) return; var el = document.getElementById(id); var elClass = el.className; if (elClass.length == 0) return; var newClass = ""; var classes = elClass.split(' '); for(var i = classes.length-1; i >= 0; --i){ if(classes[i] != cName) newClass += classes[i] + " "; } var sp = /^\s*(.*?)\s*$/; el.className = newClass.replace(sp, ""); } } On 1/12/07, Alex Turner wrote: > > Dood, > > I would place call onclick like this: > > Hide this content > > Then the toggle event handler gets a reference to the node from which it > was called and hence has no chance of ambiguity :-) > > The other way that is also easy - but messier - is the way I did the > selectable rows in a table - see nerds-central.blogspot.com > > Cheers > > AJ > > Dr Alexander J Turner > Project Network > +44 (0) 7917 065072 > Con Call: 0870 241 3425/3342654# > > ________________________________ > > From: javascript-bounces at LaTech.edu on behalf of Bill Moseley > Sent: Thu 1/11/2007 23:57 > To: javascript at LaTech.edu > Subject: [Javascript] Help with closures > > > > Or I think this is a closure issue. > > I have a really simple and common task (that I'm likely making hard), > where I > want to create a hide/show block. > > So, the block of HTML looks basically like this: > >
> >
> Hide this content
> content here >
> > > >
> > So clicking on "Show" or "Hide", well shows or hides that block with > content. > > The problem is when I have two of those blocks clicking on the "hide" > seems to get the right event but is hiding the wrong block. > > Here's a working demo: > > http://hank.org/hide.html > > > > So, a page can have any number of the above blocks. The javascript > finds the blocks by looking for all "hidable" classes using Prototype's > getElementsByClassName(); > > The onclick events are assigned to the spans with "click". When the > even first I look at the parentNode's class name to know if should > hide or to show. > > Basically in pseudo code I set up the events like so: > > for div in get_by_class( 'hidable' ) { > > // get
elements for the two inner sections > var content_div = get_class( 'content', div ); > var hidden_div = get_class( 'hidden', div ); > > // get the span for setting the events > var show_span = get_class( 'click', content_div ); > var hide_span = get_class( 'click', hidden_div ); > > // closure to call the toggle passing in the two
s > var click_event = function(e) { > toggle( e, content_div, hidden_div ); > } > > Event.observe( show_span, 'click', show_event, false ); > Event.observe( hide_span, 'click', show_event, false ); > } > > > Then the event does: > > function toggle ( event, content_div, hidden_div ) { > > look at event element's parent's class name to determine if should > hide or show. > > } > > > > -- > Bill Moseley > moseley at hank.org > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From moseley at hank.org Fri Jan 12 08:02:23 2007 From: moseley at hank.org (Bill Moseley) Date: Fri, 12 Jan 2007 06:02:23 -0800 Subject: [Javascript] Help with closures In-Reply-To: <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> Message-ID: <20070112140223.GA9595@hank.org> On Fri, Jan 12, 2007 at 10:33:48AM -0000, Alex Turner wrote: > Dood, > > I would place call onclick like this: > > Hide this content I prefer to separate the behavior from the markup. Which probably means my "hide" and "show" links should then be inserted into the DOM by the script and not in the source html. Sorry, I wasn't very clear in my question. I was not about other ways to solve the same problem, but about the behavior I'm seeing in this example. What I'm wondering about is, when I have two separate hide/show blocks, why are the events from the first block passing the elements of the second block. In I loop over each block doing this: // Find one or more hide/show outer divs. var targets = document.getElementsByClassName( 'hidable' ); for ( var i = 0; i < targets.length; i++ ) { var out_div = targets[i]; // Grab the two inner
elements var content_div = this.get_container( 'content', out_div ); var hidden_div = this.get_container( 'hidden', out_div ); // And get the elements where to assign the events var hide_click = this.get_click( content_div ); var show_click = this.get_click( hidden_div ); // Create closure to hold the current
s for this event var show_event = function(e) { HideDiv.toggle(e, content_div, hidden_div ); return false; } Event.observe( show_click, 'click', show_event, false ); Event.observe( hide_click, 'click', show_event, false ); } That "show_event" function is a closure, right? I'm creating a function with the values of content_div and hidden div *at that time*. Then the next time through the loop new content_div and hidden_div variables are created (pointing to the new
elements). But, although the correct elements are being observed for events, when the event fires and run "show_event", the HideDiv.toggle function is being called always with the last values for "content_div" and "hidden_div". Probably easier to look at the code than to read my explanation. My follow-up question about the above is if the above closure will leak memory. What I'm currently doing in is when the event fires is figure out the content_div and hidden_div relative to where the event element is in the DOM: var el = Event.element( event ); var out_div = el.parentNode.parentNode; var content_div = this.get_container( 'content', out_div ); var hidden_div = this.get_container( 'hidden', out_div ); But, again, I trying to understand what's happening with the first example . Thanks, -- Bill Moseley moseley at hank.org From rer at datacompusa.com Fri Jan 12 09:33:41 2007 From: rer at datacompusa.com (Roger Roelofs) Date: Fri, 12 Jan 2007 10:33:41 -0500 Subject: [Javascript] Help with closures In-Reply-To: <20070112140223.GA9595@hank.org> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> <20070112140223.GA9595@hank.org> Message-ID: <64DE8859-11AB-4F0A-9075-91DBB490D8B9@datacompusa.com> Bill, On Jan 12, 2007, at 9:02 AM, Bill Moseley wrote: > Sorry, I wasn't very clear in my question. I was not about other > ways to solve the same problem, but about the behavior I'm seeing in > this example. > > What I'm wondering about is, when I have two separate hide/show > blocks, why are the events from the first block passing the elements > of the second block. I don't have time to actually debug the code, but I can tell you how closures and variable scoping work... The bottom line is: when you refer to a variable inside a closure that is set outside the closure, the variable contains its last value, not its value when the closure was created. This usually only bites you when you are in a loop context like this. Here are a couple of links that explain closures in more depth. http://blog.morrisjohns.com/javascript_closures_for_dummies http://javascript.crockford.com/ Roger -- Roger Roelofs web www.datacompusa.com Datacomp Appraisal Services Email rer at datacompusa.com 3215 Eaglecrest Drive, NE Grand Rapids, MI 49525-4593 From bernu at lptmc.jussieu.fr Fri Jan 12 09:53:14 2007 From: bernu at lptmc.jussieu.fr (Bernu Bernard) Date: Fri, 12 Jan 2007 16:53:14 +0100 Subject: [Javascript] How to set the scrolling of a div Message-ID: <4BFF27C5-BD62-426C-9B85-A841894AA0EA@lptmc.jussieu.fr> Hi list, I have a container div with heigth:100px and overflow:auto Inside I have a div with a height:200px. Thus the container div has a vertical scrollbar. I tried without success scrollBy and scrollTo : div does not understand these functions What should I do so that the inner-div scroll by 50px. Bernard This is a simple example : test scroll bar
-------------- next part -------------- An HTML attachment was scrubbed... URL: From matt.murphy at thermofisher.com Fri Jan 12 10:42:23 2007 From: matt.murphy at thermofisher.com (Matt Murphy) Date: Fri, 12 Jan 2007 10:42:23 -0600 Subject: [Javascript] Ajax & proxy question Message-ID: <33CB8A3B603760409040215E4232728C1C401D@exchange.tc-tech.com> All, our company has a proxy server. Whenever I use an ajax script to request something from the server, if it's going through the proxy it fails. I'm trying to figure out if the HTTPRequest method is a standard port 80 HTTP request to the server? and back? It seems like it is, and therefore should work through the proxy just fine. Any clues as to what's going on? If my ajax function does all the screen updating on the client side, and just sends stuff back to the server to update the db, no problem. But if I need to eval some code back from the server, no luck. Thanks for any help. Matt -------------- next part -------------- An HTML attachment was scrubbed... URL: From nick at nickfitz.co.uk Fri Jan 12 11:25:17 2007 From: nick at nickfitz.co.uk (Nick Fitzsimons) Date: Fri, 12 Jan 2007 17:25:17 +0000 Subject: [Javascript] Ajax & proxy question In-Reply-To: <33CB8A3B603760409040215E4232728C1C401D@exchange.tc-tech.com> References: <33CB8A3B603760409040215E4232728C1C401D@exchange.tc-tech.com> Message-ID: On 12 Jan 2007, at 16:42:23, Matt Murphy wrote: > our company has a proxy server. Whenever I use an ajax script to > request something from the server, if it's going through the proxy > it fails. I'm trying to figure out if the HTTPRequest method is a > standard port 80 HTTP request to the server? and back? It seems > like it is, and therefore should work through the proxy just fine. Yes, it's just a standard HTTP request over port 80. No different to what the browser does for every single thing it downloads. > Any clues as to what's going on? Some code might help. The clues are either in the code, or on the wire. > If my ajax function does all the screen updating on the client > side, and just sends stuff back to the server to update the db, no > problem. But if I need to eval some code back from the server, no > luck. When you say "No luck", do you mean that you get an error, or that it fails silently, or that it does something other than what you expect but without any error? What do you actually get back from the server? What's the response code? (Anything other than 200 usually means something's mucking up outside the client.) What format is it in - plain text, XML, JSON, HTML? Is it well-formed for the format you are using? Does the ContentType header you send it back with properly reflect its type? For starters, try using alert(foo.responseText); in your callback function to see what's actually coming back. If that doesn't help, use the Firebug extension for Firefox to examine exactly what's coming and going over the wire. Check HTTP headers, and make sure your text encoding is actually what your headers say it is, as otherwise some characters might be misinterpreted. And be aware that large numbers of proxies are misconfigured, and may strip or change headers. You might have to bang some network admin heads together. Having said that, I would guess that 90% plus of Ajax problems are in the client code or the server code, not the network. (If you could post an example page on a publicly accessible server, it would allow us to at least determine if the error is in your client code, or in the response. But I appreciate that this isn't always possible.) HTH, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ From scott at randomchaos.com Fri Jan 12 11:21:26 2007 From: scott at randomchaos.com (Scott Reynen) Date: Fri, 12 Jan 2007 11:21:26 -0600 Subject: [Javascript] Ajax & proxy question In-Reply-To: <33CB8A3B603760409040215E4232728C1C401D@exchange.tc-tech.com> References: <33CB8A3B603760409040215E4232728C1C401D@exchange.tc-tech.com> Message-ID: On Jan 12, 2007, at 10:42 AM, Matt Murphy wrote: > our company has a proxy server. Whenever I use an ajax script to > request something from the server, if it's going through the proxy > it fails. I'm trying to figure out if the HTTPRequest method is a > standard port 80 HTTP request to the server? and back? It seems > like it is, and therefore should work through the proxy just fine. > > Any clues as to what's going on? > > If my ajax function does all the screen updating on the client > side, and just sends stuff back to the server to update the db, no > problem. But if I need to eval some code back from the server, no > luck. You can't do cross-domain AJAX. XMLHttpRequests can only be made to the domain (and subdomain and port) initiating the request. So if your AJAX request is going through a proxy, your HTML page making the request needs to be loading through the same proxy. Peace, Scott From sullman at cs.stanford.edu Fri Jan 12 13:03:08 2007 From: sullman at cs.stanford.edu (Schuyler Ullman) Date: Fri, 12 Jan 2007 11:03:08 -0800 Subject: [Javascript] Help with closures Message-ID: Following up on what Roger said, > The bottom line is: when you refer to a variable inside a closure > that is set outside the closure, the variable contains its last > value, not its value when the closure was created. This usually only > bites you when you are in a loop context like this. This does not mean that all is lost. Each new call to a function that creates a closure creates a new closure. This means that you can create a helper function that will create the closure, and then call the helper function from inside your loop. Consider the following simplified example: var fns = []; function badTest() { var i; // This doesn't work because in all three functions // i has a value of three! for (i = 0; i < 3; i++) { fns[i] = function() { alert(i); }; } } function goodTest() { var i; // This should work for (i = 0; i < 3; i++) { fns[i] = closureHelper(i); } } function closureHelper(i) { return function() { alert(i); }; } function testFunctions() { var i; for (i = 0; i < fns.length; i++) fns[i](); } Schuyler From moseley at hank.org Fri Jan 12 13:42:18 2007 From: moseley at hank.org (Bill Moseley) Date: Fri, 12 Jan 2007 11:42:18 -0800 Subject: [Javascript] Help with closures In-Reply-To: <64DE8859-11AB-4F0A-9075-91DBB490D8B9@datacompusa.com> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> <20070112140223.GA9595@hank.org> <64DE8859-11AB-4F0A-9075-91DBB490D8B9@datacompusa.com> Message-ID: <20070112194217.GC3693@hank.org> On Fri, Jan 12, 2007 at 10:33:41AM -0500, Roger Roelofs wrote: > Here are a couple of links that explain closures in more depth. Thanks! > http://blog.morrisjohns.com/javascript_closures_for_dummies Oh that stinks. I forgot about example 5 on that page and that it differs from closures in other languages. Example 5 on that page shows the problem: function buildList(list) { var result = []; for (var i = 0; i < list.length; i++) { var item = 'item' + list[i]; // <<---------- HERE result.push( function() {alert(item + ' ' + list[i])} ); } return result; } function testList() { var fnlist = buildList([1,2,3]); // using j only to help prevent confusion - could use i for (var j = 0; j < fnlist.length; j++) { fnlist[j](); } } I expected "item" to be a new variable every time through the loop. Isn't that what "var" means? var item = 'item' + list[i]; Yet, running the code "item" refers always to the last value, as shown in "Example 5". It returns "item3" three times. Now, here's that same thing in Perl (not that anyone would write Perl like this): sub buildList { my @list = @_; my @result; for ( my $i = 0; $i < @list; $i++ ) { my $item = 'item' . $list[$i]; push @result, sub { warn "$item $list[$i]\n" }; } return @result; } sub testList { my @fnlist = buildList( 1,2,3 ); for ( my $j = 0; $j < @fnlist; $j++ ) { $fnlist[$j]->(); } } testList(); And running generates this: $ perl closure.pl item1 item2 item3 So "$item" in this case is new each time through the loop. It's local to the instance of that block of code each time through the loop. -- Bill Moseley moseley at hank.org From nick at nickfitz.co.uk Fri Jan 12 14:00:15 2007 From: nick at nickfitz.co.uk (Nick Fitzsimons) Date: Fri, 12 Jan 2007 20:00:15 +0000 Subject: [Javascript] Help with closures In-Reply-To: <20070112194217.GC3693@hank.org> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> <20070112140223.GA9595@hank.org> <64DE8859-11AB-4F0A-9075-91DBB490D8B9@datacompusa.com> <20070112194217.GC3693@hank.org> Message-ID: <2F413525-ABA1-4005-AF40-6894A5AAF85A@nickfitz.co.uk> On 12 Jan 2007, at 19:42:18, Bill Moseley wrote: > I expected "item" to be a new variable every time through the loop. > Isn't that what "var" means? > > var item = 'item' + list[i]; > > Yet, running the code "item" refers always to the last value, as shown > in "Example 5". It returns "item3" three times. Variables in JavaScript are define as having function scope, not block scope. If defined outside a function definition, or defined within a function without the use of the "var" keyword, the have global scope. Thus: var foo = 1; alert(foo); // shows "1" function testWithoutVar() { foo = 2; // no "var", so foo is the global foo } testWithoutVar(); alert(foo); // shows "2" function testWithVar() { var foo = 3; // foo is local to the function } testWithoutVar(); alert(foo); // shows "2" as global foo is left unchanged by the function function testWithBlock() { var bar = 1; for (var i = 0; i < 10; i++) { var bar = i; // this is just redefining the outer bar, not a new bar with block scope } alert(bar); // shows "9" } testWithBlock(); alert(bar); // shows "undefined", as bar only had function scope Moral: just because the syntactic sugar in JavaScript is similar to C- style languages such as Java, doesn't mean it follows the same scoping rules. I would suggest having a look at ECMA 262, which defines the ECMAScript language of which JavaScript is an implementation, but nobody who's read it all the way through (several times) would willingly inflict it on another human being :-) HTH, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ From moseley at hank.org Fri Jan 12 15:29:25 2007 From: moseley at hank.org (Bill Moseley) Date: Fri, 12 Jan 2007 13:29:25 -0800 Subject: [Javascript] Help with closures In-Reply-To: <2F413525-ABA1-4005-AF40-6894A5AAF85A@nickfitz.co.uk> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> <20070112140223.GA9595@hank.org> <64DE8859-11AB-4F0A-9075-91DBB490D8B9@datacompusa.com> <20070112194217.GC3693@hank.org> <2F413525-ABA1-4005-AF40-6894A5AAF85A@nickfitz.co.uk> Message-ID: <20070112212925.GC30772@hank.org> On Fri, Jan 12, 2007 at 08:00:15PM +0000, Nick Fitzsimons wrote: > function testWithBlock() { > var bar = 1; > for (var i = 0; i < 10; i++) { > var bar = i; // this is just redefining the outer bar, not a new bar with block scope > } > alert(bar); // shows "9" > } So is this exactly the same then (note lack of var on inner bar)?: function testWithBlock() { var bar = 1; for (var i = 0; i < 10; i++) { bar = i; } alert(bar); // shows "9" } Kind of disturbing, if so. ;) > I would suggest having a look at ECMA 262, which > defines the ECMAScript language of which JavaScript is an > implementation, but nobody who's read it all the way through (several > times) would willingly inflict it on another human being :-) I'd like to, but I'm enjoying poking hot sticks in my eyes too much. > HTH, It does. Thanks much. -- Bill Moseley moseley at hank.org From nick at nickfitz.co.uk Fri Jan 12 16:16:20 2007 From: nick at nickfitz.co.uk (Nick Fitzsimons) Date: Fri, 12 Jan 2007 22:16:20 +0000 Subject: [Javascript] Help with closures In-Reply-To: <20070112212925.GC30772@hank.org> References: <20070111235757.GA3693@hank.org> <9EFC04356BBC4745B67A41B106F4A47A8B9F41@TPN-EX01.PROJECT-NETWORK.COM> <20070112140223.GA9595@hank.org> <64DE8859-11AB-4F0A-9075-91DBB490D8B9@datacompusa.com> <20070112194217.GC3693@hank.org> <2F413525-ABA1-4005-AF40-6894A5AAF85A@nickfitz.co.uk> <20070112212925.GC30772@hank.org> Message-ID: On 12 Jan 2007, at 21:29:25, Bill Moseley wrote: > On Fri, Jan 12, 2007 at 08:00:15PM +0000, Nick Fitzsimons wrote: >> function testWithBlock() { >> var bar = 1; >> for (var i = 0; i < 10; i++) { >> var bar = i; // this is just redefining the outer bar, not >> a new bar with block scope >> } >> alert(bar); // shows "9" >> } > > So is this exactly the same then (note lack of var on inner bar)?: > > function testWithBlock() { > var bar = 1; > for (var i = 0; i < 10; i++) { > bar = i; > } > alert(bar); // shows "9" > } > > Kind of disturbing, if so. ;) > Yes, it's the same. To be precise, "var declares a variable, optionally initialising it to a value." So you could write function testWithBlock() { var bar; for (var i = 0; i < 10; i++) { bar = i; } alert(bar); // shows "9" } although I'm not sure if you find that any less disturbing ;-) >> I would suggest having a look at ECMA 262, which >> defines the ECMAScript language of which JavaScript is an >> implementation, but nobody who's read it all the way through (several >> times) would willingly inflict it on another human being :-) > > I'd like to, but I'm enjoying poking hot sticks in my eyes too much. :-) A good source of information is on Mozilla's site: The Core reference is good for looking stuff up quickly, and the Language Guide will help you get your head round oddities like function scope. >> HTH, > > It does. Thanks much. > No problem. Now, it's Friday night and the pub's open. Have a good weekend :-) Cheers, Nick. -- Nick Fitzsimons http://www.nickfitz.co.uk/ From bernu at lptmc.jussieu.fr Mon Jan 15 00:41:07 2007 From: bernu at lptmc.jussieu.fr (Bernu Bernard) Date: Mon, 15 Jan 2007 07:41:07 +0100 Subject: [Javascript] How to scroll an iframe Message-ID: Is it possible to scroll an iframe from Javascript ? I tried scrollTo and scrollBy without success. Bernard From javascript at webdesignofficina.com Mon Jan 15 08:52:23 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Mon, 15 Jan 2007 15:52:23 +0100 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> References: <45A66CE0.4050705@webdesignofficina.com> <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> Message-ID: <45AB9527.1080708@webdesignofficina.com> Stefan, Paul, and all others who haven't replied yet... Here's my function below re-aranged according to your replies... I still don't understand why, when checkOptSli() is called, I always get the else statement... Not being able to compare an initial value to a listened one... Can someone please light up the path a bit... Regards, Guillaume. function checkOptSli() { // This is fired when a user clicks a link var sto2 = 0; sto2ID = setTimeout("checkOptJ();", 2000); } function checkOptJ() { var optsh0 = checkOptK; optsh3 = optsh0;// Initial value (offsetHeight) of element var optsh1 = 0; var optsh1ID = setTimeout("checkOptL();", 2000); optsh4 = optsh1ID;// Value to be listened to and compared to the previous one above if ( optsh4 > optsh3 ) { alert( "things have moved" ); } else { alert( "quiet" ); } } function checkOptK(){ // Fired on the onload so we have a value as starting point var opts1 = document.getElementById("options"); moveBy1 = opts1.offsetHeight; posTn3 = 0 - moveBy1; parseInt( posTn3 ); return posTn3; } function checkOptL(){ // Looped inside a setTimeout to see if this value is changing... // And compare it inside the checkOptJ()function to the checkOptK()resulting value var opts2 = document.getElementById("options"); moveBy2 = opts2.offsetHeight; posTn4 = 0 - moveBy2; parseInt( posTn4 ); return posTn4; } From aaronbassett at gmail.com Mon Jan 15 10:03:23 2007 From: aaronbassett at gmail.com (Aaron Bassett) Date: Mon, 15 Jan 2007 16:03:23 +0000 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <45AB9527.1080708@webdesignofficina.com> References: <45A66CE0.4050705@webdesignofficina.com> <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> <45AB9527.1080708@webdesignofficina.com> Message-ID: <7cc847460701150803y695b903fo5049861b92557e94@mail.gmail.com> Am I missing something or could you not just use onresize?? Like: window.onresize=function() { /* do stuff */ } http://www.w3schools.com/htmldom/event_onresize.asp On 1/15/07, Guillaume wrote: > > Stefan, Paul, and all others who haven't replied yet... > > Here's my function below re-aranged according to your replies... > I still don't understand why, when checkOptSli() is called, I always get > the else statement... Not being able > to compare an initial value to a listened one... > > Can someone please light up the path a bit... > > Regards, > > Guillaume. > > > function checkOptSli() { // This is fired when a user clicks a link > > var sto2 = 0; > > sto2ID = setTimeout("checkOptJ();", 2000); > > } > > function checkOptJ() { > > var optsh0 = checkOptK; > > optsh3 = optsh0;// Initial value (offsetHeight) of element > > var optsh1 = 0; > > var optsh1ID = setTimeout("checkOptL();", 2000); > > optsh4 = optsh1ID;// Value to be listened to and compared to the > previous one above > > if ( optsh4 > optsh3 ) { > > > > alert( "things have moved" ); > > } > > > > else { > > > > alert( "quiet" ); > > > > > > } > > > > } > > > > function checkOptK(){ // Fired on the onload so we have a value as > starting point > > var opts1 = document.getElementById("options"); > > moveBy1 = opts1.offsetHeight; > > posTn3 = 0 - moveBy1; > > parseInt( posTn3 ); > > return posTn3; > > } > > > function checkOptL(){ // Looped inside a setTimeout to see if this value > is changing... > // And compare it inside the checkOptJ()function > to the checkOptK()resulting value > > var opts2 = document.getElementById("options"); > > moveBy2 = opts2.offsetHeight; > > posTn4 = 0 - moveBy2; > > parseInt( posTn4 ); > > return posTn4; > > } > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -------------- next part -------------- An HTML attachment was scrubbed... URL: From javascript at webdesignofficina.com Mon Jan 15 10:31:41 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Mon, 15 Jan 2007 17:31:41 +0100 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <7cc847460701150803y695b903fo5049861b92557e94@mail.gmail.com> References: <45A66CE0.4050705@webdesignofficina.com> <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> <45AB9527.1080708@webdesignofficina.com> <7cc847460701150803y695b903fo5049861b92557e94@mail.gmail.com> Message-ID: <45ABAC6D.6050807@webdesignofficina.com> No you are not, but I still need to check an element dimension ( height ) in the layout to see if the user has changed his font size... > Am I missing something or could you not just use onresize?? > > Like: > window.onresize=function() { /* do stuff */ } > > http://www.w3schools.com/htmldom/event_onresize.asp > > > > > On 1/15/07, *Guillaume* > wrote: > > Stefan, Paul, and all others who haven't replied yet... > > Here's my function below re-aranged according to your replies... > I still don't understand why, when checkOptSli() is called, I > always get the else statement... Not being able > to compare an initial value to a listened one... > > Can someone please light up the path a bit... > > Regards, > > Guillaume. > > > function checkOptSli() { // This is fired when a user clicks a link > > var sto2 = 0; > > sto2ID = setTimeout("checkOptJ();", 2000); > > } > > function checkOptJ() { > > var optsh0 = checkOptK; > > optsh3 = optsh0;// Initial value (offsetHeight) of element > > var optsh1 = 0; > > var optsh1ID = setTimeout("checkOptL();", 2000); > > optsh4 = optsh1ID;// Value to be listened to and compared to > the previous one above > > if ( optsh4 > optsh3 ) { > > > > alert( "things have moved" ); > > } > > > > else { > > > > alert( "quiet" ); > > > > > > } > > > > } > > > > function checkOptK(){ // Fired on the onload so we have a value > as starting point > > var opts1 = document.getElementById("options"); > > moveBy1 = opts1.offsetHeight; > > posTn3 = 0 - moveBy1; > > parseInt( posTn3 ); > > return posTn3; > > } > > > function checkOptL(){ // Looped inside a setTimeout to see if > this value is changing... > // And compare it inside the > checkOptJ()function to the checkOptK()resulting value > > var opts2 = document.getElementById("options"); > > moveBy2 = opts2.offsetHeight; > > posTn4 = 0 - moveBy2; > > parseInt( posTn4 ); > > return posTn4; > > } > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -------------- next part -------------- An HTML attachment was scrubbed... URL: From aaronbassett at gmail.com Mon Jan 15 10:43:47 2007 From: aaronbassett at gmail.com (Aaron Bassett) Date: Mon, 15 Jan 2007 16:43:47 +0000 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <45ABAC6D.6050807@webdesignofficina.com> References: <45A66CE0.4050705@webdesignofficina.com> <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> <45AB9527.1080708@webdesignofficina.com> <7cc847460701150803y695b903fo5049861b92557e94@mail.gmail.com> <45ABAC6D.6050807@webdesignofficina.com> Message-ID: <7cc847460701150843n6ba420e4oec1026b423c5d8bb@mail.gmail.com> Ah ok - I thought you already had a method for detecting the font resize. You could always use the text resize detector from ALA : http://www.alistapart.com/articles/fontresizing/ On 1/15/07, Guillaume wrote: > > No you are not, but I still need to check an element dimension ( height ) > in the layout to see if the user has changed his font size... > > Am I missing something or could you not just use onresize?? > > Like: > window.onresize=function() { /* do stuff */ } > > http://www.w3schools.com/htmldom/event_onresize.asp > > > > On 1/15/07, Guillaume wrote: > > > > Stefan, Paul, and all others who haven't replied yet... > > > > Here's my function below re-aranged according to your replies... > > I still don't understand why, when checkOptSli() is called, I always get > > the else statement... Not being able > > to compare an initial value to a listened one... > > > > Can someone please light up the path a bit... > > > > Regards, > > > > Guillaume. > > > > > > function checkOptSli() { // This is fired when a user clicks a link > > > > var sto2 = 0; > > > > sto2ID = setTimeout("checkOptJ();", 2000); > > > > } > > > > function checkOptJ() { > > > > var optsh0 = checkOptK; > > > > optsh3 = optsh0;// Initial value (offsetHeight) of element > > > > var optsh1 = 0; > > > > var optsh1ID = setTimeout("checkOptL();", 2000); > > > > optsh4 = optsh1ID;// Value to be listened to and compared to the > > previous one above > > > > if ( optsh4 > optsh3 ) { > > > > > > > > alert( "things have moved" ); > > > > } > > > > > > > > else { > > > > > > > > alert( "quiet" ); > > > > > > > > > > > > } > > > > > > > > } > > > > > > > > function checkOptK(){ // Fired on the onload so we have a value as > > starting point > > > > var opts1 = document.getElementById("options"); > > > > moveBy1 = opts1.offsetHeight; > > > > posTn3 = 0 - moveBy1; > > > > parseInt( posTn3 ); > > > > return posTn3; > > > > } > > > > > > function checkOptL(){ // Looped inside a setTimeout to see if this > > value is changing... > > // And compare it inside the checkOptJ()function > > to the checkOptK()resulting value > > > > var opts2 = document.getElementById("options"); > > > > moveBy2 = opts2.offsetHeight; > > > > posTn4 = 0 - moveBy2; > > > > parseInt( posTn4 ); > > > > return posTn4; > > > > } > > > > _______________________________________________ > > Javascript mailing list > > Javascript at LaTech.edu > > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > ------------------------------ > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.eduhttps://lists.LaTech.edu/mailman/listinfo/javascript > > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From javascript at webdesignofficina.com Mon Jan 15 10:53:50 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Mon, 15 Jan 2007 17:53:50 +0100 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <7cc847460701150843n6ba420e4oec1026b423c5d8bb@mail.gmail.com> References: <45A66CE0.4050705@webdesignofficina.com> <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> <45AB9527.1080708@webdesignofficina.com> <7cc847460701150803y695b903fo5049861b92557e94@mail.gmail.com> <45ABAC6D.6050807@webdesignofficina.com> <7cc847460701150843n6ba420e4oec1026b423c5d8bb@mail.gmail.com> Message-ID: <45ABB19E.3020605@webdesignofficina.com> Thanks Aaron I knew that one... I actually need these two methods merged together: font-resize and window resize detection That's why monitoring the height of one existing element in the layout would do the trick... Regards. Guillaume. > Ah ok - I thought you already had a method for detecting the font resize. > You could always use the text resize detector from ALA : > http://www.alistapart.com/articles/fontresizing/ > > > > > On 1/15/07, *Guillaume* > wrote: > > No you are not, but I still need to check an element dimension ( > height ) in the layout to see if the user has changed his font size... >> Am I missing something or could you not just use onresize?? >> >> Like: >> window.onresize=function() { /* do stuff */ } >> >> http://www.w3schools.com/htmldom/event_onresize.asp >> >> >> >> >> On 1/15/07, *Guillaume* > > wrote: >> >> Stefan, Paul, and all others who haven't replied yet... >> >> Here's my function below re-aranged according to your replies... >> I still don't understand why, when checkOptSli() is called, I >> always get the else statement... Not being able >> to compare an initial value to a listened one... >> >> Can someone please light up the path a bit... >> >> Regards, >> >> Guillaume. >> >> >> function checkOptSli() { // This is fired when a user clicks >> a link >> >> var sto2 = 0; >> >> sto2ID = setTimeout("checkOptJ();", 2000); >> >> } >> >> function checkOptJ() { >> >> var optsh0 = checkOptK; >> >> optsh3 = optsh0;// Initial value (offsetHeight) of element >> >> var optsh1 = 0; >> >> var optsh1ID = setTimeout("checkOptL();", 2000); >> >> optsh4 = optsh1ID;// Value to be listened to and compared >> to the previous one above >> >> if ( optsh4 > optsh3 ) { >> >> >> >> alert( "things have moved" ); >> >> } >> >> >> >> else { >> >> >> >> alert( "quiet" ); >> >> >> >> >> >> } >> >> >> >> } >> >> >> >> function checkOptK(){ // Fired on the onload so we have a >> value as starting point >> >> var opts1 = document.getElementById("options"); >> >> moveBy1 = opts1.offsetHeight; >> >> posTn3 = 0 - moveBy1; >> >> parseInt( posTn3 ); >> >> return posTn3; >> >> } >> >> >> function checkOptL(){ // Looped inside a setTimeout to see >> if this value is changing... >> // And compare it inside the >> checkOptJ()function to the checkOptK()resulting value >> >> var opts2 = document.getElementById("options"); >> >> moveBy2 = opts2.offsetHeight; >> >> posTn4 = 0 - moveBy2; >> >> parseInt( posTn4 ); >> >> return posTn4; >> >> } >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript >> >> >> >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Javascript mailing list >> Javascript at LaTech.edu >> https://lists.LaTech.edu/mailman/listinfo/javascript >> > > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul at juniperwebcraft.com Mon Jan 15 11:15:59 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Mon, 15 Jan 2007 09:15:59 -0800 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <45AB9527.1080708@webdesignofficina.com> References: <45A66CE0.4050705@webdesignofficina.com> <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> <45AB9527.1080708@webdesignofficina.com> Message-ID: <7.0.1.0.2.20070115082952.021edec8@juniperwebcraft.com> At 1/15/2007 06:52 AM, Guillaume wrote: >Here's my function below re-aranged according to your replies... >I still don't understand why, when checkOptSli() is called, I always >get the else statement... Not being able >to compare an initial value to a listened one... ... >function checkOptSli() { // This is fired when a user clicks a link > > var sto2 = 0; Why are you setting this variable? You don't use it for anything and because it's local it can't be used anywhere else in your script. >sto2ID = setTimeout("checkOptJ();", 2000); This sets sto2ID equal to the setTimeout() id, but it is a pointless assignment statement because sto2ID is never used again inside this function and being local it cannot be used anywhere else (although you attempt to do so). Your script suggests that you believe setTimeout("checkOptJ();", 2000); will return the result of function checkOptJ(), however according to the manual setTimeout() returns "the ID of the timeout, which can be used with window.clearTimeout." http://developer.mozilla.org/en/docs/DOM:window.setTimeout >} > >function checkOptJ() { > > var optsh0 = checkOptK; This statement sets optsh0 equal to the TEXT of function checkOptK(). Probably what you want is: var optsh0 = checkOptK(); to get the RETURN VALUE from function checkOptK(). See: http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Defining_Functions > optsh3 = optsh0;// Initial value (offsetHeight) of element No, this sets optsh3 equal to the TEXT of function checkOptK(). Display its value with alert() to see what I mean. > var optsh1 = 0; This is a pointless assignment statement since you do not use optsh1 again within this function and, being local, it cannot be used anywhere else. > var optsh1ID = setTimeout("checkOptL();", 2000); Again this sets optsh1ID equal to the ID of this setTimeout() call, a value that is really only useful to clearTimeout(). > optsh4 = optsh1ID;// Value to be listened to and compared to the > previous one above What's your purpose in passing the setTimeout() ID from one variable to another? > if ( optsh4 > optsh3 ) { This compares the id of the previous setTimeout() call to the text of function checkOptK(), a nonsense comparison. You need to rewrite your code to return the changing heights of your elements. > alert( "things have moved" ); > } > else { > alert( "quiet" ); > } >} > > > > function checkOptK(){ // Fired on the onload so we have a value > as starting point > > var opts1 = document.getElementById("options"); > > moveBy1 = opts1.offsetHeight; > > posTn3 = 0 - moveBy1; > parseInt( posTn3 ); parseInt() is a function that returns a value. It does not affect the value passed to it. You probably mean: posTn3 = parseInt( posTn3 ); http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Predefined_Functions:parseInt_and_parseFloat_Functions > return posTn3; > > } > > function checkOptL(){ // Looped inside a setTimeout to see if this > value is changing... // And compare it > inside the checkOptJ()function to the checkOptK()resulting value > > var opts2 = document.getElementById("options"); > > moveBy2 = opts2.offsetHeight; > > posTn4 = 0 - moveBy2; > > parseInt( posTn4 ); > > return posTn4; > > } checkOptK() and checkOptL() performs identical functions -- you can make them a single function called from two different places in your code. Guillaume, I strongly suggest that you read the JavaScript and DOM documentation, and also that you use alert() to display values of your variables as you go along to help you debug your code. It seems clear from your code that you need to strengthen your understanding of basic JavaScript syntax. Core JavaScript 1.5 Guide http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide Gecko DOM Reference http://developer.mozilla.org/en/docs/Gecko_DOM_Reference Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From javascript at webdesignofficina.com Tue Jan 16 03:16:28 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Tue, 16 Jan 2007 10:16:28 +0100 Subject: [Javascript] Monitor an offsetHeight value In-Reply-To: <7.0.1.0.2.20070115082952.021edec8@juniperwebcraft.com> References: <45A66CE0.4050705@webdesignofficina.com> <7.0.1.0.2.20070111112747.02181a80@juniperwebcraft.com> <45AB9527.1080708@webdesignofficina.com> <7.0.1.0.2.20070115082952.021edec8@juniperwebcraft.com> Message-ID: <45AC97EC.3070507@webdesignofficina.com> Paul, Thank you for taking some time to post this useful reply... This surely has helped a lot... Regards, Guillaume > At 1/15/2007 06:52 AM, Guillaume wrote: >> Here's my function below re-aranged according to your replies... >> I still don't understand why, when checkOptSli() is called, I always >> get the else statement... Not being able >> to compare an initial value to a listened one... > > ... > >> function checkOptSli() { // This is fired when a user clicks a link >> >> var sto2 = 0; > > Why are you setting this variable? You don't use it for anything and > because it's local it can't be used anywhere else in your script. > > >> sto2ID = setTimeout("checkOptJ();", 2000); > > This sets sto2ID equal to the setTimeout() id, but it is a pointless > assignment statement because sto2ID is never used again inside this > function and being local it cannot be used anywhere else (although you > attempt to do so). > > Your script suggests that you believe setTimeout("checkOptJ();", > 2000); will return the result of function checkOptJ(), however > according to the manual setTimeout() returns "the ID of the timeout, > which can be used with window.clearTimeout." > http://developer.mozilla.org/en/docs/DOM:window.setTimeout > > >> } >> >> function checkOptJ() { >> >> var optsh0 = checkOptK; > > This statement sets optsh0 equal to the TEXT of function checkOptK(). > Probably what you want is: > > var optsh0 = checkOptK(); > > to get the RETURN VALUE from function checkOptK(). See: > http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Defining_Functions > > > >> optsh3 = optsh0;// Initial value (offsetHeight) of element > > No, this sets optsh3 equal to the TEXT of function checkOptK(). > Display its value with alert() to see what I mean. > > >> var optsh1 = 0; > > This is a pointless assignment statement since you do not use optsh1 > again within this function and, being local, it cannot be used > anywhere else. > > >> var optsh1ID = setTimeout("checkOptL();", 2000); > > Again this sets optsh1ID equal to the ID of this setTimeout() call, a > value that is really only useful to clearTimeout(). > > >> optsh4 = optsh1ID;// Value to be listened to and compared to the >> previous one above > > What's your purpose in passing the setTimeout() ID from one variable > to another? > > >> if ( optsh4 > optsh3 ) { > > This compares the id of the previous setTimeout() call to the text of > function checkOptK(), a nonsense comparison. > > You need to rewrite your code to return the changing heights of your > elements. > > > >> alert( "things have moved" ); >> } >> else { >> alert( "quiet" ); >> } >> } >> >> >> >> function checkOptK(){ // Fired on the onload so we have a value as >> starting point >> >> var opts1 = document.getElementById("options"); >> >> moveBy1 = opts1.offsetHeight; >> >> posTn3 = 0 - moveBy1; >> parseInt( posTn3 ); > > parseInt() is a function that returns a value. It does not affect the > value passed to it. You probably mean: > > posTn3 = parseInt( posTn3 ); > > http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide:Predefined_Functions:parseInt_and_parseFloat_Functions > > > > >> return posTn3; >> >> } >> >> function checkOptL(){ // Looped inside a setTimeout to see if this >> value is changing... // And compare it inside >> the checkOptJ()function to the checkOptK()resulting value >> >> var opts2 = document.getElementById("options"); >> >> moveBy2 = opts2.offsetHeight; >> >> posTn4 = 0 - moveBy2; >> >> parseInt( posTn4 ); >> >> return posTn4; >> >> } > > checkOptK() and checkOptL() performs identical functions -- you can > make them a single function called from two different places in your > code. > > > Guillaume, I strongly suggest that you read the JavaScript and DOM > documentation, and also that you use alert() to display values of your > variables as you go along to help you debug your code. It seems clear > from your code that you need to strengthen your understanding of basic > JavaScript syntax. > > Core JavaScript 1.5 Guide > http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Guide > > Gecko DOM Reference > http://developer.mozilla.org/en/docs/Gecko_DOM_Reference > > > Regards, > Paul > __________________________ > > Juniper Webcraft Ltd. > http://juniperwebcraft.com > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > From list at tridemail.de Fri Jan 19 08:51:59 2007 From: list at tridemail.de (Michael Borchers) Date: Fri, 19 Jan 2007 15:51:59 +0100 Subject: [Javascript] IE: tbody and innerHTML Message-ID: <000f01c73bd9$5f71e430$af24a8c0@mbpc> my script successfully creates an element TBODY var offersProductsTbody = document.createElement("TBODY"); offersProductsTbody.id = offersProductsRowID; offersProductsTable.appendChild(offersProductsTbody); document.getElementById(offersProductsRowID).innerHTML = 'test'; everything works fine when inserting HTML in FF, but as I understand, IE cannot use the innerHTML method for writing in . since the table is very big I cannot recreate it by DOM, it would be too much work. Any workaround?! From aaronbassett at gmail.com Fri Jan 19 09:14:08 2007 From: aaronbassett at gmail.com (Aaron Bassett) Date: Fri, 19 Jan 2007 15:14:08 +0000 Subject: [Javascript] IE: tbody and innerHTML In-Reply-To: <000f01c73bd9$5f71e430$af24a8c0@mbpc> References: <000f01c73bd9$5f71e430$af24a8c0@mbpc> Message-ID: <7cc847460701190714ufa9f94ds761f431ba706e7fb@mail.gmail.com> Could you target the element above the table? rather than the tbody and then use innerHTML to write the complete table rather than just the 's and 's?? On 1/19/07, Michael Borchers wrote: > > my script successfully creates an element TBODY > > var offersProductsTbody = document.createElement("TBODY"); > offersProductsTbody.id = offersProductsRowID; > > offersProductsTable.appendChild(offersProductsTbody); > > document.getElementById(offersProductsRowID).innerHTML = > 'test'; > > > > > everything works fine when inserting HTML in FF, > but as I understand, IE cannot use the innerHTML method > for writing in . > > since the table is very big I cannot recreate it by DOM, > it would be too much work. > > Any workaround?! > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -------------- next part -------------- An HTML attachment was scrubbed... URL: From list at tridemail.de Mon Jan 22 01:58:53 2007 From: list at tridemail.de (Michael Borchers) Date: Mon, 22 Jan 2007 08:58:53 +0100 Subject: [Javascript] IE: tbody and innerHTML References: <000f01c73bd9$5f71e430$af24a8c0@mbpc> <7cc847460701190714ufa9f94ds761f431ba706e7fb@mail.gmail.com> Message-ID: <005201c73dfb$291f9610$af24a8c0@mbpc> I will try to include my old DOM function that created the on the fly and add it to the table. A bit work when layout has to be changed, but it works fine so far. For each row I have a with an unique ID, the table looks like: ... Is there a way to count out the tableBodies in order to place the new row exactely before the ?! ----- Original Message ----- From: Aaron Bassett To: [JavaScript List] Sent: Friday, January 19, 2007 4:14 PM Subject: Re: [Javascript] IE: tbody and innerHTML Could you target the element above the table? rather than the tbody and then use innerHTML to write the complete table rather than just the 's and '; everything works fine when inserting HTML in FF, but as I understand, IE cannot use the innerHTML method for writing in . since the table is very big I cannot recreate it by DOM, it would be too much work. Any workaround?! -------------- next part -------------- An HTML attachment was scrubbed... URL: From list at tridemail.de Mon Jan 22 02:24:02 2007 From: list at tridemail.de (Michael Borchers) Date: Mon, 22 Jan 2007 09:24:02 +0100 Subject: [Javascript] DOM: adding CSS to created DIV Message-ID: <005601c73dfe$ac426b50$af24a8c0@mbpc> The first version works fine for FF, but not for IE. The second one works fine for both. var entryLayer = document.createElement('DIV'); entryLayer.setAttribute('id','calendarEntryFormLayer'); // FF, not IE: entryLayer.setAttribute('style','position:absolute;left:200px;top:300px;width:100px;height:100px;background-color:#ffffff;color:#ffffff;;border:1px solid #0b234c;padding-left:10px;z-index:3000;display:block;'); // both: entryLayer.style.cssText = 'position:absolute;left:200px;top:300px;width:100px;height:100px;background-color:#ffffff;color:#ffffff;;border:1px solid #0b234c;padding-left:10px;z-index:3000;display:block;'; document.body.appendChild(entryLayer); any reason? From list at tridemail.de Mon Jan 22 02:31:18 2007 From: list at tridemail.de (Michael Borchers) Date: Mon, 22 Jan 2007 09:31:18 +0100 Subject: [Javascript] z-index and form elements Message-ID: <005a01c73dff$b04d9de0$af24a8c0@mbpc> My
Layer is created "over" a HTML form. FF hides the form select elements behind the new layer, but in IE the form elements keep shining through no matter how high i set the z-index. is that normal for the IE? :( From david at dorward.me.uk Mon Jan 22 02:35:08 2007 From: david at dorward.me.uk (David Dorward) Date: Mon, 22 Jan 2007 08:35:08 +0000 Subject: [Javascript] DOM: adding CSS to created DIV In-Reply-To: <005601c73dfe$ac426b50$af24a8c0@mbpc> References: <005601c73dfe$ac426b50$af24a8c0@mbpc> Message-ID: <20070122083508.GB27016@us-lot.org> On Mon, Jan 22, 2007 at 09:24:02AM +0100, Michael Borchers wrote: > The first version works fine for FF, but not for IE. > entryLayer.setAttribute('id','calendarEntryFormLayer'); > // FF, not IE: > entryLayer.setAttribute('style','position:absolute;left:200px;top:300px;width:100px;height:100px;background-color:#ffffff;color:#ffffff;;border:1px > solid #0b234c;padding-left:10px;z-index:3000;display:block;'); > any reason? Internet Explorer's implementation of setAttribute is very broken. I suspect it looks something like this: function (attribute, value) { element[attribute] = value; } ... so if the HTML attribute syntax is different from the accessor property (as style is) or if the property and attribute names are different (class/className) then it breaks. -- David Dorward http://dorward.me.uk From list at tridemail.de Mon Jan 22 02:42:29 2007 From: list at tridemail.de (Michael Borchers) Date: Mon, 22 Jan 2007 09:42:29 +0100 Subject: [Javascript] DOM: adding CSS to created DIV References: <005601c73dfe$ac426b50$af24a8c0@mbpc> <20070122083508.GB27016@us-lot.org> Message-ID: <006701c73e01$4044f960$af24a8c0@mbpc> > On Mon, Jan 22, 2007 at 09:24:02AM +0100, Michael Borchers wrote: >> The first version works fine for FF, but not for IE. > >> entryLayer.setAttribute('id','calendarEntryFormLayer'); >> // FF, not IE: >> >> entryLayer.setAttribute('style','position:absolute;left:200px;top:300px;width:100px;height:100px;background-color:#ffffff;color:#ffffff;;border:1px >> solid #0b234c;padding-left:10px;z-index:3000;display:block;'); > >> any reason? > > Internet Explorer's implementation of setAttribute is very broken. > > I suspect it looks something like this: > > function (attribute, value) { > element[attribute] = value; > } > > ... so if the HTML attribute syntax is different from the accessor > property (as style is) or if the property and attribute names are > different (class/className) then it breaks. > > -- > David Dorward http://dorward.me.uk So .style.cssText will always work fine? From david at dorward.me.uk Mon Jan 22 02:41:53 2007 From: david at dorward.me.uk (David Dorward) Date: Mon, 22 Jan 2007 08:41:53 +0000 Subject: [Javascript] DOM: adding CSS to created DIV In-Reply-To: <006701c73e01$4044f960$af24a8c0@mbpc> References: <005601c73dfe$ac426b50$af24a8c0@mbpc> <20070122083508.GB27016@us-lot.org> <006701c73e01$4044f960$af24a8c0@mbpc> Message-ID: <20070122084152.GC27016@us-lot.org> On Mon, Jan 22, 2007 at 09:42:29AM +0100, Michael Borchers wrote: > So .style.cssText will always work fine? AFAIK it will, I've never used it (as setting a .className has usually done the trick for me when I wanted to set lots of styles at once). -- David Dorward http://dorward.me.uk From list at tridemail.de Mon Jan 22 02:50:36 2007 From: list at tridemail.de (Michael Borchers) Date: Mon, 22 Jan 2007 09:50:36 +0100 Subject: [Javascript] DOM: adding CSS to created DIV References: <005601c73dfe$ac426b50$af24a8c0@mbpc><20070122083508.GB27016@us-lot.org><006701c73e01$4044f960$af24a8c0@mbpc> <20070122084152.GC27016@us-lot.org> Message-ID: <006c01c73e02$62a0a3a0$af24a8c0@mbpc> > On Mon, Jan 22, 2007 at 09:42:29AM +0100, Michael Borchers wrote: > >> So .style.cssText will always work fine? > > AFAIK it will, I've never used it (as setting a .className has usually > done the trick for me when I wanted to set lots of styles at once). > > -- > David Dorward http://dorward.me.uk before i try: creating the div "on the fly" and just adding the class name as attribute would be enough to see the div with the styles i have adjusted to the CSS class? From david at dorward.me.uk Mon Jan 22 03:55:59 2007 From: david at dorward.me.uk (David Dorward) Date: Mon, 22 Jan 2007 09:55:59 +0000 Subject: [Javascript] DOM: adding CSS to created DIV In-Reply-To: <006c01c73e02$62a0a3a0$af24a8c0@mbpc> References: <20070122084152.GC27016@us-lot.org> <006c01c73e02$62a0a3a0$af24a8c0@mbpc> Message-ID: <20070122095559.GD27016@us-lot.org> On Mon, Jan 22, 2007 at 09:50:36AM +0100, Michael Borchers wrote: > >AFAIK it will, I've never used it (as setting a .className has usually > >done the trick for me when I wanted to set lots of styles at once). > before i try: creating the div "on the fly" and just adding the > class name as attribute As mentioned, IE's support for setAttribute is lacking. Set the .className property instead. > would be enough to see the div with the > styles i have adjusted to the CSS class? There is no such thing as a "CSS class". Classes are part of HTML. CSS has "class selectors" which (along with the other selectors in CSS) control what elements a declaration-block applies to. Making an HTML element a member of a class will cause styles in any declaration-block associated with a selector that matches that class to be applied on the fly though. -- David Dorward http://dorward.me.uk From rer at datacompusa.com Mon Jan 22 06:07:28 2007 From: rer at datacompusa.com (Roger Roelofs) Date: Mon, 22 Jan 2007 07:07:28 -0500 Subject: [Javascript] z-index and form elements In-Reply-To: <005a01c73dff$b04d9de0$af24a8c0@mbpc> References: <005a01c73dff$b04d9de0$af24a8c0@mbpc> Message-ID: <517CF700-C3B1-405F-AEFA-96BD8396D4A3@datacompusa.com> Michael, On Jan 22, 2007, at 3:31 AM, Michael Borchers wrote: > My
Layer is created "over" a HTML form. > FF hides the form select elements behind the new layer, but in IE > the form elements keep shining through no matter how high i set the > z-index. > is that normal for the IE? :( Yes :-( You can get around it by using an iframe instead of a div, or you can loop through the form and hide the individual elements. Roger ------------------------------------------------------- Roger Roelofs web www.datacompusa.com Datacomp Appraisal Services Email rer at datacompusa.com 3215 Eaglecrest Drive, NE Grand Rapids, MI 49525-4593 From peter at brunone.com Mon Jan 22 10:12:36 2007 From: peter at brunone.com (Peter Brunone) Date: Mon, 22 Jan 2007 09:12:36 -0700 Subject: [Javascript] z-index and form elements Message-ID: I assume you're talking about SELECT elements, since they're the ones with the bleed-through issue. The problem is that in IE6 and earlier, select elements are windowed objects (like flash movies, etc) and henceforth can't be covered up through the use of z-index. You do, however, have a couple of options. One is to use a composite HTML substitute for a dropdownlist, and the other is to hack the overlay div with an iframe to obscure the DDLs behind it (which is how http://easylistbox.com/demoBleeding.aspx works). There is of course a third option, which would be to hide the lists when the div appears, but that can get ugly and if the layer doesn't completely cover some of the lists, it looks kind of funny from the user's perspective. HTH, Peter From: "Michael Borchers" list at tridemail.de My Layer is created "over" a HTML form. FF hides the form select elements behind the new layer, but in IE the form elements keep shining through no matter how high i set the z-index. is that normal for the IE? :( -------------- next part -------------- An HTML attachment was scrubbed... URL: From robert at edico.si Mon Jan 22 20:01:30 2007 From: robert at edico.si (robert) Date: Tue, 23 Jan 2007 03:01:30 +0100 Subject: [Javascript] Focus problem with Firefox Message-ID: <000901c73e92$67bdfc80$6501a8c0@expres> I have problem with this piece of code in Mozzila Firefox (Ver. 1.5.0.9). IE works as expected. The problem is, that after leaving first input field, the focus does change to box3, but the cursor is not visible. Any suggestions? Box 1:
Box 2:
Box 3:
-------------- next part -------------- An HTML attachment was scrubbed... URL: From coldfusion.developer at att.net Mon Jan 22 20:23:52 2007 From: coldfusion.developer at att.net (coldfusion.developer at att.net) Date: Tue, 23 Jan 2007 02:23:52 +0000 Subject: [Javascript] Images for Tabs Message-ID: <012320070223.10121.45B571B8000403CA0000278921604666489D0A9F01040A900A0BD20201079C9A000B04010C@att.net> All, Any help woul dbe great. I have this row of images. The functionality I have working is that each tabbed image is grayed out and changes to a colorized version of the same tab after you click on the tab. What I can't figure out is how to get the first image to show the colorized version by default when the page loads and the turn off as the user clicks on the other tabs. Should I add to the Untitled Document
's?? On 1/19/07, Michael Borchers wrote: my script successfully creates an element TBODY var offersProductsTbody = document.createElement("TBODY"); offersProductsTbody.id = offersProductsRowID; offersProductsTable.appendChild(offersProductsTbody); document.getElementById(offersProductsRowID).innerHTML = '
test
-------------- next part -------------- An HTML attachment was scrubbed... URL: From wdlists at triche-osborne.com Tue Jan 23 12:32:50 2007 From: wdlists at triche-osborne.com (Triche Osborne) Date: Tue, 23 Jan 2007 12:32:50 -0600 Subject: [Javascript] Focus problem with Firefox In-Reply-To: <000901c73e92$67bdfc80$6501a8c0@expres> References: <000901c73e92$67bdfc80$6501a8c0@expres> Message-ID: <45B654D2.8020305@triche-osborne.com> robert wrote: > I have problem with this piece of code in Mozzila Firefox (Ver. 1.5.0.9). IE > works as expected. The problem is, that after leaving first input field, the > focus does change to box3, but the cursor is not visible. Any suggestions? > I did some additional testing on this. Without going into the observational details, the tests seem to indicate that upon exiting the trigger field, both browsers automatically spawn a default focus on the next field in tab order. However, whereas IE cancels that default focus in favor of the new field, FF doesn't and gets confused as a result. (In FF, a subsequent tab away from this "no-man's-land focus" always returned to the location bar, regardless of what field it should have moved to.) Perhaps if you could tell us why and under what conditions you want to skip the second field (or focus on the third), we could be of more help with a workaround. Triche > > > > > > > > > > > > > > > > >
> > Box 1: onBlur='change_focus();'>
> > Box 2:
> > Box 3:
> >
> > > > > > > > > ------------------------------------------------------------------------ > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From javascript at webdesignofficina.com Wed Jan 24 12:31:56 2007 From: javascript at webdesignofficina.com (Guillaume) Date: Wed, 24 Jan 2007 19:31:56 +0100 Subject: [Javascript] Wait for a delayed function to end to start another... Message-ID: <45B7A61C.90700@webdesignofficina.com> I have two functions showing / hiding layer, each one with a different delay. Each function is fired with it's individual link: Show ( ShowDelayed() ) // Hide ( HideDelayed() ) How do I avoid these function of running together, at the same time, if a user clicks alternatively on the two links for example... Each function should first end before the other one starts running... I have to achieve this inside the script and can't use a delayed onclick for example... Don't know if this is clear... Have a rough example below... Regards, Guillaume var HideChk = false; function Hide() { if (HideChk) return; HideChk = true; var opts1 = document.getElementById("options"); opts1.style.display = "none"; } function HideDelayed() { setTimeout('Hide()',6000) } var ShowChk = false; function Show() { if (ShowChk) return; ShowChk = true; var opts1 = document.getElementById("options"); opts1.style.display = "block"; } function ShowDelayed() { setTimeout('Show()',3000) } From peter at brunone.com Wed Jan 24 12:46:38 2007 From: peter at brunone.com (Peter Brunone) Date: Wed, 24 Jan 2007 11:46:38 -0700 Subject: [Javascript] Wait for a delayed function to end to start another... Message-ID: <3e8aa21bd38a4a5f8f14d0bd204d5ef4@brunone.com> What about another global variable that flips before when you call setTimeout, and resets when the function actually runs? From: Guillaume javascript at webdesignofficina.com I have two functions showing / hiding layer, each one with a different delay. Each function is fired with it's individual link: Show ( ShowDelayed() ) // Hide ( HideDelayed() ) How do I avoid these function of running together, at the same time, if a user clicks alternatively on the two links for example... Each function should first end before the other one starts running... I have to achieve this inside the script and can't use a delayed onclick for example... Don't know if this is clear... Have a rough example below... Regards, Guillaume var HideChk = false; function Hide() { if (HideChk) return; HideChk = true; var opts1 = document.getElementById("options"); opts1.style.display = "none"; } function HideDelayed() { setTimeout('Hide()',6000) } var ShowChk = false; function Show() { if (ShowChk) return; ShowChk = true; var opts1 = document.getElementById("options"); opts1.style.display = "block"; } function ShowDelayed() { setTimeout('Show()',3000) } -------------- next part -------------- An HTML attachment was scrubbed... URL: From mdougherty at pbp.com Wed Jan 24 12:58:41 2007 From: mdougherty at pbp.com (Mike Dougherty) Date: Wed, 24 Jan 2007 13:58:41 -0500 Subject: [Javascript] Wait for a delayed function to end to start another... In-Reply-To: <3e8aa21bd38a4a5f8f14d0bd204d5ef4@brunone.com> References: <3e8aa21bd38a4a5f8f14d0bd204d5ef4@brunone.com> Message-ID: wouldn't the concurrent calls only be a problem if the target were the same object? So if there is no need for the semaphore to block two different objects, the global variable you mentioned could be a property value set on the object itself. With that strategy, the delayed functions could check their respective objects' semaphore and either cancel self, or cancel pending action and replace with self. This allows two different objects to have delayed actions without interfering with each other. (though I question the value of an intentially delayed user experience, but that's another issue) On Wed, 24 Jan 2007 11:46:38 -0700 "Peter Brunone" wrote: > > What about another global variable that flips before when you call setTimeout, and resets when >the function actually runs? From janie.hadsel at gmail.com Fri Jan 26 18:12:32 2007 From: janie.hadsel at gmail.com (Janie Hadsel) Date: Fri, 26 Jan 2007 19:12:32 -0500 Subject: [Javascript] Scroller Message-ID: <981043b0701261612u767ab859k63db2963ce3cc247@mail.gmail.com> Does anyone know of a good div scroller script? I've tried to implement the one from the "JavaScript & DHTML Cookbook", but it's old and doesn't work in Safari or correctly in Netscape 7.2 (the bottom portion of text cuts off when the down button is pressed.) There are a lot of scroller scripts on the Web, but they are mostly for images or other content of specified length. I need to scroll div content up and down with my own image buttons (no ugly scrollbars). The text is set in relative terms (i.e. ems or percentages), so the div length will change according to the user's font size. Thx, JH -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul at juniperwebcraft.com Fri Jan 26 19:15:40 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Fri, 26 Jan 2007 17:15:40 -0800 Subject: [Javascript] Focus problem with Firefox In-Reply-To: <000901c73e92$67bdfc80$6501a8c0@expres> References: <000901c73e92$67bdfc80$6501a8c0@expres> Message-ID: <7.0.1.0.2.20070126171202.023149c8@juniperwebcraft.com> At 1/22/2007 06:01 PM, robert wrote: >I have problem with this piece of code in Mozzila Firefox (Ver. >1.5.0.9). IE works as expected. The problem is, that after leaving >first input field, the focus does change to box3, but the cursor is >not visible. Any suggestions? ... >function change_focus() >{ >document.myform.box3.focus(); >} ... >
>Box 1:
>Box 2:
>Box 3:
>
Why not simply use the HTML tabindex attribute? That way your user interface won't break when scripting is disabled. HTML 4.01 Specification 17 Forms 17.11.1 Tabbing navigation http://www.w3.org/TR/html4/interact/forms.html#h-17.11.1 Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From paul at juniperwebcraft.com Fri Jan 26 19:36:14 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Fri, 26 Jan 2007 17:36:14 -0800 Subject: [Javascript] Scroller In-Reply-To: <981043b0701261612u767ab859k63db2963ce3cc247@mail.gmail.com > References: <981043b0701261612u767ab859k63db2963ce3cc247@mail.gmail.com> Message-ID: <7.0.1.0.2.20070126171605.0222d1b0@juniperwebcraft.com> At 1/26/2007 04:12 PM, Janie Hadsel wrote: >Does anyone know of a good div scroller script? This isn't the answer you're looking for, but I'll venture the opinion that the only good scroller is a dead scroller. All of the ones I've encountered are highly inaccessible: can't be driven by a keyboard and require fine motor control that can be challenging even without visual, muscular, or neurological disabilities. They also haven't been compatible with the scroll wheel on the modern mouse, forcing most users to change their ergonomic interactive habits just to read one page in a million. And for what gain? I realize you're probably trying to create scrolling content in the middle of a static field but I'd urge you to consider alternatives such as CSS {position: static} to freeze the non-scrolling content or {overflow: scroll} for the div itself. I know scrollbars are ugly, but they work and they work with existing assistive technology. If you proceed, I urge you to devise a scroller that's accessible and easy to use. Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From paul at juniperwebcraft.com Fri Jan 26 19:51:48 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Fri, 26 Jan 2007 17:51:48 -0800 Subject: [Javascript] Images for Tabs In-Reply-To: <012320070223.10121.45B571B8000403CA0000278921604666489D0A9 F01040A900A0BD20201079C9A000B04010C@att.net> References: <012320070223.10121.45B571B8000403CA0000278921604666489D0A9F01040A900A0BD20201079C9A000B04010C@att.net> Message-ID: <7.0.1.0.2.20070126174102.023a9a70@juniperwebcraft.com> At 1/22/2007 06:23 PM, coldfusion.developer at att.net wrote: >I have this row of images. The functionality I have working is that >each tabbed image is grayed out and changes to a colorized version of >the same tab after you click on the tab. What I can't figure out is >how to get the first image to show >the colorized version by default when the page loads and the turn off >as the user clicks on the other tabs. I would put the color versions of the images into the markup, then use JavaScript to change the img src to the gray on click. 1) On page load, loop through the images and assign the onclick behavior to each one, pointing to the turnGray() function. 2) turnGray() modifes the current image's src attribute, changing the image name from the color version to the gray version. This simple model will let you dispense with a lot of the scripting and markup you're currently using. Any process that depends on JavaScript will not work when scripting is disabled, so you might consider whether your page is usable with scripting turned off, and if not provide an alternative that works. For example, each image in question could be wrapped in an anchor which reloads the current page with that image src changed from color to gray. The start-up loop that assigns onclick behavior can apply it to those anchors, replacing the call to the server with the immediate JavaScript action. What's the purpose of graying the images? If it's information that needs to be remembered the next time the user returns to the page, you might consider a server-side scripting solution for persistence, or wrapping each image in an anchor which, once visited, changes its child image to the gray version. (That latter is a CSS solution not requiring JavaScript.) Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From tedd at sperling.com Sat Jan 27 10:13:00 2007 From: tedd at sperling.com (tedd) Date: Sat, 27 Jan 2007 11:13:00 -0500 Subject: [Javascript] Opacity the the GIF Message-ID: Hi gang: I've tried to do this, but can't seem to get the hang of it. Does anyone know how to change the opacity of an animated GIF using javascript? If not code (preferable), references will do. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From billy.reisinger at gmail.com Sat Jan 27 14:03:39 2007 From: billy.reisinger at gmail.com (Billy Reisinger) Date: Sat, 27 Jan 2007 14:03:39 -0600 Subject: [Javascript] Opacity the the GIF In-Reply-To: References: Message-ID: <33C5C2D0-B90F-429D-BAEC-7F6509C329AE@gmail.com> w3c browser (FF, Opera, Safari(?)): img.style.opacity = [float between 0.0 and 1.0] IE: img.style.filter = "alpha:opacity=" + [integer between 0 and 100] On Jan 27, 2007, at 10:13 AM, tedd wrote: > Hi gang: > > I've tried to do this, but can't seem to get the hang of it. > > Does anyone know how to change the opacity of an animated GIF using > javascript? > > If not code (preferable), references will do. > > tedd > -- > ------- > http://sperling.com http://ancientstones.com http://earthstones.com > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From tedd at sperling.com Sat Jan 27 14:21:41 2007 From: tedd at sperling.com (tedd) Date: Sat, 27 Jan 2007 15:21:41 -0500 Subject: [Javascript] embedded vs external Message-ID: Hi gang: I have an embedded javascript that I want to take to an external file and load it in that way. However, when I do, the script doesn't run any more. Can all embedded script be removed and placed in a file for import? I thought so, but I'm not sure any more. tedd PS: The example is at: http://sperling.com/a/ -- it's the bird. Note the critter keeps it's place between refreshes between Home and Web Tips. PPS: Sue, I also added a fade, but it doesn't work for Opera. -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From leeu at cfl.rr.com Sat Jan 27 14:59:15 2007 From: leeu at cfl.rr.com (Lee Underwood) Date: Sat, 27 Jan 2007 15:59:15 -0500 Subject: [Javascript] embedded vs external In-Reply-To: References: Message-ID: <200701272059.l0RKxK5S014122@ms-smtp-05.tampabay.rr.com> Did you leave the script tags out when you placed them in the external file? Also, did you check the path to the external file? Lee On 1/27/2007 03:21 PM, tedd wrote: ........................................................ >Hi gang: > >I have an embedded javascript that I want to take to an external >file and load it in that way. However, when I do, the script doesn't >run any more. Can all embedded script be removed and placed in a >file for import? I thought so, but I'm not sure any more. > >tedd > >PS: The example is at: http://sperling.com/a/ -- it's the bird. >Note the critter keeps it's place between refreshes between Home and Web Tips. > >PPS: Sue, I also added a fade, but it doesn't work for Opera. >-- >------- >http://sperling.com http://ancientstones.com http://earthstones.com >_______________________________________________ >Javascript mailing list >Javascript at LaTech.edu >https://lists.LaTech.edu/mailman/listinfo/javascript ........................................................ From tedd at sperling.com Sun Jan 28 08:13:14 2007 From: tedd at sperling.com (tedd) Date: Sun, 28 Jan 2007 09:13:14 -0500 Subject: [Javascript] embedded vs external In-Reply-To: <200701272059.l0RKxK5S014122@ms-smtp-05.tampabay.rr.com> References: <200701272059.l0RKxK5S014122@ms-smtp-05.tampabay.rr.com> Message-ID: At 3:59 PM -0500 1/27/07, Lee Underwood wrote: >Did you leave the script tags out when you placed them in the external file? > >Also, did you check the path to the external file? > >Lee Lee: Yes, on both counts -- I've done a few of these, but something about this one is different and I can't figure out what's the problem, but I will. Thanks. tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From mwarden at gmail.com Sun Jan 28 14:06:41 2007 From: mwarden at gmail.com (Matt Warden) Date: Sun, 28 Jan 2007 15:06:41 -0500 Subject: [Javascript] embedded vs external In-Reply-To: References: Message-ID: On 1/27/07, tedd wrote: > Hi gang: > > I have an embedded javascript that I want to take to an external file > and load it in that way. However, when I do, the script doesn't run > any more. Can all embedded script be removed and placed in a file for > import? I thought so, but I'm not sure any more. There are no external javascript files on the page you linked, so we can't look into it. But the answer to your question is yes. -- Matt Warden Cleveland, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From henrique.renno at gmail.com Tue Jan 30 07:00:27 2007 From: henrique.renno at gmail.com (=?ISO-8859-1?Q?Henrique_Renn=F3?=) Date: Tue, 30 Jan 2007 11:00:27 -0200 Subject: [Javascript] Database and SQL Message-ID: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> Hello!!! I have an Access Database and a form I had created to do some queries on the data. One of the things I do is when the user clicks to open a dropdown box it executes some code in VBA to compose a SQL statement and search for all values stored in the field that this dropdown box will contain. Now I need to put this database on the web and I'm using the perl module DBD::ODBC that works very fine in order to access the Access database tables. I had put a html "form" tag with a "select" tag that I want to work the same way the dropdown box works in the Access form. What I'm in doubt is if there is a way of executing a script (with the form's action method) every time a "select" (dropdown) box is open to load into it all the values from the field in the database. Usually when a script is executed it loads the results into another page (or a new window) but in this case the values should go into a component without loading some other page. I don't know if doing it using Javascript is possible but I'd like some hints of other kinds of technology I should learn like JSP or Servlets, whatever could make this SQL query works the way I described. Thanks!!! -- Henrique -------------- next part -------------- An HTML attachment was scrubbed... URL: From billy.reisinger at gmail.com Tue Jan 30 07:23:07 2007 From: billy.reisinger at gmail.com (Billy Reisinger) Date: Tue, 30 Jan 2007 07:23:07 -0600 Subject: [Javascript] Database and SQL In-Reply-To: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> References: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> Message-ID: <318DB43D-FA41-411C-B4AE-80A3281E4F57@gmail.com> Javascript is event-driven. The "change" event fires when the user changes a drop down (select) value. You can use Ajax to pass data between the client and server, so you could build the GET or POST query from the change event (fired by the drop down), hit the url with Ajax, use whatever server side technology you want to do the db query, and return the content to the client. You'll then need to drop the returned content onto the page using Javascript. On Jan 30, 2007, at 7:00 AM, Henrique Renn? wrote: > Hello!!! > > I have an Access Database and a form I had created to do some > queries on the data. One of the things I do is when the user clicks > to open a dropdown box it executes some code in VBA to compose a > SQL statement and search for all values stored in the field that > this dropdown box will contain. Now I need to put this database on > the web and I'm using the perl module DBD::ODBC that works very > fine in order to access the Access database tables. > > I had put a html "form" tag with a "select" tag that I want to work > the same way the dropdown box works in the Access form. What I'm in > doubt is if there is a way of executing a script (with the form's > action method) every time a "select" (dropdown) box is open to load > into it all the values from the field in the database. Usually when > a script is executed it loads the results into another page (or a > new window) but in this case the values should go into a component > without loading some other page. > > I don't know if doing it using Javascript is possible but I'd like > some hints of other kinds of technology I should learn like JSP or > Servlets, whatever could make this SQL query works the way I > described. > > Thanks!!! > > -- > Henrique > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript From flavio at economisa.com.br Tue Jan 30 08:08:37 2007 From: flavio at economisa.com.br (=?ISO-8859-1?Q?Fl=E1vio_Gomes?=) Date: Tue, 30 Jan 2007 11:08:37 -0300 Subject: [Javascript] Database and SQL In-Reply-To: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> References: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> Message-ID: <45BF5165.9030607@economisa.com.br> AJAX, "Asynchronous JavaScript and XML", that's the name of the technology used for loading "the values into a component without loading some other page". Or maybe, depending on your case, if is not there a need to change the values from the dropdown "onclick" you could already write (on your serverside language) the page/dropdown with the values there. Henrique Renn? escreveu: > Hello!!! > > I have an Access Database and a form I had created to do some queries > on the data. One of the things I do is when the user clicks to open a > dropdown box it executes some code in VBA to compose a SQL statement > and search for all values stored in the field that this dropdown box > will contain. Now I need to put this database on the web and I'm using > the perl module DBD::ODBC that works very fine in order to access the > Access database tables. > > I had put a html "form" tag with a "select" tag that I want to work > the same way the dropdown box works in the Access form. What I'm in > doubt is if there is a way of executing a script (with the form's > action method) every time a "select" (dropdown) box is open to load > into it all the values from the field in the database. Usually when a > script is executed it loads the results into another page (or a new > window) but in this case the values should go into a component without > loading some other page. > > I don't know if doing it using Javascript is possible but I'd like > some hints of other kinds of technology I should learn like JSP or > Servlets, whatever could make this SQL query works the way I described. > > Thanks!!! > > -- > Henrique > >------------------------------------------------------------------------ > >_______________________________________________ >Javascript mailing list >Javascript at LaTech.edu >https://lists.LaTech.edu/mailman/listinfo/javascript > > -- Flavio Gomes flavio at economisa.com.br From mdougherty at pbp.com Tue Jan 30 08:55:17 2007 From: mdougherty at pbp.com (Mike Dougherty) Date: Tue, 30 Jan 2007 09:55:17 -0500 Subject: [Javascript] Database and SQL In-Reply-To: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> References: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> Message-ID: Do you have an example of your page so we can look at it? I ddin't assume ajax. I thought the idea was to make an option list from a database. That can be done on the web server before the page is downloaded. You wouldn't even need javascript (unless you're using server-side javascript) If you want two selects such that the choice in the first select determines the contents of the second select, then try an old-school dhtml solution. (you have less than a hundred options per select, correct?) On Tue, 30 Jan 2007 11:00:27 -0200 "Henrique Renn?" wrote: > Hello!!! > > I have an Access Database and a form I had created to do some queries on the > data. One of the things I do is when the user clicks to open a dropdown box > it executes some code in VBA to compose a SQL statement and search for all > values stored in the field that this dropdown box will contain. Now I need > to put this database on the web and I'm using the perl module DBD::ODBC that > works very fine in order to access the Access database tables. > > I had put a html "form" tag with a "select" tag that I want to work the same > way the dropdown box works in the Access form. What I'm in doubt is if there > is a way of executing a script (with the form's action method) every time a > "select" (dropdown) box is open to load into it all the values from the > field in the database. Usually when a script is executed it loads the > results into another page (or a new window) but in this case the values > should go into a component without loading some other page. > > I don't know if doing it using Javascript is possible but I'd like some > hints of other kinds of technology I should learn like JSP or Servlets, > whatever could make this SQL query works the way I described. > > Thanks!!! > > -- > Henrique From david at dorward.me.uk Tue Jan 30 08:54:34 2007 From: david at dorward.me.uk (David Dorward) Date: Tue, 30 Jan 2007 14:54:34 +0000 Subject: [Javascript] Database and SQL In-Reply-To: References: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> Message-ID: <20070130145434.GB18243@us-lot.org> On Tue, Jan 30, 2007 at 09:55:17AM -0500, Mike Dougherty wrote: > If you want two selects such that the choice in the first select determines > the contents of the second select, then try an old-school dhtml solution. > (you have less than a hundred options per select, correct?) Or take the scary "Store the dependent select's possible values as JSON strings in the master select's options" route I did last time I came across this problem. >:) -- David Dorward http://dorward.me.uk From henrique.renno at gmail.com Tue Jan 30 09:35:41 2007 From: henrique.renno at gmail.com (=?ISO-8859-1?Q?Henrique_Renn=F3?=) Date: Tue, 30 Jan 2007 13:35:41 -0200 Subject: [Javascript] Database and SQL In-Reply-To: References: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> Message-ID: <3e7bcb580701300735i533d12e3yf91c7b0132ae54f0@mail.gmail.com> Hello!!! I don't have an example of my page but I'll try to describe the whole idea behind it: There are two fields where will be put an initial date and a final date which will be part of the SQL filter statement. There will be a dropdown box (select box) that when the user clicks on it, he/she will select a country's state where all the values (state's names) are stored in a field from a table in the Access database and will be loaded into the select box being at most 30 values (I did it in a form inside Access using VBA for the event onClick and using a ADODB component to access the table and get the values executing an SQL statement constructed and stored in a String variable). Then the user will select an option from these ones that were loaded into the select box (he/she will select a state's name) and there will be another select box that will show values (cities' names) according to the one selected inside the first select box where the first select box with states works as a filter for the second one with cities (again, using VBA I did with no problems, just created the SQL statement and executed it). I think that solving these issues is almost all the work done as the other things that the page will contain I know how to deal with simple Javascript. Thanks a lot for the attention of all!!!! On 1/30/07, Mike Dougherty wrote: > > Do you have an example of your page so we can look at it? > > I ddin't assume ajax. I thought the idea was to make an option list from > a database. That can be > done on the web server before the page is downloaded. You wouldn't even > need javascript (unless > you're using server-side javascript) > > If you want two selects such that the choice in the first select > determines the contents of the > second select, then try an old-school dhtml solution. (you have less than > a hundred options per > select, correct?) > > > > On Tue, 30 Jan 2007 11:00:27 -0200 > "Henrique Renn?" wrote: > > Hello!!! > > > > I have an Access Database and a form I had created to do some queries on > the > > data. One of the things I do is when the user clicks to open a dropdown > box > > it executes some code in VBA to compose a SQL statement and search for > all > > values stored in the field that this dropdown box will contain. Now I > need > > to put this database on the web and I'm using the perl module DBD::ODBC > that > > works very fine in order to access the Access database tables. > > > > I had put a html "form" tag with a "select" tag that I want to work the > same > > way the dropdown box works in the Access form. What I'm in doubt is if > there > > is a way of executing a script (with the form's action method) every > time a > > "select" (dropdown) box is open to load into it all the values from the > > field in the database. Usually when a script is executed it loads the > > results into another page (or a new window) but in this case the values > > should go into a component without loading some other page. > > > > I don't know if doing it using Javascript is possible but I'd like some > > hints of other kinds of technology I should learn like JSP or Servlets, > > whatever could make this SQL query works the way I described. > > > > Thanks!!! > > > > -- > > Henrique > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -- Henrique -------------- next part -------------- An HTML attachment was scrubbed... URL: From lbettridge at twowaytv.co.uk Tue Jan 30 10:24:47 2007 From: lbettridge at twowaytv.co.uk (Lee Bettridge) Date: Tue, 30 Jan 2007 16:24:47 -0000 Subject: [Javascript] is their a javascript function, or DOM property to find the char limit of a table cell or div? In-Reply-To: <3e7bcb580701300735i533d12e3yf91c7b0132ae54f0@mail.gmail.com> Message-ID: I need to manually scroll a large body of text in a table cell or div tag and was wondering if their is a way to find out how many characters will fit into an area of a given size ? Normally in a browser environment any overflow would automatically be handled by scroll bars (unless scroll bars are explicitly turned off), but I am working in a TV browser and remote control environment and cannot use scroll bars. Lee. -- Two Way TV is the trading name of Two Way Media Ltd Company Number: 4904168 -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul at juniperwebcraft.com Tue Jan 30 10:59:35 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Tue, 30 Jan 2007 08:59:35 -0800 Subject: [Javascript] Database and SQL In-Reply-To: <3e7bcb580701300735i533d12e3yf91c7b0132ae54f0@mail.gmail.co m> References: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> <3e7bcb580701300735i533d12e3yf91c7b0132ae54f0@mail.gmail.com> Message-ID: <7.0.1.0.2.20070130083939.023029f8@juniperwebcraft.com> At 1/30/2007 07:35 AM, Henrique Renn? wrote: >There are two fields where will be put an >initial date and a final date which will be part of the SQL filter statement. > >There will be a dropdown box (select box) that >when the user clicks on it, he/she will select a >country's state where all the values (state's >names) are stored in a field from a table in the >Access database and will be loaded into the >select box being at most 30 values (I did it in >a form inside Access using VBA for the event >onClick and using a ADODB component to access >the table and get the values executing an SQL >statement constructed and stored in a String variable). > >Then the user will select an option from these >ones that were loaded into the select box >(he/she will select a state's name) and there >will be another select box that will show values >(cities' names) according to the one selected >inside the first select box where the first >select box with states works as a filter for the >second one with cities (again, using VBA I did >with no problems, just created the SQL statement and executed it). Unless you have strict control over all the users of this application, you can't guarantee that everyone will have javascript enabled. Therefore if you don't want the application to break for some users you should make sure it works when javascript is turned off. A non-javascript version might look like this: - download the page with states in a list - if it's a list of anchors, the user clicks on a state - if it's a select control, the user selects a state then submits form - download the page with the cities for the selected state (and the states so the user can look at another state) - if it's a list of anchors, the user clicks on a city - if it's a select control, the user selects a city then submits form - download the page with the results of the state-city query When javascript is running, the process could like like this: - download the page with states list and cities list, perhaps with the cities list hidden from view - user selects a state - javascript produces the resultant cities list, either: - by filtering a complete state-city list already in the page or: - by requesting the cities list from the server using HttpXMLRequest - user selects city - javascript produces the results, either: - by filtering results from data already in the page or: - by requesting the results from the server using HttpXMLRequest Both of these processes (javascript and non-javascript) could occur with the same downloaded page. When javascript is running, it dynamically hides & displays page elements that the non-javascript version needs to return to the server for. Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From alaneaston666 at hotmail.com Tue Jan 30 11:01:30 2007 From: alaneaston666 at hotmail.com (Alan Easton) Date: Tue, 30 Jan 2007 17:01:30 +0000 Subject: [Javascript] Auto-submit form every X minutes Message-ID: An HTML attachment was scrubbed... URL: From paul at juniperwebcraft.com Tue Jan 30 11:32:48 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Tue, 30 Jan 2007 09:32:48 -0800 Subject: [Javascript] Auto-submit form every X minutes In-Reply-To: References: Message-ID: <7.0.1.0.2.20070130092745.02331a50@juniperwebcraft.com> At 1/30/2007 09:01 AM, Alan Easton wrote: >I am wanting to auto-submit a form every x mins. I have the following code. > > > >However, this is an ASP page, and I have 4 submit buttons, each >performing different actions on the page. The page gets submitted to >itself, and I grab the name of each button and perform something different. > >I would like to simply add a auto-save, so is there anyway I can use >JS to auto submit one of those buttons that I already have, like >instead of it being clicked, it is captures in an onsubmit event or something. I suppose you could invoke the click() method on the button of your choice. http://developer.mozilla.org/en/docs/DOM:element.click Also don't forget you can create and modify hidden input elements on the fly to feed whatever values you need to the server on submit. http://www.w3.org/TR/html4/interact/forms.html#hidden-control Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From john at jwarner.com Tue Jan 30 12:20:10 2007 From: john at jwarner.com (John Warner) Date: Tue, 30 Jan 2007 13:20:10 -0500 Subject: [Javascript] is their a javascript function, or DOM property to find the char limit of a table cell or div? In-Reply-To: Message-ID: <01b101c7449b$478bea80$4701a8c0@earth> Wouldn't the font the user has selected for his browser (if he chose to override page - say vision problems) impact this? John Warner -----Original Message----- From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu] On Behalf Of Lee Bettridge Sent: Tuesday, January 30, 2007 11:25 AM To: [JavaScript List] Subject: [Javascript] is their a javascript function,or DOM property to find the char limit of a table cell or div? I need to manually scroll a large body of text in a table cell or div tag and was wondering if their is a way to find out how many characters will fit into an area of a given size ? Normally in a browser environment any overflow would automatically be handled by scroll bars (unless scroll bars are explicitly turned off), but I am working in a TV browser and remote control environment and cannot use scroll bars. Lee. -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul at juniperwebcraft.com Tue Jan 30 13:52:39 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Tue, 30 Jan 2007 11:52:39 -0800 Subject: [Javascript] is their a javascript function, or DOM property to find the char limit of a table cell or div? In-Reply-To: <01b101c7449b$478bea80$4701a8c0@earth> References: <01b101c7449b$478bea80$4701a8c0@earth> Message-ID: <7.0.1.0.2.20070130110259.0218c318@juniperwebcraft.com> At 1/30/2007 08:24 AM, Lee Bettridge wrote: >Content-class: urn:content-classes:message >Content-Type: multipart/alternative; > boundary="----_=_NextPart_001_01C7448B.28869C13" > > I need to manually scroll a large body of text in a table cell or > div tag and was wondering if their is a way to find out how many > characters will fit into an area of a given size ? > >Normally in a browser environment any overflow would automatically >be handled by scroll bars (unless scroll bars are explicitly turned >off), but I am working in a TV browser and remote control >environment and cannot use scroll bars. At 1/30/2007 10:20 AM, John Warner wrote: >Wouldn't the font the user has selected for his browser (if he chose >to override page - say vision problems) impact this? I wonder if this is a table of content scrolling in the browser window or a table cell with content that scrolls because the cell has been styled with {overflow: scroll} in CSS? Yes, so he would need to look up the current font size, line height, margins, and padding as determined by inline styling + stylesheets + default styling to calculate the height of text blocks in the scrolling area. Unless of course the TV browser allows for a fixed font-size (ick) or isn't capable of font resizing (double-ick), in which case everything may be known from the outset. If the content consists of a series of page elements (table rows, paragraphs, divs) then javascript can step through them until it finds one that begins below the bottom of the window and thereby determine through trial and error how many rows fit in the window without having to calculate anything. It sounds like Lee is visualizing a page-up, page-down scenario in which the scrolling text moves up or down one div-height. An alternative might be to move it up or down one or more rows (or a percentage of window height) and let the user key repeatedly to shift up & down. In my experience some people are confused by page-up & page-down: because the entire contents of the window changes there's no perceptible movement up or down. Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From ferrettinico at gmail.com Tue Jan 30 14:54:51 2007 From: ferrettinico at gmail.com (Nico Ferretti) Date: Tue, 30 Jan 2007 17:54:51 -0300 Subject: [Javascript] INPUT TEXT show last characters Message-ID: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> Hi! I have a page with a lot of INPUT TEXT elements, already filled with URL's (so they have long strings within them). The problem is that I want to show the end of the string, not the beginning when the page loads. For example: ---------------------- |https://lists.lat| ---------------------- (the end would be ech.edu//pipermail/javascript/2007-January/thread.html) I want to show ---------------------- |ry/thread.html| ---------------------- Thanks in advance, Nico.- -------------- next part -------------- An HTML attachment was scrubbed... URL: From rvandam00 at gmail.com Tue Jan 30 20:09:58 2007 From: rvandam00 at gmail.com (Robert Van Dam) Date: Tue, 30 Jan 2007 19:09:58 -0700 Subject: [Javascript] INPUT TEXT show last characters In-Reply-To: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> Message-ID: <1815f00701301809p355bb6f7v7314c3755dadbf8c@mail.gmail.com> On 1/30/07, Nico Ferretti wrote: > Hi! > > I have a page with a lot of INPUT TEXT elements, already filled with URL's > (so they have long strings within them). > > The problem is that I want to show the end of the string, not the beginning > when the page loads. > > For example: > > ---------------------- > |https://lists.lat| > ---------------------- > > (the end would be > ech.edu//pipermail/javascript/2007-January/thread.html ) > > I want to show > > ---------------------- > |ry/thread.html| > ---------------------- Other than just making the text field large enough to show the entire string, I don't think its possible to do what you're asking for. However, you could hack it to work by having the page load with only the last X characters in the field and then as soon as someone clicks in the box, swap the short string for the full string. Unfortunately, in some (maybe all?) browsers that might suddenly snap the user to the beginning of the string which may not be a bit odd. Rob From lbettridge at twowaytv.co.uk Wed Jan 31 04:24:47 2007 From: lbettridge at twowaytv.co.uk (Lee Bettridge) Date: Wed, 31 Jan 2007 10:24:47 -0000 Subject: [Javascript] is their a javascript function, or DOMproperty to find the char limit of a table cell or div? In-Reply-To: <7.0.1.0.2.20070130110259.0218c318@juniperwebcraft.com> Message-ID: Paul, You were correct in that "It sounds like Lee is visualizing a page-up, page-down scenario in which the scrolling text moves up or down" and I move the text about half the height of the div tag so the user does not get lost. You were also correct in that the TV Browser does not 'to my knowledge', allow for font resizing or customizing, as text on a tv screen must be more constrained to remain readable. My problem is that the user can scroll down through the text and then keep scrolling down for ever, as I have no way of knowing when the text has finished, and no way of 'cutting' the text into pages so I can count them. -----Original Message----- From: javascript-bounces at LaTech.edu [mailto:javascript-bounces at LaTech.edu] On Behalf Of Paul Novitski Sent: 30 January 2007 19:53 To: javascript at LaTech.edu Subject: RE: [Javascript] is their a javascript function, or DOMproperty to find the char limit of a table cell or div? At 1/30/2007 08:24 AM, Lee Bettridge wrote: >Content-class: urn:content-classes:message >Content-Type: multipart/alternative; > boundary="----_=_NextPart_001_01C7448B.28869C13" > > I need to manually scroll a large body of text in a table cell or > div tag and was wondering if their is a way to find out how many > characters will fit into an area of a given size ? > >Normally in a browser environment any overflow would automatically >be handled by scroll bars (unless scroll bars are explicitly turned >off), but I am working in a TV browser and remote control >environment and cannot use scroll bars. At 1/30/2007 10:20 AM, John Warner wrote: >Wouldn't the font the user has selected for his browser (if he chose >to override page - say vision problems) impact this? I wonder if this is a table of content scrolling in the browser window or a table cell with content that scrolls because the cell has been styled with {overflow: scroll} in CSS? Yes, so he would need to look up the current font size, line height, margins, and padding as determined by inline styling + stylesheets + default styling to calculate the height of text blocks in the scrolling area. Unless of course the TV browser allows for a fixed font-size (ick) or isn't capable of font resizing (double-ick), in which case everything may be known from the outset. If the content consists of a series of page elements (table rows, paragraphs, divs) then javascript can step through them until it finds one that begins below the bottom of the window and thereby determine through trial and error how many rows fit in the window without having to calculate anything. It sounds like Lee is visualizing a page-up, page-down scenario in which the scrolling text moves up or down one div-height. An alternative might be to move it up or down one or more rows (or a percentage of window height) and let the user key repeatedly to shift up & down. In my experience some people are confused by page-up & page-down: because the entire contents of the window changes there's no perceptible movement up or down. Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com _______________________________________________ Javascript mailing list Javascript at LaTech.edu https://lists.LaTech.edu/mailman/listinfo/javascript -- Two Way TV is the trading name of Two Way Media Ltd Company Number: 4904168 From alaneaston666 at hotmail.com Wed Jan 31 04:27:29 2007 From: alaneaston666 at hotmail.com (Alan Easton) Date: Wed, 31 Jan 2007 10:27:29 +0000 Subject: [Javascript] Auto-submit form every X minutes In-Reply-To: <7.0.1.0.2.20070130092745.02331a50@juniperwebcraft.com> Message-ID: An HTML attachment was scrubbed... URL: From mdougherty at pbp.com Wed Jan 31 08:13:02 2007 From: mdougherty at pbp.com (Mike Dougherty) Date: Wed, 31 Jan 2007 09:13:02 -0500 Subject: [Javascript] INPUT TEXT show last characters In-Reply-To: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> Message-ID: have you tried css? input { text-align: right; } On Tue, 30 Jan 2007 17:54:51 -0300 "Nico Ferretti" wrote: > Hi! > > I have a page with a lot of INPUT TEXT elements, already filled with URL's > (so they have long strings within them). > > The problem is that I want to show the end of the string, not the beginning > when the page loads. > >For example: > > ---------------------- > |https://lists.lat| > ---------------------- > > (the end would be ech.edu//pipermail/javascript/2007-January/thread.html) > > I want to show > > ---------------------- > |ry/thread.html| > ---------------------- > > Thanks in advance, > > Nico.- From tedd at sperling.com Wed Jan 31 09:19:46 2007 From: tedd at sperling.com (tedd) Date: Wed, 31 Jan 2007 10:19:46 -0500 Subject: [Javascript] Database and SQL In-Reply-To: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> References: <3e7bcb580701300500s5e396b3aw8252389e000b2b6f@mail.gmail.com> Message-ID: At 11:00 AM -0200 1/30/07, Henrique Renn? wrote: >Hello!!! > >I have an Access Database and a form I had >created to do some queries on the data. One of >the things I do is when the user clicks to open >a dropdown box it executes some code in VBA to >compose a SQL statement and search for all >values stored in the field that this dropdown >box will contain. Now I need to put this >database on the web and I'm using the perl >module DBD::ODBC that works very fine in order >to access the Access database tables. > >I had put a html "form" tag with a "select" tag >that I want to work the same way the dropdown >box works in the Access form. What I'm in doubt >is if there is a way of executing a script (with >the form's action method) every time a "select" >(dropdown) box is open to load into it all the >values from the field in the database. Usually >when a script is executed it loads the results >into another page (or a new window) but in this >case the values should go into a component >without loading some other page. > >I don't know if doing it using Javascript is >possible but I'd like some hints of other kinds >of technology I should learn like JSP or >Servlets, whatever could make this SQL query >works the way I described. > >Thanks!!! > >-- >Henrique Henrique: I designed something similar here: http://ancientstones.com/catalog.php Please note, there is NO javascript in this example. This is all done via php/mysql with html/css presenting the data. The problems you face are not solvable using javascript because javascript is client-side and the user may have javascript turned off. What you want to do can be done using just server-side technology, namely mysql and php. As such, it's always available for the user regardless of what they think they want. I may get an argument from this list, but it's my opinion that javascript should be used as an unobtrusive enhancement to web functionality and not as a foundation for it. Cheers, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From ferrettinico at gmail.com Wed Jan 31 09:20:29 2007 From: ferrettinico at gmail.com (Nico Ferretti) Date: Wed, 31 Jan 2007 12:20:29 -0300 Subject: [Javascript] INPUT TEXT show last characters In-Reply-To: <1815f00701301809p355bb6f7v7314c3755dadbf8c@mail.gmail.com> References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> <1815f00701301809p355bb6f7v7314c3755dadbf8c@mail.gmail.com> Message-ID: <9c4d927b0701310720j55bfd389g83352d5d19692968@mail.gmail.com> Hi! Other than just making the text field large enough to show the entire > string, I don't think its possible to do what you're asking for. I can't :( it won't fit in the table However, you could hack it to work by having the page load with only > the last X characters in the field and then as soon as someone clicks > in the box, swap the short string for the full string. Unfortunately, > in some (maybe all?) browsers that might suddenly snap the user to the > beginning of the string which may not be a bit odd. Yes, it's a solution, i have to ask to the final users. Thanks a lot, Nico.- -------------- next part -------------- An HTML attachment was scrubbed... URL: From ferrettinico at gmail.com Wed Jan 31 09:21:18 2007 From: ferrettinico at gmail.com (Nico Ferretti) Date: Wed, 31 Jan 2007 12:21:18 -0300 Subject: [Javascript] INPUT TEXT show last characters In-Reply-To: References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> Message-ID: <9c4d927b0701310721i53cf9ed0n3dc213a3a893f99b@mail.gmail.com> Yes... i've tried that, and it's the same... On 1/31/07, Mike Dougherty wrote: > > have you tried css? > > input { text-align: right; } > > On Tue, 30 Jan 2007 17:54:51 -0300 > "Nico Ferretti" wrote: > > Hi! > > > > I have a page with a lot of INPUT TEXT elements, already filled with > URL's > > (so they have long strings within them). > > > > The problem is that I want to show the end of the string, not the > beginning > > when the page loads. > > > >For example: > > > > ---------------------- > > |https://lists.lat| > > ---------------------- > > > > (the end would be ech.edu//pipermail/javascript/2007-January/thread.html > ) > > > > I want to show > > > > ---------------------- > > |ry/thread.html| > > ---------------------- > > > > Thanks in advance, > > > > Nico.- > > _______________________________________________ > Javascript mailing list > Javascript at LaTech.edu > https://lists.LaTech.edu/mailman/listinfo/javascript > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tedd at sperling.com Wed Jan 31 09:24:29 2007 From: tedd at sperling.com (tedd) Date: Wed, 31 Jan 2007 10:24:29 -0500 Subject: [Javascript] INPUT TEXT show last characters In-Reply-To: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> Message-ID: At 5:54 PM -0300 1/30/07, Nico Ferretti wrote: >Hi! > >I have a page with a lot of INPUT TEXT elements, already filled with >URL's (so they have long strings within them). > >The problem is that I want to show the end of the string, not the >beginning when the page loads. > >For example: > >---------------------- >|https://lists.lat| >---------------------- > >(the end would be >ech.edu//pipermail/javascript/2007-January/thread.html >) > >I want to show > >---------------------- >|ry/thread.html| >---------------------- > >Thanks in advance, > >Nico.- Nico: I have not done this, so it may not work. However, if I had this problem, I would try using css and assign an attribute to the text box of right justification. hth's tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From tedd at sperling.com Wed Jan 31 09:50:53 2007 From: tedd at sperling.com (tedd) Date: Wed, 31 Jan 2007 10:50:53 -0500 Subject: [Javascript] is their a javascript function, or DOM property to find the char limit of a table cell or div? In-Reply-To: References: Message-ID: At 4:24 PM +0000 1/30/07, Lee Bettridge wrote: > was wondering if their is a way to find out how many characters >will fit into an area of a given size ? Lee: I had the same problem. The width and height of the viewing area (the frame) is not a problem, you can get that from the window attributes. The problem is number of characters and linefeeds that are contained in the body of the text and how much of that you can display in the frame allotted. I started by reading in the text and building the amount I could display in the frame by counting characters and upon reaching the maximum width would then increment a line count. When I reached a linefeed, I would simply increment the line count and move on. When the maximum number of lines was reached, I was done. I took my example a bit further by ending text at paragraphs and thus slightly less than what was allotted. I don't like dangling paragraph remnants. The code I have is in php and very specific to my example so providing it would cause you more headache than working it out yourself, but I've given you the basics. It's not that much of a problem to figure out. hth's tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com From john at jwarner.com Wed Jan 31 10:47:50 2007 From: john at jwarner.com (John Warner) Date: Wed, 31 Jan 2007 11:47:50 -0500 Subject: [Javascript] is their a javascript function, or DOM propertyto find the char limit of a table cell or div? In-Reply-To: Message-ID: <01ef01c74557$8bf48e40$4701a8c0@earth> In most server side languages there are tools/functions that can give you the font metrics (size, width & height etc). Well let me say that's been my experience in Winders. Are there any similar functions available to JavaScript or that CSS can make available. If you know this the rest is easy, just math. But note this shows my ignorance regarding JavaScript, I've no idea if such a thing exists. The browser has this information somewhere, but is it exposed to 'us'? John Warner > -----Original Message----- > From: javascript-bounces at LaTech.edu > [mailto:javascript-bounces at LaTech.edu] On Behalf Of tedd > Sent: Wednesday, January 31, 2007 10:51 AM > To: [JavaScript List] > Subject: Re: [Javascript] is their a javascript function, or > DOM propertyto find the char limit of a table cell or div? > > > At 4:24 PM +0000 1/30/07, Lee Bettridge wrote: > > was wondering if their is a way to find out how many characters > >will fit into an area of a given size ? > > > Lee: > > I had the same problem. The width and height of the viewing area (the > frame) is not a problem, you can get that from the window attributes. > The problem is number of characters and linefeeds that are contained > in the body of the text and how much of that you can display in the > frame allotted. > > I started by reading in the text and building the amount I could > display in the frame by counting characters and upon reaching the > maximum width would then increment a line count. When I reached a > linefeed, I would simply increment the line count and move on. When > the maximum number of lines was reached, I was done. > > I took my example a bit further by ending text at paragraphs and thus > slightly less than what was allotted. I don't like dangling paragraph > remnants. > > The code I have is in php and very specific to my example so > providing it would cause you more headache than working it out > yourself, but I've given you the basics. It's not that much of a > problem to figure out. > > hth's > > tedd From paul at juniperwebcraft.com Wed Jan 31 12:10:49 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Wed, 31 Jan 2007 10:10:49 -0800 Subject: [Javascript] please test before posting [WAS: Re: INPUT TEXT show last characters] In-Reply-To: References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> Message-ID: <7.0.1.0.2.20070131095812.02272b50@juniperwebcraft.com> >>I have a page with a lot of INPUT TEXT elements, already filled with URL's >>(so they have long strings within them). >>The problem is that I want to show the end of the string, not the beginning >>when the page loads. >have you tried css? > >input { text-align: right; } The question is, have *you* tried it? This was my first idea on this topic, but the minute I took to throw it into an HTML page showed it didn't work (in Firefox). I know it's time-consuming, but the quality of the discussion is much higher when people take the time to test their advice before posting. And remember -- archives are forever! Please understand that this is just as much advice to myself as it to anyone else -- most of my faux pas on listserves have resulted from quick replies without testing. Regards, Paul __________________________ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com From paul at juniperwebcraft.com Wed Jan 31 12:22:28 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Wed, 31 Jan 2007 10:22:28 -0800 Subject: [Javascript] INPUT TEXT show last characters In-Reply-To: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.co m> References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> Message-ID: <7.0.1.0.2.20070131101117.02190728@juniperwebcraft.com> At 1/30/2007 12:54 PM, Nico Ferretti wrote: >I have a page with a lot of INPUT TEXT elements, already filled with >URL's (so they have long strings within them). > >The problem is that I want to show the end of the string, not the >beginning when the page loads. How about this: insert spaces between URL nodes, something like: http://example.com/ folder1/ folder2/ page.html ?arg=val &arg=val Present the URL in a multiple-line textarea, not a single-line input field, so the URL naturally wraps around as needed within the confines of the column width. Then delete all the whitespace when you accept form input. Your task would be to ensure that the textarea was tall enough to accommodate the whole URL. I wonder if users would deal with this comfortably when they encountered it for the first time? I'm pretty sure I would Regards, Paul __________________________ Juniper Webcraft Ltd. http://juniperwebcraft.com From paul at juniperwebcraft.com Wed Jan 31 12:32:01 2007 From: paul at juniperwebcraft.com (Paul Novitski) Date: Wed, 31 Jan 2007 10:32:01 -0800 Subject: [Javascript] is their a javascript function, or DOMproperty to find the char limit of a table cell or div? In-Reply-To: References: <7.0.1.0.2.20070130110259.0218c318@juniperwebcraft.com> Message-ID: <7.0.1.0.2.20070131102442.00ee0458@juniperwebcraft.com> At 1/31/2007 02:24 AM, Lee Bettridge wrote: >Paul, > >You were correct in that "It sounds like Lee is visualizing a page-up, >page-down scenario in which the scrolling text moves up or down" and I >move the text about half the height of the div tag so the user does not >get lost. > >You were also correct in that the TV Browser does not 'to my knowledge', >allow for font resizing or customizing, as text on a tv screen must be >more constrained to remain readable. > >My problem is that the user can scroll down through the text and then >keep scrolling down for ever, as I have no way of knowing when the text >has finished, and no way of 'cutting' the text into pages so I can count >them. This doesn't sound like a problem. Since the text will be a fixed size, you'll determine that size (won't you?) in pixels and therefore you'll know exactly how tall a windowpane-sized chunk will be. You know the height of the text block, you know the height of the windowpane in which the text block is scrolling, and you know which chunk of the textblock you're currently showing. When the currentChunk * (windowpaneHeight + 1) >= textHeight then you can't scroll any more. If this model doesn't fit your situation, then perhaps you could give us a look at a demo page that truly illustrates your dilemma. Regards, Paul __________________________ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com From mdougherty at pbp.com Wed Jan 31 15:10:27 2007 From: mdougherty at pbp.com (Mike Dougherty) Date: Wed, 31 Jan 2007 16:10:27 -0500 Subject: [Javascript] please test before posting [WAS: Re: INPUT TEXT show last characters] In-Reply-To: <7.0.1.0.2.20070131095812.02272b50@juniperwebcraft.com> References: <9c4d927b0701301254t2709f554l4aca049dfa825296@mail.gmail.com> <7.0.1.0.2.20070131095812.02272b50@juniperwebcraft.com> Message-ID: I did try this, but without having the string preloaded into the input. When I typed long input into the box, it stayed right-aligned. When I received the negative answer, I went back to the test and tried the preloaded string - and was suprised at the incorrect behavior of FF in that case. I did not try IE. On Wed, 31 Jan 2007 10:10:49 -0800 Paul Novitski wrote: > The question is, have *you* tried it? This was my first idea on this topic, but the minute I >took to throw it into an HTML page showed it didn't work (in Firefox). > > I know it's time-consuming, but the quality of the discussion is much higher when people take >the time to test their advice before posting. And remember -- archives are forever! Please >understand that this is just as much advice to myself as it to anyone else -- most of my faux pas >on listserves have resulted from quick replies without testing. From peter at brunone.com Wed Jan 31 16:06:06 2007 From: peter at brunone.com (Peter Brunone) Date: Wed, 31 Jan 2007 15:06:06 -0700 Subject: [Javascript] INPUT TEXT show last characters Message-ID: <273cd879477846a5ab0f26f29b5cf524@brunone.com> Unless you want to put the cursor into the field at the end, you're going to have to get really creative. You could set the field's overflow to visible (I'm not even sure if that works for text input fields), and then put it inside a div that clips it and right-justifies... but that seems like going a bit too far. From: "Nico Ferretti" ferrettinico at gmail.com Yes... i've tried that, and it's the same... On 1/31/07, Mike Dougherty wrote: have you tried css? input { text-align: right; } On Tue, 30 Jan 2007 17:54:51 -0300 "Nico Ferretti" wrote: > Hi! > > I have a page with a lot of INPUT TEXT elements, already filled with URL's > (so they have long strings within them). > > The problem is that I want to show the end of the string, not the beginning > when the page loads. > >For example: > > ---------------------- > |https://lists.lat| > ---------------------- > > (the end would be ech.edu//pipermail/javascript/2007-January/thread.html ) > > I want to show > > ---------------------- > |ry/thread.html| > ---------------------- > > Thanks in advance, -------------- next part -------------- An HTML attachment was scrubbed... URL: