<?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>Web Design Blog &#187; JavaScript</title>
	<atom:link href="http://www.northstarwebdesign.com/web-design-blog/category/code/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.northstarwebdesign.com/web-design-blog</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Tue, 07 Jun 2011 15:48:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>Useful Javascript: Detect and Indicate Credit Card Type</title>
		<link>http://www.northstarwebdesign.com/web-design-blog/useful-javascript-detect-and-indicate-credit-card-type/</link>
		<comments>http://www.northstarwebdesign.com/web-design-blog/useful-javascript-detect-and-indicate-credit-card-type/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 14:45:36 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[credit card types]]></category>
		<category><![CDATA[ecommerce]]></category>

		<guid isPermaLink="false">http://www.northstarwebdesign.com/web-design-blog/?p=133</guid>
		<description><![CDATA[I added this useful bit of JavaScript code to an ecommerce project (www.vintagecellars.com) to detect the type of Credit Card someone is entering on a website. enjoy! This JavaScript needs to be added to the &#60;head&#62; of the document: &#60;script type="text/javascript"&#62; // &#60;![CDATA[ function SelectCC(ccnum) { var first = ccnum.charAt(0); var second = ccnum.charAt(1); var [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-135" title="JavaScript: Credit Card Type Detection" src="http://www.northstarwebdesign.com/web-design-blog/wp-content/uploads/2011/02/8.jpg" alt="JavaScript: Credit Card Type Detection" width="562" height="257" /></p>
<p>I added this useful bit of JavaScript code to an ecommerce project (<a href="http://www.vintagecellars.com">www.vintagecellars.com</a>) to detect the type of Credit Card someone is entering on a website.  enjoy!<span id="more-133"></span></p>
<p>This JavaScript needs to be added to the &lt;head&gt; of the document:<br />
<code style="width:552px; height:700px; color:#000; font-size:0.9em;"><br />
&lt;script type="text/javascript"&gt;<br />
// &lt;![CDATA[<br />
function SelectCC(ccnum) {<br />
	var first = ccnum.charAt(0);<br />
	var second = ccnum.charAt(1);<br />
	var third = ccnum.charAt(2);<br />
	var fourth = ccnum.charAt(3);<br />
	if (first == "4") {<br />
		//Visa<br />
		document.getElementById("mastercard").src="/images/mastercard-card-bw.png";<br />
		document.getElementById("amex").src="/images/amex-card-bw.png";<br />
		document.getElementById("discover").src="/images/discover-card-bw.png";<br />
		document.getElementById("visa").src="/images/visa-card.png";<br />
		document.getElementById("cctype").value="1";<br />
	}<br />
	else if ( (first == "3") &#038;&#038; ((second == "4") || (second == "7")) ) {<br />
		//American Express<br />
		document.getElementById("mastercard").src="/images/mastercard-card-bw.png";<br />
		document.getElementById("visa").src="/images/visa-card-bw.png";<br />
		document.getElementById("discover").src="/images/discover-card-bw.png";<br />
		document.getElementById("amex").src="/images/amex-card.png";<br />
		document.getElementById("cctype").value="3";<br />
	}<br />
	else if ( (first == "5") ) {<br />
		//Mastercard<br />
		document.getElementById("amex").src="/images/amex-card-bw.png";<br />
		document.getElementById("visa").src="/images/visa-card-bw.png";<br />
		document.getElementById("discover").src="/images/discover-card-bw.png";<br />
		document.getElementById("mastercard").src="/images/mastercard-card.png";<br />
		document.getElementById("cctype").value="2";<br />
	}<br />
	else if ( (first == "6") &#038;&#038; (second == "0") &#038;&#038; (third == "1") &#038;&#038; (fourth == "1")  ) {<br />
		//Discover<br />
		document.getElementById("amex").src="/images/amex-card-bw.png";<br />
		document.getElementById("visa").src="/images/visa-card-bw.png";<br />
		document.getElementById("mastercard").src="/images/mastercard-card-bw.png";<br />
		document.getElementById("discover").src="/images/discover-card.png";<br />
		document.getElementById("cctype").value="4";<br />
	}<br />
	else {<br />
		document.getElementById("amex").src="/images/amex-card-bw.png";<br />
		document.getElementById("visa").src="/images/visa-card-bw.png";<br />
		document.getElementById("mastercard").src="/images/mastercard-card-bw.png";<br />
		document.getElementById("discover").src="/images/discover-card-bw.png";<br />
		document.getElementById("cctype").value="";<br />
	}<br />
}<br />
// ]]&gt;&lt;/script&gt;<br />
</code></p>
<p>Then you need the credit card types indicated on the page in images:<br />
<code style="width:552px; height:100px; color:#000; font-size:0.9em;"><br />
&lt;div&gt;Card Type:<br />
&lt;img id="visa" src="/images/visa-card.png" alt="" /&gt;<br />
&lt;img id="mastercard" src="/images/mastercard-card.png" alt="" /&gt;<br />
&lt;img id="amex" src="/images/amex-card.png" alt="" /&gt;<br />
&lt;img id="discover" src="/images/discover-card.png" alt="" /&gt;&lt;/div&gt;<br />
</code></p>
<p>You will need to upload Credit Card Type image files, full color and black and white versions, to an &#8220;/images/&#8221; directory.</p>
<p>Lastly, you will need the input field with the user action code assigned:<br />
<code style="width:552px; height:50px; color:#000; font-size:0.9em;"><br />
&lt;input id="ccnum" onkeyup="SelectCC(this.value)" name="ccnum" /&gt;<br />
</code></p>
<p>You can see this script in action on <a href="http://www.vintagecellars.com">www.vintagecellars.com</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.northstarwebdesign.com/web-design-blog/useful-javascript-detect-and-indicate-credit-card-type/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Useful JavaScript: Toggle Div Show/Hide</title>
		<link>http://www.northstarwebdesign.com/web-design-blog/useful-javascript-toggle-div-showhide/</link>
		<comments>http://www.northstarwebdesign.com/web-design-blog/useful-javascript-toggle-div-showhide/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 21:59:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[show]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[web programming]]></category>

		<guid isPermaLink="false">http://www.northstarwebdesign.com/web-design-blog/?p=47</guid>
		<description><![CDATA[I was developing an e-commerce site today and I ran across a pretty light weight piece of JavaScript code to show and hide a DIVs. Here it is: &#60;script type="text/javascript"&#62; &#60;!-- function toggle_visibility(id) { var e = document.getElementById(id); if(e.style.display == 'block') e.style.display = 'none'; else e.style.display = 'block'; } //--&#62; &#60;/script&#62; Put that between your [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_53" class="wp-caption aligncenter" style="width: 572px"><img class="size-full wp-image-53" title="JavaScript: Show or Hide Elements" src="http://www.northstarwebdesign.com/web-design-blog/wp-content/uploads/2010/01/3.jpg" alt="JavaScript: Show or Hide Elements" width="562" height="257" /><p class="wp-caption-text">JavaScript: Show or Hide Elements</p></div>
<p>I was developing an e-commerce site today and I ran across a pretty light weight piece of JavaScript code to show and hide a DIVs.</p>
<p><span id="more-47"></span>Here it is:<br />
<code style="width:552px; height:200px; color:#000; font-size:0.9em;"><br />
&lt;script type="text/javascript"&gt;<br />
&lt;!--<br />
    function toggle_visibility(id) {<br />
       var e = document.getElementById(id);<br />
       if(e.style.display == 'block')<br />
          e.style.display = 'none';<br />
       else<br />
          e.style.display = 'block';<br />
    }<br />
//--&gt;<br />
&lt;/script&gt;<br />
</code></p>
<p>Put that between your HEAD tags and call it from your code with &#8220;onClick=&#8221;.</p>
<p>Simple!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.northstarwebdesign.com/web-design-blog/useful-javascript-toggle-div-showhide/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launched! New NorthstarWebDesign.com</title>
		<link>http://www.northstarwebdesign.com/web-design-blog/new-northstarwebdesign-com-launched/</link>
		<comments>http://www.northstarwebdesign.com/web-design-blog/new-northstarwebdesign-com-launched/#comments</comments>
		<pubDate>Fri, 01 Jan 2010 08:01:58 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Layout Design]]></category>
		<category><![CDATA[Multimedia Production]]></category>
		<category><![CDATA[Search Engine Optimization]]></category>
		<category><![CDATA[User Interface Design]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Website Optimization]]></category>
		<category><![CDATA[Websites]]></category>
		<category><![CDATA[New Website]]></category>
		<category><![CDATA[Norhtstar Web Design]]></category>
		<category><![CDATA[Northstar]]></category>

		<guid isPermaLink="false">http://www.northstarwebdesign.com/web-design-blog/?p=3</guid>
		<description><![CDATA[We have launched our new redesign of NorthstarWebDesign.com. With so much client work we had no time to re-brand for the last few years and thought it was well over due to be updated to reflect the level and style of our work. The new website will continue to change over the next few weeks [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_43" class="wp-caption aligncenter" style="width: 572px"><img class="size-full wp-image-43 " title="Launched! New NorthstarWebDesign.com" src="http://www.northstarwebdesign.com/web-design-blog/wp-content/uploads/2010/01/1.jpg" alt="New NorthstarWebDesign.com Screenshot" width="562" height="257" /><p class="wp-caption-text">Launched! New NorthstarWebDesign.com Screenshot</p></div>
<p><strong>We have launched our new redesign of NorthstarWebDesign.com.</strong> With so much client work we had no time to re-brand for the last few years and thought it was well over due to be updated to reflect the level and style of our work.</p>
<p><span id="more-3"></span></p>
<p>The new website will continue to change over the next few weeks and we will let you know about updates!  Thanks for your interest and continued support!</p>
<p><a href="http://www.northstarwebdesign.com" target="_self">http://www.northstarwebdesign.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.northstarwebdesign.com/web-design-blog/new-northstarwebdesign-com-launched/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

