_________________________________________________________________________________
Parsing url in jquery or javascript to extract parameter from url in html file
If you are using a html file and you have to receive some parameters from url , then
below is the method you are looking for.
Only this you have to do ... is to call getUrlVars with field name to extract as done in this statement :
var first_name = getUrlVars()["first_name"];
Methods to add css to html page :
We can add css to a page using 3 methods :
a) External css
b) Internal css
c) Inline css
External css : In this we make an css file and then call that file in our page using link .
Internal css : In this we write our css in head of the the html page using style tag.
Inline css : In this we add style to the element .
The best method of adding css is external and the most powerful is inline because override previous css included.
Use of RedirectMatch 301 directive in htaccess.
To redirect more than a single page using htaccess, you can use the "RedirectMatch 301" directive, which allows you to specify directory matching patterns using regular expressions.
Here 301 redirect is a permanent redirect method which passes between 90-99% of ranking power to the new redirected page and (?i) signifies case insensitivity .
Point to remember:
1. (?i) starts case-insensitive mode
(?-i) turns off case-insensitive mode
2. /directory/cart This is the directory which i am redirecting . When this directory structure will occur in url , page will be redirected to stated page.
3. http://localhost/directory2? This is my new address where i want page to be redirected.
Jquery not loading properly on clicking links in mobile site.
Today while working on a mobile site , i went through a strange problem. Everything works well on site when i refresh page but when i click on links then my jquery and css are not loading properly. Resulting in improper design. After searching about the problem i came to know that on mobile jquery loads only on first page on all other pages its use preloaded js and css.
More you can read at :
http://demos.jquerymobile.com/1.2.1/docs/pages/page-scripting.html
Now to solve this problem . I added
rel='external' to every link . Now whenever i click on link my jquery and css are loading properly.
Get value of select box in Javascript/Jquery
This is my select box. And i want to get its value in javascript/jquery .
<select name="qt" class="qt" id='qt'>
<option value='0'> </option>
<option value='Newspaper'>Newspaper</option>
<option value='Facebook Ad'>Facebook Ad</option>
<option value='Google Search'>Google Search</option>
<option value='Other Internet Site'>Other Internet Site</option>
<option value='Test Prep Center'>Test Prep Center</option>
</select>
To get its value i will use two lines.
var s = document.getElementById('qt'); /**qt is the id of select box**/
var selectval = s.options[s.selectedIndex].value;