From trojani2000 at hotmail.com Sun Jun 1 08:58:05 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Sun, 1 Jun 2008 13:58:05 +0000 Subject: [Javascript] innerHTML assignment overflows TD cell in FF In-Reply-To: <483F3EC7.6050604@bigskypenguin.com> References: <483F3EC7.6050604@bigskypenguin.com> Message-ID: Netscape was never fit for dynamicity. Not even now (after more than 11 years), it still fails to handle and render dynamic content properly. You might solve this issue if you find a way to force the browser to reflow its content. Because it will not do it out of its politeness. What happens if you dynamically add another shorter content than the previous? I guess you will find a hole there. Dinosaurs are lazy breed, that's why they died in the first place. It is hopefuly possible to force mozilla reflow this cell by once again specifying the width of it along with innerHTML injection command. But before you try this or other similar trials, like reseting te fontsize that might also trigger the content reflow forcedly, make sure you didn't specify the hight of cells Since in this casse, even if you successfully reflow the table your problem with firefox will remain unsoved! Because here you'll be dealing yet with another netscape ackward programming decision: The content bleeding. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Date: Thu, 29 May 2008 18:39:51 -0500> From: skip at bigskypenguin.com> To: javascript at lists.evolt.org> Subject: [Javascript] innerHTML assignment overflows TD cell in FF> > Hey all,> > I have a table set up with a main content cell in > the center column of three, basically like this:> > > > > > > > > > > > > > > >
header
stuffthe most stuffstuff
footer
> > On the server side I build a content page and user > innerHMTL=content;> > ..in JS code to insert the content into the column > labeled "the most stuff".> > The problem is when that column has less content, > and then shifts to more content the latter part of > the content runs over the footer below the main > content row.> > This is ONLY happening in Firefox, IE on windows > works fine. Firefox has the problem on both Linux > and Windows.> > Any help would greatly, greatly appreciated.> -- > Skip Evans> Big Sky Penguin, LLC> 503 S Baldwin St, #1> Madison, WI 53703> 608-250-2720> http://bigskypenguin.com> =-=-=-=-=-=-=-=-=-=> Check out PHPenguin, a lightweight and versatile> PHP/MySQL, AJAX & DHTML development framework.> http://phpenguin.bigskypenguin.com/> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ Change the world with e-mail. Join the i?m Initiative from Microsoft. http://im.live.com/Messenger/IM/Join/Default.aspx?source=EML_WL_ChangeWorld From Mark.Rees at astrazeneca.com Mon Jun 2 07:52:48 2008 From: Mark.Rees at astrazeneca.com (Rees, Mark) Date: Mon, 2 Jun 2008 13:52:48 +0100 Subject: [Javascript] Auto reloading JS files on change? In-Reply-To: <483DFB3A.5000808@bigskypenguin.com> Message-ID: I have the following in an HTML file that is echo'd to the browser via PHP code. But whenever this, and other, .js files are modified the user must know to hit the refresh button on his browser. I've been looking for a way to reload the JS files on changes, and I've come across the last-modified header element, but not sure how to implement this. ------- Assuming you have the above script element in a site-wide include file or similar, one option is to rename the js file when you change it - you can use a version number: for example players_105.js. If other applications need to access it that may not work well for you though. From joel.goldstick at columbuswebmakers.com Mon Jun 2 08:33:39 2008 From: joel.goldstick at columbuswebmakers.com (Joel Goldstick) Date: Mon, 02 Jun 2008 09:33:39 -0400 Subject: [Javascript] Auto reloading JS files on change? In-Reply-To: References: Message-ID: <4843F6B3.9050902@columbuswebmakers.com> Rees, Mark wrote: > > But whenever this, and other, .js files are > modified the user must know to hit the refresh > button on his browser. I haven't tried, but I seem to remember adding #something after the javascript filename might help. Put version code there. From rer at datacompusa.com Mon Jun 2 14:19:36 2008 From: rer at datacompusa.com (Roger Roelofs) Date: Mon, 2 Jun 2008 15:19:36 -0400 Subject: [Javascript] Auto reloading JS files on change? In-Reply-To: References: Message-ID: <8CFABB35-C4AE-4FA0-9016-995C541E8FCD@datacompusa.com> Mark, On Jun 2, 2008, at 8:52 AM, Rees, Mark wrote: > I have the following in an HTML file that is > echo'd to the browser via PHP code. > > > > But whenever this, and other, .js files are > modified the user must know to hit the refresh > button on his browser. > > I've been looking for a way to reload the JS files > on changes, and I've come across the last-modified > header element, but not sure how to implement this. Have you looked at JSONP? http://simonwillison.net/2005/Dec/16/json/ It basically works by letting you specify a function for the inserted script to call so you can know when it has loaded and process any data it contains. The recent version of jQuery has support built in for this. Roger -- Roger Roelofs Datacomp Appraisal Services 3215 Eaglecrest, NE Grand Rapids, MI 49525 From scott at randomchaos.com Mon Jun 2 15:14:18 2008 From: scott at randomchaos.com (Scott Reynen) Date: Mon, 2 Jun 2008 14:14:18 -0600 Subject: [Javascript] Auto reloading JS files on change? In-Reply-To: <8CFABB35-C4AE-4FA0-9016-995C541E8FCD@datacompusa.com> References: <8CFABB35-C4AE-4FA0-9016-995C541E8FCD@datacompusa.com> Message-ID: <9C0A361E-BA2B-4197-8BC2-8A9A1E0E0A35@randomchaos.com> On [Jun 2], at [ Jun 2] 1:19 , Roger Roelofs wrote: > Mark, > > On Jun 2, 2008, at 8:52 AM, Rees, Mark wrote: > >> I have the following in an HTML file that is >> echo'd to the browser via PHP code. >> >> >> >> But whenever this, and other, .js files are >> modified the user must know to hit the refresh >> button on his browser. >> >> I've been looking for a way to reload the JS files >> on changes, and I've come across the last-modified >> header element, but not sure how to implement this. > > Have you looked at JSONP? > http://simonwillison.net/2005/Dec/16/json/ > > It basically works by letting you specify a function for the inserted > script to call so you can know when it has loaded and process any data > it contains. The recent version of jQuery has support built in for > this. Executing external JavaScript loaded via AJAX is an awfully convoluted way to avoid caching. Simply changing the name of the JavaScript file will force a new download by avoiding the cached version associated with the original name. If you want to learn how caching works, here's a decent tutorial: http://www.mnot.net/cache_docs/ Peace, Scott From rer at datacompusa.com Mon Jun 2 15:23:21 2008 From: rer at datacompusa.com (Roger Roelofs) Date: Mon, 2 Jun 2008 16:23:21 -0400 Subject: [Javascript] Auto reloading JS files on change? In-Reply-To: <9C0A361E-BA2B-4197-8BC2-8A9A1E0E0A35@randomchaos.com> References: <8CFABB35-C4AE-4FA0-9016-995C541E8FCD@datacompusa.com> <9C0A361E-BA2B-4197-8BC2-8A9A1E0E0A35@randomchaos.com> Message-ID: Scott, On Jun 2, 2008, at 4:14 PM, Scott Reynen wrote: > On [Jun 2], at [ Jun 2] 1:19 , Roger Roelofs wrote: > >> Mark, >> >> On Jun 2, 2008, at 8:52 AM, Rees, Mark wrote: >> >>> I have the following in an HTML file that is >>> echo'd to the browser via PHP code. >>> >>> >>> >>> But whenever this, and other, .js files are >>> modified the user must know to hit the refresh >>> button on his browser. >>> >>> I've been looking for a way to reload the JS files >>> on changes, and I've come across the last-modified >>> header element, but not sure how to implement this. >> >> Have you looked at JSONP? >> http://simonwillison.net/2005/Dec/16/json/ >> >> It basically works by letting you specify a function for the inserted >> script to call so you can know when it has loaded and process any >> data >> it contains. The recent version of jQuery has support built in for >> this. > > Executing external JavaScript loaded via AJAX is an awfully convoluted > way to avoid caching. Simply changing the name of the JavaScript file > will force a new download by avoiding the cached version associated > with the original name. If you want to learn how caching works, > here's a decent tutorial: > > http://www.mnot.net/cache_docs/ I'm familiar with caching. My impression was that the OP was using php to write javascript on the fly and wanted the page to auto-reload the script in some fashion. Roger -- Roger Roelofs Datacomp Appraisal Services 3215 Eaglecrest, NE Grand Rapids, MI 49525 From skip at bigskypenguin.com Thu Jun 5 17:03:27 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Thu, 05 Jun 2008 17:03:27 -0500 Subject: [Javascript] Changing dom values from HTML clicks Message-ID: <484862AF.90905@bigskypenguin.com> Hey all, I am creating this "theme builder" module to change the look and feel through the DOM on the fly and then record this into a database to then create a custom CSS file. The way I am doing it now, just to test it out, I know is not the best way and that there is a better way, but I could use some guidance here. Basically, I downloaded the color selector tool at: http://ecritters.biz/colorselector/ which I then use to select a color and send the value to JS code to set a value in the DOM. Here are the code snippets that do the work, but I know there must be a better way. First, after the user selects a color, they click a link to send this value to the JS code like this: Left Block Background Then in the JS, I use a switch statement to determine which value is being set, and then... case 'left_block_background': var object=document.getElementById('leftcontent'); object.style.background=val; break; ...does the work. What is the right way to do this? Seems to me there should be way to send the property that is being set from the HTML that would not require a big switch statement for every property. Thanks much! -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From skip at bigskypenguin.com Thu Jun 5 20:22:27 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Thu, 05 Jun 2008 20:22:27 -0500 Subject: [Javascript] Changing dom values from HTML clicks In-Reply-To: <484862AF.90905@bigskypenguin.com> References: <484862AF.90905@bigskypenguin.com> Message-ID: <48489153.8040503@bigskypenguin.com> Hey all, Okay, I've actually cut out the call to the JS file altogether, and now just have this in the HTML form with the color selector. Left Block Background So with this it looks like I can simply have one link with the onclick call for each style element I want the user to be able to change. Does this look like a sound strategy? Thanks gobs! Skip Skip Evans wrote: > Hey all, > > I am creating this "theme builder" module to > change the look and feel through the DOM on the > fly and then record this into a database to then > create a custom CSS file. > > The way I am doing it now, just to test it out, I > know is not the best way and that there is a > better way, but I could use some guidance here. > > Basically, I downloaded the color selector tool at: > > http://ecritters.biz/colorselector/ > > which I then use to select a color and send the > value to JS code to set a value in the DOM. Here > are the code snippets that do the work, but I know > there must be a better way. > > First, after the user selects a color, they click > a link to send this value to the JS code like this: > > onclick="set_theme_property(theme_form.color.value,'left_block_background');"> > Left Block > Background > > Then in the JS, I use a switch statement to > determine which value is being set, and then... > > case 'left_block_background': > var object=document.getElementById('leftcontent'); > object.style.background=val; > break; > > ...does the work. > > What is the right way to do this? Seems to me > there should be way to send the property that is > being set from the HTML that would not require a > big switch statement for every property. > > Thanks much! > -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From mdougherty at pbp.com Thu Jun 5 20:51:22 2008 From: mdougherty at pbp.com (Mike Dougherty) Date: Thu, 5 Jun 2008 21:51:22 -0400 Subject: [Javascript] Changing dom values from HTML clicks In-Reply-To: <48489153.8040503@bigskypenguin.com> References: <484862AF.90905@bigskypenguin.com> <48489153.8040503@bigskypenguin.com> Message-ID: <59bedf280806051851s690c0919tac1ee3c197690b4d@mail.gmail.com> On Thu, Jun 5, 2008 at 9:22 PM, Skip Evans wrote: > Okay, I've actually cut out the call to the JS > file altogether, and now just have this in the > HTML form with the color selector. > > > onclick="document.getElementById('leftcontent').style.background=theme_form.color.value;"> > Left Block Background > > So with this it looks like I can simply have one > link with the onclick call for each style element > I want the user to be able to change. > > Does this look like a sound strategy? > I suppose you might have something like this in markup:
This will send the value of the selected option to the server as "LeftContentColor" when the user activates the submit function. There is no need for a non-functional "link" to launch javascript. If the intention is to change the background color of an element named LeftContent, you could attach an event listener to either the 'change' or 'blur' methods of the select to enhance the behavior of that element. Even without this javascript enhancement, however, the user would still be able to submit the form. Assuming the server-side script is updating the stylesheet for the page, the user would be able to see their change on the next display of the form. I have been trying to minimize the duration of my best-practice rants, so if you would like more dialog; do ask. (as in "You asked for it!") From dagda1 at hotmail.com Fri Jun 6 01:56:46 2008 From: dagda1 at hotmail.com (Paul Cowan) Date: Fri, 6 Jun 2008 06:56:46 +0000 Subject: [Javascript] Items remaining weirdness in IE6 In-Reply-To: <484862AF.90905@bigskypenguin.com> References: <484862AF.90905@bigskypenguin.com> Message-ID: Hi all,I am experiencing a weird problem in IE6 only. I'll explain the scenario:I am making an AJAX call in the document onload event that is returning some HTML that I am inserting into a div via the innerHTML property.The problem is that any image tags that are in the HTML that is returned form the AJAX call are loading very slowly. It is almost like they are loading sequentially. The status bar reads (items remaining 200) and slowly counts down as each image appears on the page. It is almost like the images are being loaded sequentially.This does not happen in other browsers.Has anyone experienced this weirdness?Paul _________________________________________________________________ All new Live Search at Live.com http://clk.atdmt.com/UKM/go/msnnkmgl0010000006ukm/direct/01/ From skip at bigskypenguin.com Sun Jun 8 21:45:05 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Sun, 08 Jun 2008 21:45:05 -0500 Subject: [Javascript] Changing link hover through JS Message-ID: <484C9931.40505@bigskypenguin.com> Hey, I've been Googling like crazy and am now pulling my hair out I can't find this. I have a function that sets the colors for the links like this: var links=document.getElementsByTagName('a'); for (x=0; x < links.length; x++) { { links[x].style.color=theme_form.color.value; } But I also need to set the hover color, and for the life of me can find it nowhere!!! I know it's something simple, but I've hit 100 different pages and not one mentions it! Any help would be greatly appreciated. -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From mdougherty at pbp.com Sun Jun 8 22:59:41 2008 From: mdougherty at pbp.com (Mike Dougherty) Date: Sun, 8 Jun 2008 23:59:41 -0400 Subject: [Javascript] Changing link hover through JS In-Reply-To: <484C9931.40505@bigskypenguin.com> References: <484C9931.40505@bigskypenguin.com> Message-ID: <59bedf280806082059x48f4f57em5268f7863b4708d3@mail.gmail.com> On Sun, Jun 8, 2008 at 10:45 PM, Skip Evans wrote: > > But I also need to set the hover color, and for > the life of me can find it nowhere!!! > > there is technically no 'hover color' - you can set the color of an object to be displayed when the mouse is over it using either the :hover CSS selector or directly set the color in response to the mouseover event (then set it back on the mouseout event) 'hope that helps. good luck on the next step :) From skip at bigskypenguin.com Mon Jun 9 14:49:45 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Mon, 09 Jun 2008 14:49:45 -0500 Subject: [Javascript] Changing link hover through JS In-Reply-To: <59bedf280806082059x48f4f57em5268f7863b4708d3@mail.gmail.com> References: <484C9931.40505@bigskypenguin.com> <59bedf280806082059x48f4f57em5268f7863b4708d3@mail.gmail.com> Message-ID: <484D8959.6010500@bigskypenguin.com> Hey Mike & all, What about changing the mouseover value for the body tag through JS? I keep seeing examples similar that might work, but can't seem to get any of them to work yet. Right now I'm trying something like this to no avail. Hyperlinks Hover Any help, as always, will be appreciated to your wildest dreams, and then just a smidgen more. Skip Mike Dougherty wrote: > On Sun, Jun 8, 2008 at 10:45 PM, Skip Evans wrote: > >> But I also need to set the hover color, and for >> the life of me can find it nowhere!!! >> >> > there is technically no 'hover color' - you can set the color of an object > to be displayed when the mouse is over it using either the :hover CSS > selector or directly set the color in response to the mouseover event (then > set it back on the mouseout event) > > 'hope that helps. good luck on the next step :) > _______________________________________________ > Javascript mailing list > Javascript at lists.evolt.org > http://lists.evolt.org/mailman/listinfo/javascript > -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From philthathril at gmail.com Tue Jun 10 17:38:00 2008 From: philthathril at gmail.com (Philip Thompson) Date: Tue, 10 Jun 2008 17:38:00 -0500 Subject: [Javascript] Bubbling and canceling events Message-ID: Hi all. In the application I'm working on, I keep coming back to this similar problem. I'll just show you here...
Johnny Appleseed 12/3/1981 Print Card
Ok, let's say the user clicks on "Print Card". This is a javascript function that performs some AJAX-related things in the background (in this case, prints a card). After clicking to print, I wish nothing more to happen - I wish to cancel the set of events that follow. In this case, I want to cancel the call to the javascript function goToUrl() as specified in the element - I do not want to visit the view user page. To accomplish this, I attempted the following: function printCard () { if (!e) var e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); //... do stuff here } However, it still redirects me!! Ahhhh! I can't handle it anymore. Is there anyway to cancel the redirection/events? I would be greatly appreciated if someone could shed some much-needed light. Thanks in advance, ~Philip Note: this is a somewhat simplified example of the real thing. From peter at brunone.com Tue Jun 10 22:29:06 2008 From: peter at brunone.com (Peter Brunone) Date: Tue, 10 Jun 2008 20:29:06 -0700 Subject: [Javascript] Bubbling and canceling events Message-ID: <966f926ea5e54e77bd48d4b1c37cbe52@maila15.webcontrolcenter.com> Hi Philip, Does this misfire in all browsers, or just in Firefox and family? It is my understanding that in order to use the (Mozilla only) event parameter in your function, you have to include it as a parameter in your function definition. So, to draw from your example below, if you are referring to this event as "e", then you need to specify the parameter as such like this: function printCard (e) No parameter is necessary when you call the function from the event handler, and IE won't see it; only Mozilla will. HTH, Peter ---------------------------------------- From: Philip Thompson philthathril at gmail.com Hi all. In the application I'm working on, I keep coming back to this similar problem. I'll just show you here... Johnny Appleseed 12/3/1981 Print Card Ok, let's say the user clicks on "Print Card". This is a javascript function that performs some AJAX-related things in the background (in this case, prints a card). After clicking to print, I wish nothing more to happen - I wish to cancel the set of events that follow. In this case, I want to cancel the call to the javascript function goToUrl() as specified in the element - I do not want to visit the view user page. To accomplish this, I attempted the following: function printCard () { if (!e) var e = window.event; e.cancelBubble = true; if (e.stopPropagation) e.stopPropagation(); //... do stuff here } However, it still redirects me!! Ahhhh! I can't handle it anymore. Is there anyway to cancel the redirection/events? I would be greatly appreciated if someone could shed some much-needed light. Thanks in advance, ~Philip Note: this is a somewhat simplified example of the real thing. From peter at brunone.com Tue Jun 10 22:34:19 2008 From: peter at brunone.com (Peter Brunone) Date: Tue, 10 Jun 2008 20:34:19 -0700 Subject: [Javascript] Changing link hover through JS Message-ID: Hi Skip, Just a few thoughts, worth every penny you paid for them: 1) The body element can be accessed with the "document.body" syntax; no extra function should be needed. 2) If you want to assign an event handler, you should probably call a function to do it (see http://www.javascriptkit.com/dhtmltutors/domevent1.shtml , section 2, "Via scripting"). Of course if you have an a:hover pseudoclass set in a stylesheet, maybe you could access that class and change its color value...? I'm not really sure how (or if) that would work, but if the above suggestions don't get you where you need to go, it might be worth a google. HTH, Peter ---------------------------------------- From: Skip Evans skip at bigskypenguin.com Hey Mike & all, What about changing the mouseover value for the body tag through JS? I keep seeing examples similar that might work, but can't seem to get any of them to work yet. Right now I'm trying something like this to no avail. Hyperlinks Hover Any help, as always, will be appreciated to your wildest dreams, and then just a smidgen more. Skip Mike Dougherty wrote: > On Sun, Jun 8, 2008 at 10:45 PM, Skip Evans wrote: > >> But I also need to set the hover color, and for >> the life of me can find it nowhere!!! >> >> > there is technically no 'hover color' - you can set the color of an object > to be displayed when the mouse is over it using either the :hover CSS > selector or directly set the color in response to the mouseover event (then > set it back on the mouseout event) > > 'hope that helps. good luck on the next step :) > _______________________________________________ > Javascript mailing list > Javascript at lists.evolt.org > http://lists.evolt.org/mailman/listinfo/javascript > -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ _______________________________________________ Javascript mailing list Javascript at lists.evolt.org http://lists.evolt.org/mailman/listinfo/javascript From Mark.Rees at astrazeneca.com Wed Jun 11 04:31:31 2008 From: Mark.Rees at astrazeneca.com (Rees, Mark) Date: Wed, 11 Jun 2008 10:31:31 +0100 Subject: [Javascript] Changing link hover through JS In-Reply-To: Message-ID: Hello Skip I'm a bit lost on exactly what you are trying to achieve but if you need something (anything) to change colour on mouseover, one way is to set a class for it in the CSS, and then apply that class using JS in the onmouseover event. So, for example, if you want the background colour of a given element to change when you mouseover a link. Note, handwritten untested code follows, but it should give you the basic idea

This will have a blue BG

mouse over me Hope this helps -------------------- Hi Skip, Just a few thoughts, worth every penny you paid for them: 1) The body element can be accessed with the "document.body" syntax; no extra function should be needed. 2) If you want to assign an event handler, you should probably call a function to do it (see http://www.javascriptkit.com/dhtmltutors/domevent1.shtml , section 2, "Via scripting"). Of course if you have an a:hover pseudoclass set in a stylesheet, maybe you could access that class and change its color value...? I'm not really sure how (or if) that would work, but if the above suggestions don't get you where you need to go, it might be worth a google. HTH, Peter ---------------------------------------- From: Skip Evans skip at bigskypenguin.com Hey Mike & all, What about changing the mouseover value for the body tag through JS? I keep seeing examples similar that might work, but can't seem to get any of them to work yet. Right now I'm trying something like this to no avail. Hyperlinks Hover Any help, as always, will be appreciated to your wildest dreams, and then just a smidgen more. Skip Mike Dougherty wrote: > On Sun, Jun 8, 2008 at 10:45 PM, Skip Evans wrote: > >> But I also need to set the hover color, and for >> the life of me can find it nowhere!!! >> >> > there is technically no 'hover color' - you can set the color of an object > to be displayed when the mouse is over it using either the :hover CSS > selector or directly set the color in response to the mouseover event (then > set it back on the mouseout event) > > 'hope that helps. good luck on the next step :) > _______________________________________________ > Javascript mailing list > Javascript at lists.evolt.org > http://lists.evolt.org/mailman/listinfo/javascript > -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ _______________________________________________ Javascript mailing list Javascript at lists.evolt.org http://lists.evolt.org/mailman/listinfo/javascript _______________________________________________ Javascript mailing list Javascript at lists.evolt.org http://lists.evolt.org/mailman/listinfo/javascript From philthathril at gmail.com Wed Jun 11 08:40:22 2008 From: philthathril at gmail.com (Philip Thompson) Date: Wed, 11 Jun 2008 08:40:22 -0500 Subject: [Javascript] Bubbling and canceling events In-Reply-To: <966f926ea5e54e77bd48d4b1c37cbe52@maila15.webcontrolcenter.com> References: <966f926ea5e54e77bd48d4b1c37cbe52@maila15.webcontrolcenter.com> Message-ID: <25B059C0-094E-4313-AB84-936FC0FB61C1@gmail.com> I figured out the problem. You are correct, Peter, about sending the event to the function. I thought that might have been a problem before, so I modified the *real* function to accept 'event'. For example... [html] Print [js] function printPathReport (e, file_id, req_id) { //... do stuff here if (!e) var e = window.event; if (e.cancelBubble) e.cancelBubble = true if (e.stopPropagation) e.stopPropagation(); } This actually works. Seems like the key was to send the event. Now the parenting element's event does not fire. Yay! Well, now that I think about it, I haven't test in IE yet. Woe is me - now I know what to do next. =/ Thanks for your advice. This has been driving me nuts for months!! ~Philip On Jun 10, 2008, at 10:29 PM, Peter Brunone wrote: > Hi Philip, > > Does this misfire in all browsers, or just in Firefox and family? > > It is my understanding that in order to use the (Mozilla only) > event parameter in your function, you have to include it as a > parameter in your function definition. So, to draw from your > example below, if you are referring to this event as "e", then you > need to specify the parameter as such like this: > > function printCard (e) > > No parameter is necessary when you call the function from the > event handler, and IE won't see it; only Mozilla will. > > HTH, > > Peter > > ---------------------------------------- > > From: Philip Thompson philthathril at gmail.com > > Hi all. > > In the application I'm working on, I keep coming back to this similar > problem. I'll just show you here... > > Johnny Appleseed 12/3/1981 Print Card > > Ok, let's say the user clicks on "Print Card". This is a javascript > function that performs some AJAX-related things in the background (in > this case, prints a card). After clicking to print, I wish nothing > more to happen - I wish to cancel the set of events that follow. In > this case, I want to cancel the call to the javascript function > goToUrl() as specified in the > > element - I do not want to visit > the view user page. To accomplish this, I attempted the following: > > function printCard () { > if (!e) var e = window.event; > e.cancelBubble = true; > if (e.stopPropagation) e.stopPropagation(); > > //... do stuff here > } > > However, it still redirects me!! Ahhhh! I can't handle it anymore. Is > there anyway to cancel the redirection/events? I would be greatly > appreciated if someone could shed some much-needed light. > > Thanks in advance, > ~Philip > > Note: this is a somewhat simplified example of the real thing. > > > _______________________________________________ > Javascript mailing list > Javascript at lists.evolt.org > http://lists.evolt.org/mailman/listinfo/javascript "Personally, most of my web applications do not have to factor 13.7 billion years of space drift in to the calculations, so PHP's rand function has been great for me..." ~S. Johnson From paul at juniperwebcraft.com Wed Jun 11 08:59:27 2008 From: paul at juniperwebcraft.com (Paul Novitski) Date: Wed, 11 Jun 2008 06:59:27 -0700 Subject: [Javascript] Changing link hover through JS In-Reply-To: <20704708.1213176867654.JavaMail.root@m04> References: <20704708.1213176867654.JavaMail.root@m04> Message-ID: At 6/11/2008 02:31 AM, Rees, Mark wrote: ... >if you need something (anything) to change colour on mouseover, one >way is to set a class for it in the CSS, and then apply that class >using JS in the onmouseover event. I agree. It's the difference between embedding the colors in your JavaScript code and separating them out into your stylesheet. For a superabundance of rationale for separating development layers, google 'separation layers javascript'. One way to apply different colors to anchors throughout a page would be to apply incrementally different classes to the anchors which would be reflected in the stylesheet: ... ... ... ... a.anchor001:hover {color: #336699; } a.anchor002:hover {color: #6699CC; } ... If the coloration effect is important to the comprehension of the page, I'd apply them server-side so they appeared regardless of whether JavaScript is enabled in the browser. For more on this subject, google 'progressive enhancement'. In my view JavaScript cannot competently replace server-side scripting, it can only enhance. Regards, Paul __________________________ Paul Novitski Juniper Webcraft Ltd. http://juniperwebcraft.com From skip at bigskypenguin.com Wed Jun 11 10:25:51 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Wed, 11 Jun 2008 10:25:51 -0500 Subject: [Javascript] Changing link hover through JS In-Reply-To: <200806111405.m5BE5tnX088764@bigskypenguin.com> References: <20704708.1213176867654.JavaMail.root@m04> <200806111405.m5BE5tnX088764@bigskypenguin.com> Message-ID: <484FEE7F.5000501@bigskypenguin.com> Hey all, The color that gets set actually comes from a form value, via a PhotoShop style color selector from here: http://ecritters.biz/colorselector/ So with Mike Dougherty's help, I got it going by assigning the form value color via mouseover and mouseout functions. Thanks all!!! I'm new to the list and have learned a lot already. I consider myself very good to excellent at PHP programming, but now that we're using a lot of AJAX I need to get up to speed on JS more, and have the book DOM Scripting by Jeremy Keith and am finding it quit useful. I would recommend it to anyone on the list that doesn't consider themselves a JS master of the universe. Skip Paul Novitski wrote: > At 6/11/2008 02:31 AM, Rees, Mark wrote: > ... >> if you need something (anything) to change colour on mouseover, one >> way is to set a class for it in the CSS, and then apply that class >> using JS in the onmouseover event. > > > I agree. It's the difference between embedding the colors in your > JavaScript code and separating them out into your stylesheet. For a > superabundance of rationale for separating development layers, google > 'separation layers javascript'. > > One way to apply different colors to anchors throughout a page would > be to apply incrementally different classes to the anchors which > would be reflected in the stylesheet: > > ... > ... > ... > ... > > a.anchor001:hover {color: #336699; } > a.anchor002:hover {color: #6699CC; } > ... > > If the coloration effect is important to the comprehension of the > page, I'd apply them server-side so they appeared regardless of > whether JavaScript is enabled in the browser. For more on this > subject, google 'progressive enhancement'. > > In my view JavaScript cannot competently replace server-side > scripting, it can only enhance. > > Regards, > > Paul > __________________________ > > Paul Novitski > Juniper Webcraft Ltd. > http://juniperwebcraft.com > > _______________________________________________ > Javascript mailing list > Javascript at lists.evolt.org > http://lists.evolt.org/mailman/listinfo/javascript > -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From skip at bigskypenguin.com Fri Jun 13 19:42:11 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Fri, 13 Jun 2008 19:42:11 -0500 Subject: [Javascript] JS eyedropper tool? Message-ID: <485313E3.9020803@bigskypenguin.com> Hey all, I'm trying to find a tool similar to the eye dropper tool in PhotoShop, but implemented with JS that would allow the site visitor to use a pointer to display the color hex value of any point on the page. Anyone know of such a script, or tips how to create one? Been Googling to no avail. -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From lester at denhaag.org Sat Jun 14 06:08:57 2008 From: lester at denhaag.org (J. Lester Novros II) Date: Sat, 14 Jun 2008 13:08:57 +0200 Subject: [Javascript] JS eyedropper tool? In-Reply-To: <485313E3.9020803@bigskypenguin.com> References: <485313E3.9020803@bigskypenguin.com> Message-ID: <4853A6C9.3040701@denhaag.org> Skip Evans wrote: > I'm trying to find a tool similar to the eye > dropper tool in PhotoShop, but implemented with JS > that would allow the site visitor to use a pointer > to display the color hex value of any point on the > page. The Firefox extension Colorzilla does exactly that: > Anyone know of such a script, or tips how to > create one? Maybe it helps if you pull it apart and have a look at the JavaScript it uses..? l8R lES -- "I think a lot more of Apple than I do of MSFT, but then I'd rather catch rabies than AIDS..." /. comment http://www.supermarionation.tv From skip at bigskypenguin.com Sat Jun 14 18:47:15 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Sat, 14 Jun 2008 18:47:15 -0500 Subject: [Javascript] Hex values and RGB values? Message-ID: <48545883.4090602@bigskypenguin.com> Hey all, I'm using a color selector and a form value to assign values to things like the following: document.getElementById('matte').style.background=form.color.value; Where the form contains things like '#FFFF00'. Next, I want to save these values chosen in a database, but when I do the following: var color=document.getElementById('matte').style.background; alert(color); I am getting the following in the alert box instead of the Hex value: rgb(255, 255, 0) none repeat scroll 0% 0% "D'oh!" How can I get the hex value from document.getElementById('matte').style.background ?????? This was MOST unexpected! Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From sgchipman at gmail.com Sat Jun 14 19:50:03 2008 From: sgchipman at gmail.com (Steven Chipman) Date: Sat, 14 Jun 2008 20:50:03 -0400 Subject: [Javascript] Hex values and RGB values? In-Reply-To: <48545883.4090602@bigskypenguin.com> References: <48545883.4090602@bigskypenguin.com> Message-ID: <26ca962b0806141750r1e299a8bh7f39a6a2f048a0cb@mail.gmail.com> > How can I get the hex value from > > document.getElementById('matte').style.background > I'd recommend using backgroundColor as your getter/setter to avoid the extraneous information. This will still give you an RGB value, but you can always parse the 3 values out of the string and convert them to hex by calling toString(16) on each value. Example: function toHex(dec) { hex=dec.toString(16); if(hex.length==1)hex="0"+hex; return hex.toUpperCase(); } Calling toHex(255) will return FF. Then, just stick them all back together to get your 6 character hex value. -- S.G. Chipman Software Engineer, Portrait Artist http://slayeroffice.com | http://sgchipman.com From philthathril at gmail.com Mon Jun 16 15:36:32 2008 From: philthathril at gmail.com (Philip Thompson) Date: Mon, 16 Jun 2008 15:36:32 -0500 Subject: [Javascript] AJAX + Cookies Message-ID: <274E0F75-ED8B-48F5-8C55-C15FDC530948@gmail.com> Hi all. I've been hitting my head against the wall for a while now. I've gotten a few hits from Google, but nothing has really answered my question: After updating the value of a cookie during an AJAX request, can that value be immediately accessed via the cookie (w/o a new request)? [js] alert(readCookie('mycookie')); updateCookie('mycookie', 'newValue'); alert(readCookie('mycookie')); [/js] The output for this *should* be: oldValue newValue However, I'm getting: oldValue oldValue Now, I'm making the request via PHP. I'm echo'ing the javascript to update the cookie. I know this can be set in PHP via the setcookie() function, but the new value of the cookie is unavailable until the next request. Well, I'm greedy and I want it now! Any thoughts? Is this possible to have that cookie accessible when immediately set/same request? Thanks, ~Philip From mwarden at gmail.com Mon Jun 16 15:41:49 2008 From: mwarden at gmail.com (Matt Warden) Date: Mon, 16 Jun 2008 16:41:49 -0400 Subject: [Javascript] AJAX + Cookies In-Reply-To: <274E0F75-ED8B-48F5-8C55-C15FDC530948@gmail.com> References: <274E0F75-ED8B-48F5-8C55-C15FDC530948@gmail.com> Message-ID: On Mon, Jun 16, 2008 at 4:36 PM, Philip Thompson wrote: > Hi all. > > I've been hitting my head against the wall for a while now. I've > gotten a few hits from Google, but nothing has really answered my > question: > > After updating the value of a cookie during an AJAX request, can that > value be immediately accessed via the cookie (w/o a new request)? > > [js] > alert(readCookie('mycookie')); > updateCookie('mycookie', 'newValue'); > alert(readCookie('mycookie')); > [/js] You need to be reading the cookie value of the document returned in the AJAX response. It will not update the document.cookie where document refers to the containing document which issued the AJAX request. Hope that helps, -- Matt Warden Cincinnati, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From philthathril at gmail.com Mon Jun 16 15:54:49 2008 From: philthathril at gmail.com (Philip Thompson) Date: Mon, 16 Jun 2008 15:54:49 -0500 Subject: [Javascript] AJAX + Cookies In-Reply-To: References: <274E0F75-ED8B-48F5-8C55-C15FDC530948@gmail.com> Message-ID: <8352F7FC-715B-467D-BDC4-85204F0EE44D@gmail.com> On Jun 16, 2008, at 3:41 PM, Matt Warden wrote: > On Mon, Jun 16, 2008 at 4:36 PM, Philip Thompson > wrote: >> Hi all. >> >> I've been hitting my head against the wall for a while now. I've >> gotten a few hits from Google, but nothing has really answered my >> question: >> >> After updating the value of a cookie during an AJAX request, can that >> value be immediately accessed via the cookie (w/o a new request)? >> >> [js] >> alert(readCookie('mycookie')); >> updateCookie('mycookie', 'newValue'); >> alert(readCookie('mycookie')); >> [/js] > > You need to be reading the cookie value of the document returned in > the AJAX response. It will not update the document.cookie where > document refers to the containing document which issued the AJAX > request. Matt, thanks for your prompt response. However, I'm not sure I follow. Is this what you mean... Document 1: Makes AJAX call to Document 2 that does stuff and updates the cookies Document 2: Updates the cookies and sets the new values and returns stuff to Document 1 Are you saying that the new cookie values are only accessible by Document 1 at this point? If not, can you please elaborate? Thanks, ~Philip From mwarden at gmail.com Mon Jun 16 16:01:12 2008 From: mwarden at gmail.com (Matt Warden) Date: Mon, 16 Jun 2008 17:01:12 -0400 Subject: [Javascript] AJAX + Cookies In-Reply-To: <8352F7FC-715B-467D-BDC4-85204F0EE44D@gmail.com> References: <274E0F75-ED8B-48F5-8C55-C15FDC530948@gmail.com> <8352F7FC-715B-467D-BDC4-85204F0EE44D@gmail.com> Message-ID: On Mon, Jun 16, 2008 at 4:54 PM, Philip Thompson wrote: > Matt, thanks for your prompt response. However, I'm not sure I follow. > Is this what you mean... > > Document 1: > Makes AJAX call to Document 2 that does stuff and updates the cookies > > Document 2: > Updates the cookies and sets the new values and returns stuff to > Document 1 > > Are you saying that the new cookie values are only accessible by > Document 1 at this point? If not, can you please elaborate? No, the opposite. But let me change it slightly to be technically correct. Make request to server with cookie A data, server returns document 1 Document 1 contains code that initiates a async call to server with cookie B data, and server returns document 2 document 1 contains cookie A data document 2 contains cookie A data except where cookie B data has same name as cookie A data, in which case the value will be from cookie B If you were then to reload document 1 (without sending any cookie data), you would get the same result as which was sent to document 2. The point is that the cookie data for a document is static after the server response is made to send you that document, unless you manipulate the cookie data directly with JavaScript. -- Matt Warden Cincinnati, OH, USA http://mattwarden.com This email proudly and graciously contributes to entropy. From skip at bigskypenguin.com Fri Jun 20 16:58:33 2008 From: skip at bigskypenguin.com (Skip Evans) Date: Fri, 20 Jun 2008 16:58:33 -0500 Subject: [Javascript] Speed of loading JS files Message-ID: <485C2809.3020802@bigskypenguin.com> Hey all, Our system that uses lots of AJAX in a total of 154K. However, the site is taking a long time to load the initial page and the individual JS files, approximately 10 to 15 seconds of waiting. The JS is in about 39 separate files simply because we build individual PHP and JS files per system module and that's just how it worked out for this application. Does the number of files greatly affect that initial download off all the JS? Would it speed up significantly if we combined them into just a couple of files? If not, could someone suggest a more efficient way to get the JS code to the browser? Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ From johnzabroski at yahoo.com Fri Jun 20 17:03:01 2008 From: johnzabroski at yahoo.com (John Zabroski) Date: Fri, 20 Jun 2008 15:03:01 -0700 (PDT) Subject: [Javascript] Speed of loading JS files In-Reply-To: <485C2809.3020802@bigskypenguin.com> Message-ID: <639000.55120.qm@web65705.mail.ac4.yahoo.com> Buy Steve Souders book on front-end engineering. http://stevesouders.com/ Follow the 14 rules and do performance profiling the way he recommends. Skip Evans wrote: Hey all, Our system that uses lots of AJAX in a total of 154K. However, the site is taking a long time to load the initial page and the individual JS files, approximately 10 to 15 seconds of waiting. The JS is in about 39 separate files simply because we build individual PHP and JS files per system module and that's just how it worked out for this application. Does the number of files greatly affect that initial download off all the JS? Would it speed up significantly if we combined them into just a couple of files? If not, could someone suggest a more efficient way to get the JS code to the browser? Thanks, Skip -- Skip Evans Big Sky Penguin, LLC 503 S Baldwin St, #1 Madison, WI 53703 608-250-2720 http://bigskypenguin.com =-=-=-=-=-=-=-=-=-= Check out PHPenguin, a lightweight and versatile PHP/MySQL, AJAX & DHTML development framework. http://phpenguin.bigskypenguin.com/ _______________________________________________ Javascript mailing list Javascript at lists.evolt.org http://lists.evolt.org/mailman/listinfo/javascript From scott at randomchaos.com Fri Jun 20 17:26:56 2008 From: scott at randomchaos.com (Scott Reynen) Date: Fri, 20 Jun 2008 16:26:56 -0600 Subject: [Javascript] Speed of loading JS files In-Reply-To: <485C2809.3020802@bigskypenguin.com> References: <485C2809.3020802@bigskypenguin.com> Message-ID: <41F1530B-2928-4538-8EC2-D951BB74CC7D@randomchaos.com> On [Jun 20], at [ Jun 20] 3:58 , Skip Evans wrote: > Hey all, > > Our system that uses lots of AJAX in a total of > 154K. However, the site is taking a long time to > load the initial page and the individual JS files, > approximately 10 to 15 seconds of waiting. > > The JS is in about 39 separate files simply > because we build individual PHP and JS files per > system module and that's just how it worked out > for this application. > > Does the number of files greatly affect that > initial download off all the JS? Sometimes, yes. Every individual file has added overhead with the HTTP headers for the request and response. > Would it speed up > significantly if we combined them into just a > couple of files? That depends on how you define "significantly." It will certainly speed it up somewhat. By your numbers, each file is about 4k. If we assume (conservatively, I think) the HTTP headers average only 0.4k, that's already 10% of your transfer, not including the time it takes the browser to make and monitor the requests. > If not, could someone suggest a more efficient way > to get the JS code to the browser? Assuming the JS files aren't changing often, make sure you're sending headers to cache these files so they're only loaded once. This is especially important if you have a lot of repeat traffic. YSlow can give you more detail on, as the name implies, why a site is slow: http://developer.yahoo.com/yslow/ Peace, Scott From trojani2000 at hotmail.com Fri Jun 20 22:29:30 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Sat, 21 Jun 2008 03:29:30 +0000 Subject: [Javascript] style.offsetTop/Left Firefox In-Reply-To: <639000.55120.qm@web65705.mail.ac4.yahoo.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> Message-ID: Why is Firefox neglecting "el.style.posTop="..., instruction? Why is there no error report? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ _________________________________________________________________ Need to know now? Get instant answers with Windows Live Messenger. http://www.windowslive.com/messenger/connect_your_way.html?ocid=TXT_TAGLM_WL_Refresh_messenger_062008 From peter at brunone.com Sat Jun 21 14:05:25 2008 From: peter at brunone.com (Peter Brunone) Date: Sat, 21 Jun 2008 12:05:25 -0700 Subject: [Javascript] Speed of loading JS files Message-ID: Don't forget that most browser/server combos will not allow more than 2 simultaneous HTTP requests, so you're working sequentially. Even if the request size is small, the start/stop overhead is quite notable when the requests are laid end-to-end. Peter ---------------------------------------- From: Scott Reynen scott at randomchaos.com On [Jun 20], at [ Jun 20] 3:58 , Skip Evans wrote: > Hey all, > > Our system that uses lots of AJAX in a total of > 154K. However, the site is taking a long time to > load the initial page and the individual JS files, > approximately 10 to 15 seconds of waiting. > > The JS is in about 39 separate files simply > because we build individual PHP and JS files per > system module and that's just how it worked out > for this application. > > Does the number of files greatly affect that > initial download off all the JS? Sometimes, yes. Every individual file has added overhead with the HTTP headers for the request and response. > Would it speed up > significantly if we combined them into just a > couple of files? That depends on how you define "significantly." It will certainly speed it up somewhat. By your numbers, each file is about 4k. If we assume (conservatively, I think) the HTTP headers average only 0.4k, that's already 10% of your transfer, not including the time it takes the browser to make and monitor the requests. > If not, could someone suggest a more efficient way > to get the JS code to the browser? Assuming the JS files aren't changing often, make sure you're sending headers to cache these files so they're only loaded once. This is especially important if you have a lot of repeat traffic. YSlow can give you more detail on, as the name implies, why a site is slow: http://developer.yahoo.com/yslow/ Peace, Scott From dnunes at gmail.com Sat Jun 21 14:59:40 2008 From: dnunes at gmail.com (diego nunes) Date: Sat, 21 Jun 2008 16:59:40 -0300 Subject: [Javascript] style.offsetTop/Left Firefox In-Reply-To: References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> Message-ID: <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> On Sat, Jun 21, 2008 at 12:29 AM, Troy III Ajnej wrote: > Why is Firefox neglecting "el.style.posTop="..., instruction? Well, in theory "pos-top" doesn't exist in CSS specification. Firefox probably is just dropping the declaration, and it shouldn't rise a warning. If you use the correct "top" property, things should work fine. -- diego nunes dnunes.com From trojani2000 at hotmail.com Sun Jun 22 16:30:38 2008 From: trojani2000 at hotmail.com (Troy III Ajnej) Date: Sun, 22 Jun 2008 21:30:38 +0000 Subject: [Javascript] style.offsetTop/Left Firefox In-Reply-To: <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> References: <485C2809.3020802@bigskypenguin.com> <639000.55120.qm@web65705.mail.ac4.yahoo.com> <14f57d420806211259w74240158r635eba40e39ba1b1@mail.gmail.com> Message-ID: Thank's for your reply Diego. Of course that in theory pos-top doesn't exist in CSS, but neither does offset-top, yet there it is. We are able to get offsetTop which is very convenient - by the way - for scripting purpopses on any element. And what really makes it flexible and useful is the fact that it returns a numeric value, that makes it priceless for scripting, but only in casse it has its own analog -the numeric Setter! Especially in combination with properties like event.cilentX/Y that yeld a nondimensional numerical value too. Otherwise it is useles or at least uneficient for practical use. Because style.Top will force you to convert your integer into a string while same time forcing you to declare its physical unit, which by the way might well not be what you expect in some other browser. One would argue that: because the offset property is nondimensional it would cause problems in say browsers that decided to return a value stripped from percents, points, picas or other physicall dimensions, -but it shouldn't. Since there is - I believe -no programer that would make such a damn mistake of treating the dimensionless value of the Setter as of different dimensional unit from its Getter causing unneccessary and dumb discrepancy errors. That is, -if one browser decided to extract the Getter value from pixels while some other decided to get it from percentage, while preserving the obvious logic that the Setter integer value should be treated same as the value given by the getter, will logically nullify the browser differences no matter what unit it was based on, 'cause they'll be giving exactly the same result, -leaving that argument as false as it is. While on the other hand, it is unfair or completely evil (from some browser part who decided not to support the posTop/Left deliberately), to not rise an error, or at least a warning to the coder who is expectedly unaware that - particularily this nonstandard instruction (among thousands of others being supported including Firefox with no complain once or ever) has been chosen not to. There are a myriad of "nonstandard" properties currently supported by firefox and being added day bay day but not this one. Yet atop it all plays def and refuses to report it to the coder. I very much agree with the part when you say that: "Firefox is probably just dropping the declaration" because it is droping it, but I can't agree much with the seccond part that: "it shouldn't rise a warning". -Because it does rise every other god damn possible irrelevant warning except for this and some other very important ones not mentioned here. This inconsistency, with selfgeneric "standards" that do not require some written agreement for us to be acceptable and/or understandable is what makes firefox a hypocrite, because it will rise a warnig for statements like valign, not to mention thousands of proprietary and nonstandard features it does support while claiming to be the only standards compliant browser available, confusing a standards geeks to think that every proprietary feature supported by firefox is a standard one but that's an obvious lie. I asked this question because during my coding on a Strict HTML 4.01 DTD I simply got confused. What is going on?! Say element.innerHTML alert has just displayed its content to me, while elemet.style.posTop is treated as a simple wellformed comment. Should it? -Well it shouldn't! This way; We now have gained a browser who while in strict mode will even refuse opacity. -Obviously, because its a nonstandard feature! That way if you demand to have opacity on your page, you will have to go back to real standards, that is: a "nonstandard mode". So you either follow stadards all the way (when in strict mode), or you don't, -because the halfway means "no way", no way you can get anywhere. And this is no good. Regards ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Troy III progressive art enterprise ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > Date: Sat, 21 Jun 2008 16:59:40 -0300> From: dnunes at gmail.com> To: javascript at lists.evolt.org> Subject: Re: [Javascript] style.offsetTop/Left Firefox> > On Sat, Jun 21, 2008 at 12:29 AM, Troy III Ajnej> wrote:> > Why is Firefox neglecting "el.style.posTop="..., instruction?> > Well, in theory "pos-top" doesn't exist in CSS specification.> Firefox probably is just dropping the declaration, and it shouldn't> rise a warning.> If you use the correct "top" property, things should work fine.> > -- > diego nunes> dnunes.com> _______________________________________________> Javascript mailing list> Javascript at lists.evolt.org> http://lists.evolt.org/mailman/listinfo/javascript _________________________________________________________________ Introducing Live Search cashback . It's search that pays you back! http://search.live.com/cashback/?&pkw=form=MIJAAF/publ=HMTGL/crea=introsrchcashback From tuofamerikazmostwanted at gmail.com Wed Jun 25 02:33:46 2008 From: tuofamerikazmostwanted at gmail.com (JS Student) Date: Wed, 25 Jun 2008 13:33:46 +0600 Subject: [Javascript] JS Array test Message-ID: <3764dbaf0806250033m5e47cab0nf54991d433dd200e@mail.gmail.com> Hi, I use the following piece of code to test if an element (el) is an array. Can anybody please suggest some improvemnts or point out any errors? So far it's been working fine for me but I just wanted to get some expert opinion on. /**CODE BEGIN**/ if ((typeof(el)=="object") && (typeof(el.length)=="number") && ((el.length==0) || (!(el[0]===undefined)))) { //Perform array operations } /**CODE END**/ Regards, Aaron From ovsnk-reachme at yahoo.com Wed Jun 25 03:43:50 2008 From: ovsnk-reachme at yahoo.com (Nagendra Oleti) Date: Wed, 25 Jun 2008 01:43:50 -0700 (PDT) Subject: [Javascript] javascript profiler Message-ID: <817625.42857.qm@web31107.mail.mud.yahoo.com> what is the best free java script profiler available. I have?object oriented api i have to profile. please suggest. I used YUI profiler but it has?some limitations. Evaluating other profilers. TIA Nagendra Oleti From jonathan.buchanan at gmail.com Wed Jun 25 04:14:30 2008 From: jonathan.buchanan at gmail.com (Jonathan Buchanan) Date: Wed, 25 Jun 2008 10:14:30 +0100 Subject: [Javascript] JS Array test In-Reply-To: <3764dbaf0806250033m5e47cab0nf54991d433dd200e@mail.gmail.com> References: <3764dbaf0806250033m5e47cab0nf54991d433dd200e@mail.gmail.com> Message-ID: On Wed, Jun 25, 2008 at 8:33 AM, JS Student wrote: > Hi, > > I use the following piece of code to test if an element (el) is an > array. Can anybody please suggest some improvemnts or point out any > errors? So far it's been working fine for me but I just wanted to get > some expert opinion on. > > > /**CODE BEGIN**/ > if ((typeof(el)=="object") > && (typeof(el.length)=="number") > && ((el.length==0) || (!(el[0]===undefined)))) { > > //Perform array operations > > } > > /**CODE END**/ > > > Regards, > > Aaron Are you looking to for array-like objects (such as an Array or a Function's "arguments" object) rather than just Arrays, as your method above appears to be doing? Your code fails to identify an Array or array-like if its first element is undefined, is this intentional? Sticking it in an isArray function, I get the following results: >>> isArray([]) true >>> isArray("") false >>> (function() { return isArray(arguments); })() true >>> (function() { return isArray(arguments); })(undefined) false >>> isArray([undefined]) false >>> isArray([undefined, 1, 2, 3, 4, 5]) false >>> isArray({"0": "toast"}) false >>> isArray({length: 1, "0": "toast"}) true >>> isArray({length: 1, "0": undefined}) false Personally, I would drop the check for .length being 0 or [0] being undefined, as it causes your method to fail on inputs which are actually array-like, as shown above. Note that you're also matching Objects with properties which appear to be array-like - this is fine if you're not expecting to be able to call Array methods. If you're actually looking for instances of Array (say, so you know you can safely call Array methods such as "slice", which you couldn't do directly on a Funciton's "arguments" object) then you could just use "el instanceof Array," but without knowing _why_ you're checking for array-like objects, I couldn't add much more at this stage :) Regards, Jonathan. From jonathan.buchanan at gmail.com Wed Jun 25 04:18:33 2008 From: jonathan.buchanan at gmail.com (Jonathan Buchanan) Date: Wed, 25 Jun 2008 10:18:33 +0100 Subject: [Javascript] javascript profiler In-Reply-To: <817625.42857.qm@web31107.mail.mud.yahoo.com> References: <817625.42857.qm@web31107.mail.mud.yahoo.com> Message-ID: On Wed, Jun 25, 2008 at 9:43 AM, Nagendra Oleti wrote: > what is the best free java script profiler available. I have object oriented api i have to profile. please suggest. I used YUI profiler but it has some limitations. Evaluating other profilers. > TIA > Nagendra Oleti Firebug has a profiler: http://getfirebug.com/ Regards, Jonathan. From ovsnk-reachme at yahoo.com Wed Jun 25 04:23:02 2008 From: ovsnk-reachme at yahoo.com (Nagendra Oleti) Date: Wed, 25 Jun 2008 02:23:02 -0700 (PDT) Subject: [Javascript] javascript profiler Message-ID: <127608.74571.qm@web31101.mail.mud.yahoo.com> thanks Jonathan. I am looking at a profiler for IE. There is a huge difference in execution times between IE ad FF. Regards, Nagendra ----- Original Message ---- From: Jonathan Buchanan To: JavaScript List Sent: Wednesday, June 25, 2008 2:48:33 PM Subject: Re: [Javascript] javascript profiler On Wed, Jun 25, 2008 at 9:43 AM, Nagendra Oleti wrote: > what is the best free java script profiler available. I have object oriented api i have to profile. please suggest. I used YUI profiler but it has some limitations. Evaluating other profilers. > TIA > Nagendra Oleti Firebug has a profiler: http://getfirebug.com/ Regards, Jonathan. _______________________________________________ Javascript mailing list Javascript at lists.evolt.org http://lists.evolt.org/mailman/listinfo/javascript From del at delweg.com Wed Jun 25 07:11:08 2008 From: del at delweg.com (Del Wegener) Date: Wed, 25 Jun 2008 07:11:08 -0500 Subject: [Javascript] Syntax Checking Message-ID: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop> Good Morning; Yesterday I spent more than an hour hunting for what turned out to be a missing single quote in a 1612 line Javascript file. Is there a good syntax checker that I could use to find such errors? A validation checker? Thanks for any recommendations. Del From mdougherty at pbp.com Wed Jun 25 09:51:06 2008 From: mdougherty at pbp.com (Mike Dougherty) Date: Wed, 25 Jun 2008 09:51:06 -0500 Subject: [Javascript] Syntax Checking In-Reply-To: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop> References: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop> Message-ID: <59bedf280806250751v4b4fc06dg304f548fec233418@mail.gmail.com> On Wed, Jun 25, 2008 at 7:11 AM, Del Wegener wrote: > Yesterday I spent more than an hour hunting for what turned out to be a > missing single quote in a 1612 line Javascript file. Is there a good syntax > checker that I could use to find such errors? A validation checker? I recommend writing shorter procedures and testing them as you go :) From del at delweg.com Wed Jun 25 11:52:25 2008 From: del at delweg.com (Del Wegener) Date: Wed, 25 Jun 2008 11:52:25 -0500 Subject: [Javascript] Syntax Checking References: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop> <59bedf280806250751v4b4fc06dg304f548fec233418@mail.gmail.com> Message-ID: <004501c8d6e3$d895df00$6501a8c0@delweglaptop> > On Wed, Jun 25, 2008 at 7:11 AM, Del Wegener wrote: >> Yesterday I spent more than an hour hunting for what turned out to be a >> missing single quote in a 1612 line Javascript file. Is there a good >> syntax >> checker that I could use to find such errors? A validation checker? > > I recommend writing shorter procedures and testing them as you go :) This is a data file not a procedure. I do check as I go. Evidently while working in the file I "bumped" the wrong key or in some other way deleted the quote and everything stopped working. However, I have found a pretty good syntax checker in Antechinus Javascript Editor. Sorry to have bothered the list with a problem I should have solved long ago by myself. Del From andrewsyip at gmail.com Wed Jun 25 20:15:45 2008 From: andrewsyip at gmail.com (Andrew Ip) Date: Wed, 25 Jun 2008 18:15:45 -0700 Subject: [Javascript] Syntax Checking In-Reply-To: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop> References: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop> Message-ID: <0DA2B44B-6C20-4AF4-A726-D758AA75AFB2@alumni.cs.ubc.ca> You can try JSLint, which is by Douglas Crockford: http://www.jslint.com You may also find similar JavaScript lint programs that can integrate with your text editor to make this more seamless. -andrew On 25-Jun-08, at 5:11 AM, Del Wegener wrote: > Good Morning; > Yesterday I spent more than an hour hunting for what turned out to > be a > missing single quote in a 1612 line Javascript file. Is there a > good syntax > checker that I could use to find such errors? A validation checker? > > Thanks for any recommendations. > > Del > > > _______________________________________________ > Javascript mailing list > Javascript at lists.evolt.org > http://lists.evolt.org/mailman/listinfo/javascript From noah at onemorebug.com Wed Jun 25 21:16:28 2008 From: noah at onemorebug.com (Noah Sussman) Date: Wed, 25 Jun 2008 22:16:28 -0400 Subject: [Javascript] Syntax Checking In-Reply-To: <0DA2B44B-6C20-4AF4-A726-D758AA75AFB2@alumni.cs.ubc.ca> References: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop> <0DA2B44B-6C20-4AF4-A726-D758AA75AFB2@alumni.cs.ubc.ca> Message-ID: On Wed, Jun 25, 2008 at 8:11 AM, Del Wegener wrote: > Is there a good syntax > checker that I could use to find such errors? A validation checker? > > On Wed, Jun 25, 2008 at 9:15 PM, Andrew Ip wrote: > > You can try JSLint, which is by Douglas Crockford: > > > > http://www.jslint.com If you'd like to run JSLint locally, you can do so with the aid of Mozilla's Rhino http://jslint.com/rhino/ The documentation is sparse, but here's how to install JSLint on your local machine (assuming you already have Java installed): 1. Download jslint.js from http://jslint.com/rhino/jslint.js (make sure you use that particular jslint.js, as its specially modified to work with Rhino). 2. Get the Rhino zip file from http://www.mozilla.org/rhino/download.html 3. Open the zip and grab js.jar Then you should then be able to invoke JSLint on any JavaScript file, from the command window (Mac/PC/Linux) like this: java -jar js.jar jslint.js someFile.js From del at delweg.com Fri Jun 27 09:13:52 2008 From: del at delweg.com (Del Wegener) Date: Fri, 27 Jun 2008 09:13:52 -0500 Subject: [Javascript] Syntax Checking References: <006101c8d6bc$8d1c0a80$6501a8c0@delweglaptop><0DA2B44B-6C20-4AF4-A726-D758AA75AFB2@alumni.cs.ubc.ca> Message-ID: <002501c8d860$073234d0$6501a8c0@delweglaptop> Good Morning; Thanks for everyone's suggestions re syntax checking.. I got an overwhelming bunch of suggestion. The comments caused me to look harder at Firebug and the features in the editor (Antechinus) I use to write the Javascript. I still need to do more in that vein. Thanks for the push. Del