<?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>Mukesh Chapagain&#039;s Blog &#187; Javascript</title>
	<atom:link href="http://blog.chapagain.com.np/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chapagain.com.np</link>
	<description>PHP Magento jQuery SQL Wordpress Joomla Programming &#38; Tutorial</description>
	<lastBuildDate>Tue, 07 Feb 2012 00:54:41 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.3</generator>
		<item>
		<title>Javascript: How to Submit form and Change form action?</title>
		<link>http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/</link>
		<comments>http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 17:59:53 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=1539</guid>
		<description><![CDATA[This article will show you how to submit form and change form action using javascript. This is a very simple trick but it&#8217;s very useful and frequently used. Submit Form using Javascript HTML form Javascript function Change form action using Javascript HTML form Javascript function Full Source Code Hope it helps. Thanks. Copyright &#169; 2011 [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-show-hide-textbox-text-on-focus/' rel='bookmark' title='Permanent Link: Javascript: Show Hide textbox text on focus'>Javascript: Show Hide textbox text on focus</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-change-or-reorder-top-links/' rel='bookmark' title='Permanent Link: Magento: How to change or reorder top links?'>Magento: How to change or reorder top links?</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This article will show you how to submit form and change form action using javascript. This is a very simple trick but it&#8217;s very useful and frequently used.</p>
<p><strong>Submit Form using Javascript</strong></p>
<p><span id="more-1539"></span></p>
<p>HTML form</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form name=&quot;myForm&quot; action=&quot;http://google.com&quot; method=&quot;get&quot;&gt;
	Search: &lt;input type=&quot;text&quot; name=&quot;q&quot; /&gt;
	&lt;button onclick=&quot;javascript: submitForm()&quot;&gt;Search&lt;/button&gt;
&lt;/form&gt;
</pre>
<p>Javascript function</p>
<pre class="brush: jscript; title: ; notranslate">
function submitForm()
{
  document.myForm.submit();
}
</pre>
<p><strong>Change form action using Javascript</strong></p>
<p>HTML form</p>
<pre class="brush: xml; title: ; notranslate">
&lt;form name=&quot;newForm&quot; method=&quot;get&quot; onSubmit=&quot;formAction(this)&quot;&gt;
	Search: &lt;input type=&quot;text&quot; name=&quot;q&quot; /&gt;
	&lt;input type=&quot;submit&quot; name=&quot;search&quot; value=&quot;Search&quot;&gt;
&lt;/form&gt;
</pre>
<p>Javascript function</p>
<pre class="brush: jscript; title: ; notranslate">
function formAction()
{
  document.newForm.action = &quot;http://google.com&quot;;
}
</pre>
<p><strong>Full Source Code</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
	&lt;head&gt;
		&lt;title&gt;Javascript and Forms&lt;/title&gt;
		&lt;script type=&quot;text/javascript&quot;&gt;
			function submitForm()
			{
			  document.myForm.submit();
			}

			function formAction()
			{
			  document.newForm.action = &quot;http://google.com&quot;;
			}
		&lt;/script&gt;
	&lt;/head&gt;
	&lt;body&gt;
		&lt;p&gt;
			Example 1: Submitting form through Javascript
			&lt;form name=&quot;myForm&quot; action=&quot;http://google.com&quot; method=&quot;get&quot;&gt;
				Search: &lt;input type=&quot;text&quot; name=&quot;q&quot; /&gt;
				&lt;button onclick=&quot;javascript: submitForm()&quot;&gt;Search&lt;/button&gt;
			&lt;/form&gt;
		&lt;/p&gt;

		&lt;p&gt;
			Example 2: Changing form action through Javascript
			&lt;form name=&quot;newForm&quot; method=&quot;get&quot; onSubmit=&quot;formAction(this)&quot;&gt;
				Search: &lt;input type=&quot;text&quot; name=&quot;q&quot; /&gt;
				&lt;input type=&quot;submit&quot; name=&quot;search&quot; value=&quot;Search&quot;&gt;
			&lt;/form&gt;
		&lt;/p&gt;
	&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>Hope it helps. Thanks.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=1539&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-show-hide-textbox-text-on-focus/' rel='bookmark' title='Permanent Link: Javascript: Show Hide textbox text on focus'>Javascript: Show Hide textbox text on focus</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/magento-how-to-change-or-reorder-top-links/' rel='bookmark' title='Permanent Link: Magento: How to change or reorder top links?'>Magento: How to change or reorder top links?</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript: Show Hide textbox text on focus</title>
		<link>http://blog.chapagain.com.np/javascript-show-hide-textbox-text-on-focus/</link>
		<comments>http://blog.chapagain.com.np/javascript-show-hide-textbox-text-on-focus/#comments</comments>
		<pubDate>Mon, 26 Sep 2011 14:33:25 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=1376</guid>
		<description><![CDATA[This might be simple one but it is a very handy code. Generally, I see this being used in Search textbox where there is some text like &#8216;search&#8230;&#8217; by default. And, when you put the mouse cursor on the textbox, the text is removed and then you can type your desired search text. For this, [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-show-hide-website-to-search-engines-by-adjusting-robots-meta-tag/' rel='bookmark' title='Permanent Link: Magento: Show/Hide website to search engines by adjusting robots meta tag'>Magento: Show/Hide website to search engines by adjusting robots meta tag</a></li>
<li><a href='http://blog.chapagain.com.np/magento-showhide-demo-store-notice/' rel='bookmark' title='Permanent Link: Magento: Show/Hide Demo Store Notice'>Magento: Show/Hide Demo Store Notice</a></li>
<li><a href='http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/' rel='bookmark' title='Permanent Link: PHP Javascript : Playing with multi-dimensional array'>PHP Javascript : Playing with multi-dimensional array</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This might be simple one but it is a very handy code. Generally, I see this being used in Search textbox where there is some text like &#8216;search&#8230;&#8217; by default. And, when you put the mouse cursor on the textbox, the text is removed and then you can type your desired search text.</p>
<p>For this, two javascript event handler are used: <strong>onFocus</strong> and <strong>onBlur</strong>.</p>
<p><span id="more-1376"></span></p>
<p><strong>onFocus</strong>: event handler used when the body of the page receives focus<br />
<strong>onBlur</strong>: event handler used when the body of the page loses focus</p>
<p>Here is the code:-</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;input type=&quot;text&quot; name=&quot;search&quot; value=&quot;search...&quot;
	   onFocus=&quot;if(this.value != '') {this.value = '';}&quot;
	   onBlur=&quot;if (this.value == '') {this.value = 'search...';}&quot;
	/&gt;
</pre>
<p>Hope this helps. Thanks.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=1376&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/magento-show-hide-website-to-search-engines-by-adjusting-robots-meta-tag/' rel='bookmark' title='Permanent Link: Magento: Show/Hide website to search engines by adjusting robots meta tag'>Magento: Show/Hide website to search engines by adjusting robots meta tag</a></li>
<li><a href='http://blog.chapagain.com.np/magento-showhide-demo-store-notice/' rel='bookmark' title='Permanent Link: Magento: Show/Hide Demo Store Notice'>Magento: Show/Hide Demo Store Notice</a></li>
<li><a href='http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/' rel='bookmark' title='Permanent Link: PHP Javascript : Playing with multi-dimensional array'>PHP Javascript : Playing with multi-dimensional array</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/javascript-show-hide-textbox-text-on-focus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Magento jQuery: How to use them together?</title>
		<link>http://blog.chapagain.com.np/magento-jquery-how-to-use-them-together/</link>
		<comments>http://blog.chapagain.com.np/magento-jquery-how-to-use-them-together/#comments</comments>
		<pubDate>Wed, 02 Mar 2011 00:34:28 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Magento]]></category>
		<category><![CDATA[prototype]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=1095</guid>
		<description><![CDATA[By default, Magento contains and uses the Prototype javascript library. You can also integrate the other most popular javascript library &#8216;jQuery&#8216; in your Magento site. While integrating jQuery in Magento, you might get some javascript conflict and errors as you will be using two javascript libraries (prototype and jQuery) at a time. This is caused [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/jquery-grey-out-background-and-preview-image-as-popup/' rel='bookmark' title='Permanent Link: jQuery: Grey out background and preview image as popup'>jQuery: Grey out background and preview image as popup</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-print-array-and-object/' rel='bookmark' title='Permanent Link: jQuery: Print array and object'>jQuery: Print array and object</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-preview-image-with-zoom-effect/' rel='bookmark' title='Permanent Link: jQuery: Preview Image with Zoom Effect'>jQuery: Preview Image with Zoom Effect</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-animate-and-transfer-effect-with-image/' rel='bookmark' title='Permanent Link: jQuery: Animate and Transfer effect with Image'>jQuery: Animate and Transfer effect with Image</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-preview-image-with-tooltip-effect/' rel='bookmark' title='Permanent Link: jQuery: Preview Image with Tooltip Effect'>jQuery: Preview Image with Tooltip Effect</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>By default, Magento contains and uses the <strong>Prototype</strong> javascript library. You can also integrate the other most popular javascript library &#8216;<strong>jQuery</strong>&#8216; in your Magento site. </p>
<p>While integrating jQuery in Magento, you might get some javascript conflict and errors as you will be using two javascript libraries (prototype and jQuery) at a time. This is caused because prototype also uses &#8216;<strong>$</strong>&#8216; as a function or variable name, just as jQuery does.</p>
<p><span id="more-1095"></span></p>
<p>Well, jQuery has a solution for this conflict case. Here&#8217;s what <a href="http://api.jquery.com/jQuery.noConflict/" rel="nofollow">jQuery</a> has to say about the conflict:-</p>
<blockquote><p>
Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery&#8217;s case, $ is just an alias for jQuery, so all functionality is available without using $. If we need to use another JavaScript library alongside jQuery, we can return control of $ back to the other library with a call to $.noConflict():
</p></blockquote>
<p>Here, I will explain you on how you can integrate jQuery in Magento without any conflict and error.</p>
<p>Below is the <strong>step-by-step guide to integrate jQuery with Magento</strong>:-</p>
<p>1) Download jQuery from <a href="http://docs.jquery.com/Downloading_jQuery#Download_jQuery" rel="nofollow">jquery.com</a><br />
2) Copy the jquery file to the following directory: <strong>skin/frontend/default/your_theme/js/</strong><br />
3) Open <strong>app/design/frontend/default/your_theme/layout/page.xml</strong><br />
4) In page.xml file, search for block with name &#8216;<strong>head</strong>&#8216; and add the following code inside it (I suppose that your jquery file name is <strong>jquery.js</strong>):-</p>
<pre class="brush: xml; title: ; notranslate">
	&lt;action method=&quot;addItem&quot;&gt;&lt;type&gt;skin_js&lt;/type&gt;&lt;name&gt;js/jquery.js&lt;/name&gt;&lt;/action&gt;
	</pre>
<p>5) Removing conflict between two javascript libraries (prototype and jquery):<br />
	- Open <strong>app/design/frontend/default/your_theme/template/page/head.phtml</strong><br />
	- Add the following code at the end of this page:-</p>
<pre class="brush: jscript; title: ; notranslate">
		&lt;script type=&quot;text/javascript&quot;&gt;
			jQuery.noConflict();
		&lt;/script&gt;
		</pre>
<p>6) That&#8217;s all. You are done. Now, you can use jQuery in your Magento website freely and without any conflict. :)</p>
<p>Hope this helps. Thanks.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=1095&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/jquery-grey-out-background-and-preview-image-as-popup/' rel='bookmark' title='Permanent Link: jQuery: Grey out background and preview image as popup'>jQuery: Grey out background and preview image as popup</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-print-array-and-object/' rel='bookmark' title='Permanent Link: jQuery: Print array and object'>jQuery: Print array and object</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-preview-image-with-zoom-effect/' rel='bookmark' title='Permanent Link: jQuery: Preview Image with Zoom Effect'>jQuery: Preview Image with Zoom Effect</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-animate-and-transfer-effect-with-image/' rel='bookmark' title='Permanent Link: jQuery: Animate and Transfer effect with Image'>jQuery: Animate and Transfer effect with Image</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-preview-image-with-tooltip-effect/' rel='bookmark' title='Permanent Link: jQuery: Preview Image with Tooltip Effect'>jQuery: Preview Image with Tooltip Effect</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/magento-jquery-how-to-use-them-together/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Javascript: How to get current URL without Query string?</title>
		<link>http://blog.chapagain.com.np/javascript-how-to-get-current-url-without-query-string/</link>
		<comments>http://blog.chapagain.com.np/javascript-how-to-get-current-url-without-query-string/#comments</comments>
		<pubDate>Fri, 28 Jan 2011 09:41:23 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=1033</guid>
		<description><![CDATA[Here is a quick code to get the current URL of a page with Javascript:- var current_url = location.href; Here is another way:- var current_url = document.URL; Suppose, you have query string in your URL and you only want to get the actual URL without the query string. Here is the code for this:- var [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in Javascript'>Website statistic (User Information) in Javascript</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Here is a quick code to get the current URL of a page with Javascript:-</p>
<blockquote><p>var current_url = location.href;</p></blockquote>
<p>Here is another way:-</p>
<p><span id="more-1033"></span></p>
<blockquote><p>var current_url = document.URL;</p></blockquote>
<p>Suppose, you have query string in your URL and you only want to get the actual URL without the query string.</p>
<p>Here is the code for this:-</p>
<blockquote><p>var url = location.href;<br />
var url_parts = url.split(&#8216;?&#8217;);<br />
var main_url = url_parts[0]; </p></blockquote>
<p>Hope this helps. Thanks.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=1033&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in Javascript'>Website statistic (User Information) in Javascript</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/javascript-how-to-get-current-url-without-query-string/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>print_r in Javascript</title>
		<link>http://blog.chapagain.com.np/print_r-in-javascript/</link>
		<comments>http://blog.chapagain.com.np/print_r-in-javascript/#comments</comments>
		<pubDate>Fri, 08 Jan 2010 07:45:02 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[print]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=491</guid>
		<description><![CDATA[It&#8217;s a real headache when you have to work on objects and arrays in Javascript. It would be lot easier to detect elements of the Javascript objects/arrays if we have print_r function in Javascript as we have in PHP. I googled the web and have found a very efficient print_r Javascript function. This has helped [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in Javascript'>Website statistic (User Information) in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/' rel='bookmark' title='Permanent Link: PHP Javascript : Playing with multi-dimensional array'>PHP Javascript : Playing with multi-dimensional array</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a real headache when you have to work on objects and arrays in Javascript. It would be lot easier to detect elements of the Javascript objects/arrays if we have print_r function in Javascript as we have in PHP.</p>
<p>I googled the web and have found a very efficient print_r Javascript function. This has helped me a lot in my projects. Here is the code:-</p>
<p><span id="more-491"></span></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
	function print_r(theObj){
	   if(theObj.constructor == Array || theObj.constructor == Object){
		  document.write(&quot;&lt;ul&gt;&quot;)
		  for(var p in theObj){
			 if(theObj[p].constructor == Array || theObj[p].constructor == Object){
				document.write(&quot;&lt;li&gt;[&quot;+p+&quot;] =&gt; &quot;+typeof(theObj)+&quot;&lt;/li&gt;&quot;);
				document.write(&quot;&lt;ul&gt;&quot;)
				print_r(theObj[p]);
				document.write(&quot;&lt;/ul&gt;&quot;)
			 } else {
				document.write(&quot;&lt;li&gt;[&quot;+p+&quot;] =&gt; &quot;+theObj[p]+&quot;&lt;/li&gt;&quot;);
			 }
		  }
		  document.write(&quot;&lt;/ul&gt;&quot;)
	   }
	}
&lt;/script&gt;
</pre>
<p><strong>USING PRINT_R</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;script type=&quot;text/javascript&quot;&gt;
print_r(JAVACRIPT_ARRAY_OR_OBJECT);
&lt;/script&gt;
</pre>
<p><em>Source: http://www.brandnewbox.co.uk/articles/details/a_print_r_equivalent_for_javascript/</em></p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=491&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in Javascript'>Website statistic (User Information) in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/' rel='bookmark' title='Permanent Link: PHP Javascript : Playing with multi-dimensional array'>PHP Javascript : Playing with multi-dimensional array</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/print_r-in-javascript/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Javascript: Show/Hide HTML elements</title>
		<link>http://blog.chapagain.com.np/javascript-showhide-html-elements/</link>
		<comments>http://blog.chapagain.com.np/javascript-showhide-html-elements/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 12:26:51 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=277</guid>
		<description><![CDATA[Here, I will be demonstrating on showing or hiding a div when a link is clicked. I have done this with Javascript and CSS. I have called showHideDiv() Js function when the link is clicked. The display of the div where content is present, is visible or hidden on each click. For this, CSS styling [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-show-hide-textbox-text-on-focus/' rel='bookmark' title='Permanent Link: Javascript: Show Hide textbox text on focus'>Javascript: Show Hide textbox text on focus</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/how-to-get-html-source-code-of-a-website/' rel='bookmark' title='Permanent Link: How to get(view) html source code of a website'>How to get(view) html source code of a website</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Here, I will be demonstrating on showing or hiding a div when a link is clicked. I have done this with Javascript and CSS.</p>
<p>I have called showHideDiv() Js function when the link is clicked. The display of the div where content is present, is visible or hidden on each click. For this, CSS styling is used (display: none).</p>
<p><span id="more-277"></span></p>
<p>The code follows:</p>
<pre class="brush: jscript; title: ; notranslate">

&lt;div&gt;
	&lt;a onclick=&quot;showHideDiv()&quot; style=&quot;cursor:pointer&quot;&gt;Show / Hide&lt;/a&gt;
	&lt;div id=&quot;addTag&quot; style=&quot;display:none&quot;&gt;This is a test.&lt;/div&gt;
&lt;/div&gt;

&lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&gt;
	function showHideDiv()
	{
		if(document.getElementById('addTag').style.display == &quot;none&quot;) {
			document.getElementById('addTag').style.display = &quot;&quot;;
		}
		else {
			document.getElementById('addTag').style.display = &quot;none&quot;;
		}
	}
&lt;/script&gt;
</pre>
<p>Try, Implement and Enjoy!</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=277&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-show-hide-textbox-text-on-focus/' rel='bookmark' title='Permanent Link: Javascript: Show Hide textbox text on focus'>Javascript: Show Hide textbox text on focus</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/how-to-get-html-source-code-of-a-website/' rel='bookmark' title='Permanent Link: How to get(view) html source code of a website'>How to get(view) html source code of a website</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/javascript-showhide-html-elements/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Javascript: Add Remove HTML elements</title>
		<link>http://blog.chapagain.com.np/javascript-add-remove-html-elements/</link>
		<comments>http://blog.chapagain.com.np/javascript-add-remove-html-elements/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 13:53:05 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=244</guid>
		<description><![CDATA[You can add html elements dynamically with Javascript. In this article, I will show you how to do so. I have created two Javascript functions. One for creating html elements and the other for removing them. In my html elements, I have created &#8216;li&#8217; and &#8216;strong&#8217; elements inside &#8216;div&#8217;. The div id is &#8216;summary&#8217;. I [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in Javascript'>Website statistic (User Information) in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/go-back-link-in-javascript/' rel='bookmark' title='Permanent Link: Go back link in Javascript'>Go back link in Javascript</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>You can add html elements dynamically with Javascript. In this article, I will show you how to do so. I have created two Javascript functions. One for creating html elements and the other for removing them.</p>
<p>In my html elements, I have created &#8216;li&#8217; and &#8216;strong&#8217; elements inside &#8216;div&#8217;. The div id is &#8216;summary&#8217;. I have written comment in the code so that it would be easy to understand.</p>
<p><span id="more-244"></span></p>
<p>Javascript function to create html elements:-</p>
<pre class="brush: jscript; title: ; notranslate">
function createSummary(title,content) {
	// get div id
	var summaryOptions = document.getElementById('summary');

	// create new &lt;li&gt;
	var newLi = document.createElement('li');
	var liIdName = title;
	// set &lt;li&gt; attribute id
	newLi.setAttribute('id',liIdName);

	// create new element &lt;strong&gt;
	var newStrong = document.createElement('strong');
	var strongIdName = title+&quot; strong&quot;;
	// assign id to &lt;strong&gt;
	newStrong.setAttribute('id',strongIdName);

	// adding parameter 'title' value inside &lt;strong&gt;
	newStrong.innerHTML = title;
	// adding &lt;strong&gt; inside div
	summaryOptions.appendChild(newStrong);

	// adding parameter 'content' value inside &lt;li&gt;
	newLi.innerHTML = content;
	// adding &lt;li&gt; inside div
	summaryOptions.appendChild(newLi);
}
</pre>
<p>Javascript function to remove html elements:-</p>
<pre class="brush: jscript; title: ; notranslate">
function removeSummary(title) {
	var summaryOptions = document.getElementById('summary');
	var childLi = document.getElementById(title);
	var childStrong = document.getElementById(title+&quot; strong&quot;);

	// remove &lt;li&gt;
	if(childLi) {
	summaryOptions.removeChild(childLi);
	}

	// remove strong &lt;strong&gt;
	if(childStrong) {
	summaryOptions.removeChild(childStrong);
	}
}
</pre>
<p>Full code is as under:-</p>
<pre class="brush: jscript; title: ; notranslate">

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Test&lt;/title&gt;
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
function createSummary(title,content) {
	// get div id
	var summaryOptions = document.getElementById('summary');

	// create new &lt;li&gt;
	var newLi = document.createElement('li');
	var liIdName = title;
	// set &lt;li&gt; attribute id
	newLi.setAttribute('id',liIdName);

	// create new element &lt;strong&gt;
	var newStrong = document.createElement('strong');
	var strongIdName = title+&quot; strong&quot;;
	// assign id to &lt;strong&gt;
	newStrong.setAttribute('id',strongIdName);

	// adding parameter 'title' value inside &lt;strong&gt;
	newStrong.innerHTML = title;
	// adding &lt;strong&gt; inside div
	summaryOptions.appendChild(newStrong);

	// adding parameter 'content' value inside &lt;li&gt;
	newLi.innerHTML = content;
	// adding &lt;li&gt; inside div
	summaryOptions.appendChild(newLi);
}

function removeSummary(title) {
	var summaryOptions = document.getElementById('summary');
	var childLi = document.getElementById(title);
	var childStrong = document.getElementById(title+&quot; strong&quot;);

	// remove &lt;li&gt;
	if(childLi) {
		summaryOptions.removeChild(childLi);
	}

	// remove &lt;strong&gt;
	if(childStrong) {
		summaryOptions.removeChild(childStrong);
	}
}
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;

&lt;input type=&quot;button&quot; value=&quot;Show&quot; onclick=&quot;createSummary('This is title','This is content.')&quot; /&gt;
&lt;input type=&quot;button&quot; value=&quot;Remove&quot; onclick=&quot;removeSummary('This is title')&quot; /&gt;
&lt;div id=&quot;summary&quot; style=&quot;border:1px solid #CCCCCC; width:400px; &quot;&gt;&amp;amp;nbsp;&lt;/div&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=244&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-how-to-submit-form-and-change-form-action/' rel='bookmark' title='Permanent Link: Javascript: How to Submit form and Change form action?'>Javascript: How to Submit form and Change form action?</a></li>
<li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in Javascript'>Website statistic (User Information) in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/go-back-link-in-javascript/' rel='bookmark' title='Permanent Link: Go back link in Javascript'>Go back link in Javascript</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/javascript-add-remove-html-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHP Javascript : Playing with multi-dimensional array</title>
		<link>http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/</link>
		<comments>http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 05:27:15 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[for loop]]></category>
		<category><![CDATA[multi-dimensional]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/?p=220</guid>
		<description><![CDATA[I had to work on multi-dimensional array with javascript and php. I had a multi-dimensional array in php. I had to load it into javascript array and then populate the html selection list. The challenge for me was to create multi-dimensional array in javascript and populate selection list with for loop in javascript. Here is [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/php-parse-unparse-string-array/' rel='bookmark' title='Permanent Link: PHP: Parse Unparse String Array'>PHP: Parse Unparse String Array</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/go-back-link-in-javascript/' rel='bookmark' title='Permanent Link: Go back link in Javascript'>Go back link in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-print-array-and-object/' rel='bookmark' title='Permanent Link: jQuery: Print array and object'>jQuery: Print array and object</a></li>
<li><a href='http://blog.chapagain.com.np/displaying-date-and-time/' rel='bookmark' title='Permanent Link: Displaying date and time'>Displaying date and time</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I had to work on multi-dimensional array with javascript and php. I had a multi-dimensional array in php. I had to load it into javascript array and then populate the html selection list.</p>
<p>The challenge for me was to create multi-dimensional array in javascript and populate selection list with for loop in javascript.</p>
<p><span id="more-220"></span></p>
<p>Here is the full code containing php array, creating javascript array, using for loop in javascript to populate selection list in onclick event.</p>
<p>Given php array:-</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php
$items = array(
'subject'=&gt; array(
'easy' =&gt; array('music','history'),
'difficult' =&gt; array('maths','science')
),
'sports'=&gt;array(
'easy' =&gt; array('cricket'),
'difficult' =&gt; array('football','basketball')
)
);

$keyName = array();
?&gt;
</pre>
<p>Creating array in javascript with php array:-</p>
<pre class="brush: php; title: ; notranslate">

var itemData = new Array();
	&lt;?php
	foreach($items as $key=&gt;$value)
	{
		foreach($value as $k=&gt;$v)
		{
			$v = implode(&quot;,&quot;,$v);

			if(!in_array($key,$keyName))
			{
				?&gt;
				itemData['&lt;?php echo $key; ?&gt;'] = new Array();
				&lt;?php
			}
			?&gt;
				itemData['&lt;?php echo $key; ?&gt;']['&lt;?php echo $k; ?&gt;'] = new Array('&lt;?php echo str_replace(&quot;,&quot;,&quot;','&quot;,trim($v)); ?&gt;');
		&lt;?php
			$keyName[] = $key;
		}
	}
	?&gt;
</pre>
<p>Populating selection list with javascript for loop:-</p>
<pre class="brush: jscript; title: ; notranslate">
for (i=0; i&lt;itemData['subject']['easy'].length; i++)
{
	subjectEasy.options[subjectEasy.options.length]=new Option(itemData['subject']['easy'][i],itemData['subject']['easy'][i])
}
</pre>
<p><a href="http://chapagain.googlecode.com/files/multi_js.php" rel="nofollow" title="PHP Javascript Multi-dimensional array"  target="_blank">Download Full Source Code</a></p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=220&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/php-parse-unparse-string-array/' rel='bookmark' title='Permanent Link: PHP: Parse Unparse String Array'>PHP: Parse Unparse String Array</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/go-back-link-in-javascript/' rel='bookmark' title='Permanent Link: Go back link in Javascript'>Go back link in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/jquery-print-array-and-object/' rel='bookmark' title='Permanent Link: jQuery: Print array and object'>jQuery: Print array and object</a></li>
<li><a href='http://blog.chapagain.com.np/displaying-date-and-time/' rel='bookmark' title='Permanent Link: Displaying date and time'>Displaying date and time</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Website statistic (User Information) in Javascript</title>
		<link>http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/</link>
		<comments>http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 04:48:42 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[data mining]]></category>
		<category><![CDATA[javascirpt]]></category>
		<category><![CDATA[statistic]]></category>
		<category><![CDATA[user information]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/2008/03/31/website-statistic-user-information-in-javascript/</guid>
		<description><![CDATA[From the code below, you can get Resolution, Page title, Page url, Agent name, Browser name and Page Referrer. Copyright &#169; 2011 This feed is for personal, non-commercial use only. The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-php/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in PHP'>Website statistic (User Information) in PHP</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/magento-track-visitors-information/' rel='bookmark' title='Permanent Link: Magento: Track Visitor&#8217;s Information'>Magento: Track Visitor&#8217;s Information</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>From the code below, you can get Resolution, Page title, Page url, Agent name, Browser name and Page Referrer.</p>
<pre class="brush: jscript; title: ; notranslate">

&lt;span id=&quot;more-51&quot;&gt;&lt;/span&gt;

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Website Statistic&lt;/title&gt;

&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
// JavaScript for getting website statistic

// getting referrer
referer = &quot;&quot;+document.referrer;
var referer = referer.substring(0, 150);
var referer = escape(referer);

// getting page title
var title = &quot;&quot;+document.title;
var title = title.substring(0, 150);
var title = escape(title);

// getting url
var url = &quot;&quot;+document.location;
var url = url.substring(0, 150);
var url = escape(url);

// getting width and height of the page
// i.e. getting page resolution
var height = screen.height;
var width = screen.width;

// getting browser information
var agent = navigator.appName;
var agent_name = agent.substring(0,150);
var agent_name = escape(agent_name);

var version = navigator.appVersion;

var user = navigator.userAgent;
var user = user.substring(0,150);

&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;
document.write(&quot;Resolution: &quot;+width+&quot;x&quot;+height+&quot;&lt;br/&gt;&quot;);
document.write(&quot;Title: &quot;+title+&quot;&lt;br/&gt;&quot;);
document.write(&quot;Url: &quot;+url+&quot;&lt;br/&gt;&quot;);
document.write(&quot;Agent Name: &quot;+agent_name+&quot;&lt;br/&gt;&quot;);
document.write(&quot;User: &quot;+user+&quot;&lt;br/&gt;&quot;);
document.write(&quot;Referer: &quot;+referer+&quot;&lt;br/&gt;&quot;);
&lt;/script&gt;
&lt;br/&gt;
Note: Referer is only displayed when you come to this page from some other page.
&lt;/body&gt;
&lt;/html&gt;
</pre>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=51&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/website-statistic-user-information-in-php/' rel='bookmark' title='Permanent Link: Website statistic (User Information) in PHP'>Website statistic (User Information) in PHP</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/magento-track-visitors-information/' rel='bookmark' title='Permanent Link: Magento: Track Visitor&#8217;s Information'>Magento: Track Visitor&#8217;s Information</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/website-statistic-user-information-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Go back link in Javascript</title>
		<link>http://blog.chapagain.com.np/go-back-link-in-javascript/</link>
		<comments>http://blog.chapagain.com.np/go-back-link-in-javascript/#comments</comments>
		<pubDate>Wed, 19 Mar 2008 11:30:06 +0000</pubDate>
		<dc:creator>Mukesh</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[redirect]]></category>

		<guid isPermaLink="false">http://blog.chapagain.com.np/2008/03/19/go-back-link-in-javascript/</guid>
		<description><![CDATA[I had problem giving the back link and I found this solution: Go Back This helped me. Hope this will be useful to you as well. goback.html goback2.php Thank You. Copyright &#169; 2011 This feed is for personal, non-commercial use only. The use of this feed on other websites breaches copyright. If this content is [...]


<strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/' rel='bookmark' title='Permanent Link: PHP Javascript : Playing with multi-dimensional array'>PHP Javascript : Playing with multi-dimensional array</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/page-refresh-in-php/' rel='bookmark' title='Permanent Link: Page refresh in PHP'>Page refresh in PHP</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I had problem giving the back link and I found this solution:</p>
<p><a href='javascript:self.history.back();'>Go Back</a></p>
<p>This helped me. Hope this will be useful to you as well.</p>
<p><span id="more-47"></span></p>
<p>goback.html</p>
<pre class="brush: xml; title: ; notranslate">

&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Go Back Test&lt;/title&gt;
&lt;/head&gt;

&lt;body&gt;

Go Back to Previous link, Test Page
&lt;br/&gt;&lt;br/&gt;
Click the link below for the test:
&lt;br/&gt;&lt;br/&gt;

&lt;a href=&quot;goback2.php&quot;&gt;CLICK ME&lt;/a&gt;

&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>goback2.php</p>
<pre class="brush: php; title: ; notranslate">

&lt;?php

echo &quot;Thank You for visiting.&quot;;
echo &quot;&lt;br/&gt;&lt;br/&gt;&quot;;
echo &quot;Please click ANY of the given link to go back to the previous page: &quot;;

//go back to the previous page
echo &quot;&lt;a href='javascript:self.history.back();'&gt;Go Back&lt;/a&gt;  | &quot;;

//the above link can also be used in this way
echo &quot;&lt;a href='javascript:self.history.go(-1);'&gt;Go Back&lt;/a&gt;&quot;;

?&gt;
</pre>
<p>Thank You.</p>
<hr /><small>Copyright &copy; 2011<br /> This feed is for personal, non-commercial use only. <br /> The use of this feed on other websites breaches copyright. If this content is not in your news reader, it makes the page you are viewing an infringement of the copyright. (Digital Fingerprint:<br /> )</small><img src="http://blog.chapagain.com.np/?ak_action=api_record_view&id=47&type=feed" alt="" />

<p><strong>Related posts:</strong><ol><li><a href='http://blog.chapagain.com.np/javascript-showhide-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Show/Hide HTML elements'>Javascript: Show/Hide HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/php-javascript-playing-with-multi-dimensional-array/' rel='bookmark' title='Permanent Link: PHP Javascript : Playing with multi-dimensional array'>PHP Javascript : Playing with multi-dimensional array</a></li>
<li><a href='http://blog.chapagain.com.np/print_r-in-javascript/' rel='bookmark' title='Permanent Link: print_r in Javascript'>print_r in Javascript</a></li>
<li><a href='http://blog.chapagain.com.np/javascript-add-remove-html-elements/' rel='bookmark' title='Permanent Link: Javascript: Add Remove HTML elements'>Javascript: Add Remove HTML elements</a></li>
<li><a href='http://blog.chapagain.com.np/page-refresh-in-php/' rel='bookmark' title='Permanent Link: Page refresh in PHP'>Page refresh in PHP</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.chapagain.com.np/go-back-link-in-javascript/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
