query string split from url in javascript


function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split(“&”);
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
}
alert( getQueryVariable("val") );
//www.test.com/dsd?val=sdf%20sdf

Detect operating system user side in javascript


// This script sets OSName variable as follows:
// “Windows” for all versions of Windows
// “MacOS” for all versions of Macintosh OS
// “Linux” for all versions of Linux
// “UNIX” for all other UNIX flavors
// “Unknown OS” indicates failure to detect the OS

var OSName=”Unknown OS”;
if (navigator.appVersion.indexOf(“Win”)!=-1){
OSName=”win_styles”;
document.write(”);
}
if (navigator.appVersion.indexOf(“Mac”)!=-1){
OSName=”mac_styles”;
document.write(”);
}
/*if (navigator.appVersion.indexOf(“X11″)!=-1){
OSName=”UNIX”;
}
if (navigator.appVersion.indexOf(“Linux”)!=-1){
OSName=”Linux”;
}*/

Screen width & Detect Safari browser in Javascript


////// get screen width ////////
var scr = screen.width;
if(scr>1024){
//test
}

////// detect user safari browser ////////
var browser = navigator.userAgent;
if (browser.toLowerCase().indexOf(‘safari’) > 0){
//detect browser
}

Latest News module for the opencart


Click to download the Latest News Module of opencart
Unzip the files andCopy and paste the files in their respective folders.
====================================================
FOR BACK END
====================================================
Paste the following

in the admin\view\template\common\header.tpl

======================================================

For more info : http://nepalrupak.blogspot.com/p/opencart.html

The Beauty of jQuery


I’ll admit, I resisted the use of frameworks. I believe in understanding the core structure and building from it. But after 2 years of working with heavy Javascript, I decided it was time to test out some frameworks to speed up my work.
There’s about 100+ Javascript frameworks out there. Picking one was no easy task. I took about 2 weeks to test out a handful of frameworks and ended up choosing jquery.

It’s tiny. no overhead. It also has a well supported community. Which means plugins galore. And it based off of CSS syntax. So there’s very little learning curve.

And the best feature of all… it’s cross browser compliant!!

No more MSIE hacks or special code for Opera. Your complex Javascript will work on all browsers. That’s a saving of 2 weeks worth of programming already!

With MooTools and Prototype, you have to be careful not to use the same variable name as their API. But not with jQuery. It is completely isolated in it’s scope and won’t affect any global namespace.

Yahoo UI and Dojo, well those are big boys. And i mean HUGE files. I prefer small footprint over bulky features. In fact, I’ll stab my eye out before I use Dojo… but I’ll digress.

For more info : http://htmltree.com/the-beauty-of-jquery/

Firefox Only Print One Page Bug


As a web developer, you will come across various problems related to your web site. A few weeks ago, I was told that my web page only printed one page. Strange, the screen displays a large table set that expands ~4 pages.

And the kicker, it does this on Firefox. Wow. After a few minutes of googling, I have discovered the culprit to be within CSS. Here was my simple solution.

Print.css

Create a new style sheet made for print. It’s best to include this right below all your other style sheets, so it can overwrite any elements right before the user prints.

1.<link rel="stylesheet" type="text/css" media="all" href="style.css" />
2.<link rel="stylesheet" type="text/css" media="print" href="print.css" />

Ok Batman, let’s override some code.

for more information click here : http://htmltree.com/firefox-only-print-one-page-bug/#more-6

The Internet Explorer 6 Countdown


IE610 years ago a browser was born.
Its name was Internet Explorer 6. Now that we’re in 2011, in an era of modern web standards, it’s time to say goodbye.

This website is dedicated to watching Internet Explorer 6 usage drop to less than 1% worldwide, so more websites can choose to drop support for Internet Explorer 6, saving hours of work for web developers.

 Check the Internet Explorer 6 usage around the world