Showing posts with label jQuery. Show all posts
Showing posts with label jQuery. Show all posts

Sunday, April 15, 2012

How jQuery works with your Web page

jQuery gives Web developers Because jQuery is so easy to implement.Facebook and Twitter, for example.An easy way to create sophisticated
effects with almost no coding.jQuery lets you easily change the appearance, location, or behavior of an
element on a Web page.

1.<!doctype...>: This long element tellsthe Web browser which version of HTML isused in the code that follows. You shouldalways include it at the beginning of any

HTML pages you create.

2.<html>: This element begins the HTMLpage.

3.<head>: This element designates thebeginning of the head section. This sectionusually contains the title and any script element.

4.<title>My Test Page</title>:This line displays the title of the page.

5.<script src=”js/jquery-1.4.

min.js”></script>:
This line provides the location of the jQuery library.
6.<script type=”text/java

script”>
: This script tag tells the browser that everything inside is JavaScript code.
7.$(document).ready(function(){:The dollar sign is an alias for the jQuery function. The ready function waits for the Web page to load, and then the code contained inside it is executed.
8.a l e r t ( j Q u e r y ( ‘ i m g ’ ) .attr(‘height’));: The alert function opens a pop-up alert box. The dollar sign that follows is calling the jQuery attr function. This function returns the value of whatever attribute is in quotes, in this case, the height. Notice that img precedes the attr function. In short, this function means, “look for all img elements you find in the HTML code, and return the value of the height attribute of the first one.”
9.});: This punctuation is closing the braceand parenthesis started in the $(document).ready(function(){ line
10.</script>: This tag closes the <script> tag and ends the JavaScript code block
11.</head>: This tag closes the head section of the HTML.
12.<body>: This tag begins the body section, where the main content consisting of HTML code, text, and images is written.
13.<p>This is my test page.<p>: This line is a line of text that appears in the page.
14.<img src= “images/home. gif” height=”28” width=”28” alt=”This is a test image.”>:This img element displays on the Web page an image with several attributes.
15.</body>: This tag ends the content section of the page.
16.</html>: This tag ends the HTML page.



Sunday, December 11, 2011

Web page with {strong} elements with jQuery


selector with the jQuery html() and text() functions to
change the HTML code or text in all matching elements on a page. follow these steps to change the text in all the <strong> elements on a page:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”

“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<html>

<head>

<title>My Test Page</title>

<script type=”text/javascript” src=”js/jquery-1.4.min.js”></script>

<script type=”text/javascript”>

$(document).ready(function(){

var strongContent = ‘jQuery for Dummies’;

});

</script>

</head>

<body>

<strong>some name</strong><p>Some text<p>

<strong>another name</strong>

<p>More text<p>

<strong>another name</strong>

<p>Even more text<p>

<strong>your name</strong>

<p>Last bit of text<p>

</body>

</html>

Meta tag generator 4 seo
If else statement
Increase traffic your blogs
Popularity by massage
 Important of keywords
Boost your ranking with seo

Friday, December 9, 2011

Parents and Children Selectorswith jQuery


The following code shows two <div> elements, each with the same content inside:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"><html>

<head>

<title>My Test Page</title>

<script type=”text/javascript” src=”scripts/jquery-1.6.4.min.js”></script>

<script type=”text/javascript”>$(document).ready(function(){

// code
$(‘div:first-child’).text(‘Change me.’);
//code

});

</script>

</head>

<body>

<div id=”myfirstdiv”>

<strong class=”changemytext”>your name goes here</strong>

<p class=”changemytext”>text here<p>

<strong>another name goes here</strong>

<p>More text here<p>

</div>

<div id=”myseconddiv”>

<strong class=”changemytext”>more name</strong>

<p class=”changemytext”>more text<p>

<strong>another name</strong>

<p>More text<p>

</div>

</body>

</html>




select elements based on their parents or children, try these selectors:



first-child: Selects the first child element. The following code selects the first child of the first <div> and changes the text of the selected element:

$(‘div:first-child’).text(‘Change me.’);


last-child: Selects the last child element. The following code selects the last child of the second <div> and changes the text of the selected element:

$(‘div:last-child’).text(‘Change me.’);


child: Selects the child element of the parent element. This code changes the text of every <strong> element that is a child of a <div> element


$(‘div > strong’).text(‘Change me.’);


You can find the complete list of selectors at http://api.jquery.com/category/selectors/.


Meta tag generator 4 seo
If else statement
Increase traffic your blogs
Popularity by massage
Tips 4 blog posting



Thursday, December 8, 2011

Changing Text Content with jQuery

Two elements with their HTML code swapped.Sometimes you don’t want the actual HTML code in an element; you want
only the text. To do so, replace the html() function with the text() function.
In the preceding example, you swapped the HTML code. If you want to
swap only the text and not the HTML code, use this code:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”

“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

<html>

<head>

<title>My Test Page</title>

<script type=”text/javascript” src=”jquery-1.6.4.min.js”></script><script type=”text/javascript”>

$(document).ready(function(){

var strongContent = $(‘strong’).text();

var pContent = $(‘p’).text();

$(‘strong’).text(pContent);

$(‘p’).text(strongContent);

});

</script>

</head>

<body>

<strong>This is the text in the <em>STRONG</em> element.</strong>

<p>This is the text in the <em>P</em> element.</p>

</body>

</html>

Free create back link
Meta tag generator 4 seo
If else statement
Increase traffic your blogs
Free Web Promotion



Tuesday, December 6, 2011

HTML Elements, Attributes, and Positions on jQuery

HTML Elements, Attributes, and Positions:
Following are some order selectors and examples of their use with elements

in the preceding code:


radio: Selects all elements with the type attribute set to radio. The
following code returns the value 1 in an alert box:
alert( $(‘:radio’).length);


checkbox: Selects all elements with type attribute set to radio. The following code sets the checked attribute to true for all check boxes:

$(‘:checkbox’).attr({checked:’true’});



[attribute]: Selects all elements with a specific attribute. The following

code displays the number of <img> elements with a height attribute:

alert( $(‘img[height]’).length);


[attribute=value]: Selects all elements with a particular attribute set to a specific value. The following code displays the number of elements with a class attribute set to myclass:

alert( $(‘[class=myclass]’).length);



[attribute!=value]: Selects all elements with a particular attribute not set to a specific value. The following code displays the number of
elements with a class attribute that isn’t myclass. Elements with no class attribute are ignored:

alert( $(‘[class!=myclass]’).length);    

Free create back link
Meta tag generator 4 seo
Meta description taG
Free link for PR3
Website optimization technique


Blogs 4 seo/blogspot seo|blogs best 300x250 banners Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger

Web Statistics