<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Brady &#187; JavaScript</title>
	<atom:link href="http://l3rady.com/category/code-and-snippets/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://l3rady.com</link>
	<description>A moan, a groan, my life story and how me, a technically minded person just can't seem to fit in with anybody.</description>
	<lastBuildDate>Sat, 12 Jun 2010 22:25:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Javascript Same Height Div&#8217;s Update</title>
		<link>http://l3rady.com/2008/08/14/javascript-same-height-divs-update/</link>
		<comments>http://l3rady.com/2008/08/14/javascript-same-height-divs-update/#comments</comments>
		<pubDate>Thu, 14 Aug 2008 15:26:39 +0000</pubDate>
		<dc:creator>Brady</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://l3rady.com/?p=352</guid>
		<description><![CDATA[A while back I posted a way of making same height div’s but came across an issue when padding was involved. Well I’ve modified my code to take into account padding. Now the obvious thing to do would be to be to check padding on a div and subtract it from the height, but it’s [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I posted a way of making same height div’s but came across an issue when padding was involved. Well I’ve modified my code to take into account padding. Now the obvious thing to do would be to be to check padding on a div and subtract it from the height, but it’s not that easy. You would have to check three things: padding, paddingTop and paddingBottom. For some reason when I was checking padding I couldn’t get a value from JavaScript, this had me really stumped but after a nights sleep I came up with a better and more simpler way of sorting the padding issue. This is to let the code run and let it re-height the div’s and let the padding mess things up then run the same thing again and check for height differences from last time we checked. Oooohhh look the height has gone up 10px from last time thanks to a padding of 5px on the div. Now we know there is 10px of padding lets remove it. Sorted!</p>
<p>JavaScript Code:</p>
<pre class="brush: js">
function sameHeight(divs) // Bring in an array of your divs
{
var highest = 0;
var heighttu = 0;
for(i = 0; i &lt; divs.length; i++) // Loop through the divs
{
// Check to see if this div is the highest?
if(document.getElementById(divs[i]).offsetHeight &gt; highest)
{
// Yes its the highest so set the highest value to this div&#039;s height
highest = document.getElementById(divs[i]).offsetHeight;
}
}
// Loop through divs and set their hieght all the same
for(i = 0; i &lt; divs.length; i++)
{
document.getElementById(divs[i]).style.height = highest+&quot;px&quot;;
}
// now get offset hieght again and we may found we have gone higher this is because of padding
if(document.getElementById(divs[0]).offsetHeight &gt; highest)
{
// correct the height
highest = highest - (document.getElementById(divs[0]).offsetHeight - highest);
// Correct divs
for(i = 0; i &lt; divs.length; i++)
{
document.getElementById(divs[i]).style.height = highest+&quot;px&quot;;
}
}
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://l3rady.com/2008/08/14/javascript-same-height-divs-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript Same Height Div&#8217;s</title>
		<link>http://l3rady.com/2008/06/05/javascript-same-height-divs/</link>
		<comments>http://l3rady.com/2008/06/05/javascript-same-height-divs/#comments</comments>
		<pubDate>Thu, 05 Jun 2008 10:50:25 +0000</pubDate>
		<dc:creator>Brady</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://l3rady.com/?p=90</guid>
		<description><![CDATA[Recently I had to make some divs the same height. Usually I would just pad the bottom of a div with page breaks but I couldn’t do that this time round as the page content is dynamic and the height of the divs could change. First thing I did was look online for answers and [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I had to make some divs the same height. Usually I would just pad the bottom of a div with page breaks but I couldn’t do that this time round as the page content is dynamic and the height of the divs could change.</p>
<p>First thing I did was look online for answers and sure enough there were solutions but looking at them they seemed over complicated so I decided to write my own solution.</p>
<p>Javascript Code:</p>
<p>Update at: <a href="http://l3rady.com/2008/08/14/javascript-same-height-divs-update/">http://l3rady.com/2008/08/14/javascript-same-height-divs-update/</a></p>
<p>Simply pass an array of your divs to the function. Easy peasy&#8230;.</p>
<p>Just an extra word of warning&#8230; Be aware of using padding on the blocks you pass to this function. If the paddings are different in each block then they may not end up being the same height. Although you could modify the function to check for the use of padding and alter the heights accordingly.</p>
]]></content:encoded>
			<wfw:commentRss>http://l3rady.com/2008/06/05/javascript-same-height-divs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax and JavaScript Exploiting</title>
		<link>http://l3rady.com/2007/08/18/ajax-and-javascript-exploiting/</link>
		<comments>http://l3rady.com/2007/08/18/ajax-and-javascript-exploiting/#comments</comments>
		<pubDate>Sat, 18 Aug 2007 17:12:04 +0000</pubDate>
		<dc:creator>Brady</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://l3rady.com/?p=17</guid>
		<description><![CDATA[You may be aware of website-codes.com if not let me tell you. The idea of it was to provide php scripts that could run from any webhost that didn&#8217;t have php support. How I would achieve this would be through a line of JavaScript that user would put on their site. Well the website has [...]]]></description>
			<content:encoded><![CDATA[<p>You may be aware of website-codes.com if not let me tell you. The idea of it was to provide php scripts that could run from any webhost that didn&#8217;t have php support. How I would achieve this would be through a line of JavaScript that user would put on their site. Well the website has been put on hold as I haven&#8217;t found time to code it.</p>
<p>Well anyway because I&#8217;ve been doing a lot of Ajax and JavaScript coding for where I work it had me thinking. If you could get Ajax to work on any webhost with only putting one line of code on their site? Well sure enough you can. I did a bit of testing there and then and it worked 100%. I couldn&#8217;t believe it. Because with JavaScript you can literally change the whole look and feel of a webpage, if you think hard enough you can see how this can be very dangerous to people’s websites. One thing that comes straight to mind is that you can use this one line of code to turn a whole page into a login page look-a-like (phishing) I now see why many public pages don&#8217;t allow JavaScript. E.G. MySpace.</p>
]]></content:encoded>
			<wfw:commentRss>http://l3rady.com/2007/08/18/ajax-and-javascript-exploiting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
