jQueryTutorial

Childnodes get the list of children var numkids

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: examples/domtest.html 14 Example 4: $.change() and $.html(); JavaScript w/ jQuery $(function() { $("#sel").change(function() { var selector = "#" + $("#sel").val(); $(selector).html($("input[name='t']").val()); }); }); http://www-scf.usc.edu/~csci571/Special/jquery_examples/ex4b.html Copyright Ellis Horowitz 2013 15 Example 5: document.getElementById().style.let JavaScript and HTML w/o jQuery <FORM> <INPUT ID="counter1" STYLE="position:relative; left:0px" TYPE="button" VALUE="Move Button right once" onclick="document.getElementById('counter1').style.left = '500px';"> </FORM> <br><br><br><br><br><br><br><br><br> <FORM> <INPUT ID="counter2" STYLE="position:relative; top:0px" TYPE="button" VALUE="Move Button down Once" onclick="document.getElementById('counter2').style.top = '15px';"> </FORM> http://www-scf.usc.edu/~csci571/Special/domexamples/ex4.html Copyright Ellis Horowitz 2013 16 Example 5: $.css(); JavaScript and HTML w/ jQuery <FORM> <INPUT ID="counter1" STYLE="position:relative; left:0px" TYPE="button" VALUE="Move Button right once" onclick="$('#counter1').css('left', '500px');"> </FORM> <br><br><br><br><br><br><br><br><br> <FORM> <INPUT ID="counter2" STYLE="position:relative; top:0px" TYPE="button" VALUE="Move Button down Once" onclick="$('#counter2').css('top', '15px');"> </FORM> http://www-scf.usc.edu/~csci571/Special/jquery_examples/ex4.html Copyright Ellis Horowitz 2013 17 Example 6: document.getElementById(), parseint() JavaScript w/o jQuery var obj = document.getElementById(‘counter1’); var xlocation = parseInt(obj.style.left); function handleClick( ) { xlocation += 50; document.getElementById(‘counter1’).style.left = xlocation + “px”;} JavaScript w/ jQuery $(function() { $(“#counter1”).css(“left”,(parseInt($(“#counter1”).css(“left”))+50)+”px”); }); }); http://www-scf.usc.edu/~csci571/Special/domexamples/ex5.html Copyright Ellis Horowitz 2013 18 Example 7: Uses childnNodes, removechild, appendChild JavaScript w/o jQuery function reverse(n) { // Reverse the...
View Full Document

This note was uploaded on 01/29/2014 for the course CSCI 571 taught by Professor Papa during the Spring '07 term at USC.

Ask a homework question - tutors are online