String
sString=$.trim(sString); java string
"hello".charAt( 0 ) // "h"
"hello".toUpperCase() // "HELLO"
"Hello".toLowerCase() // "hello"
"hello".replace( /e|o/g, "x" ) // "hxllx"
"1,2,3".split( "," ) // [ "1", "2", "3" ]
var sMyString = "Tsinghua University"; document.write(sMyString.slice(1,3) + "<br>"); // si document.write(sMyString.substring(1,3) + "<br>"); // si document.write(sMyString.slice(4) + "<br>"); //
ghua University substr()document.write(sMyString + "<br>"); //Tsin
ghua University
left-right
http://stackoverflow.com/questions/3282047/jquery-animate-to-hide-and-show-elements-by-sliding-left-and-right
Event
$('a').css('cursor', 'pointer');
$('.filePrew').css('cursor', 'pointer');
$(function(){
$("div").addClass("myClass1").filter(function(index){
return index == 1 || $(this).attr("id") == "fourth";
}).addClass("myClass2");
});
Object
addclass
$(function(){
$("ul li ul li:has(a)").addClass("myClass");
});
$(function(){
$("table.datalist tr:nth-child(odd)").addClass("altrow");
});
$(function(){
$("li:nth-child(2)").addClass("myClass");
});
$(function(){
$("p:lt(2)").addClass("myClass");
});
animate
$('#search').animate({ width: '0px' }, 1000, function() {$(this).hide();});
append
$("a[target]").append("(Opens in New Window)");
var i = $("div").size()+1;
$(document.body).append($("<div>"+i+"</div>"));
$("span").html(i);
change
$('.filePrew').change(function(){
$('.browseText').val($(this).val());
});
css
$("#nav ul").css("display","none");
$(""#nav li").hover(function(){
$(this).find('ul:first').css({visibliity:"visible",display:"none"}).show(400);
}, function(){$(this).find('ul:first').css(:visiblity:"hidden"});
});
$("#body").css({border: "1 px solid green",height:"40px"})
<img border="0" style="float:right;" src="images/help-icon.png" width="30" ;
height="<%=HelpIconHeight%>" value=100 onclick="
if (contentWidth==''){
$('#content_inner').css({width:'80%'});contentWidth='80'}
else
{$('#content_inner').css({width: ''});contentWidth=''}
">
insertAfter
$(function(){
var oNewP = $("<p>addMore</p>"); oNewP.insertAfter("#myTarget");
});
html
<p id="myTarget">Orignal</p>
result :
Orignal
addMore
ready
$(document).ready(function(){mainmenu()});
val
$('.filePrew').change(function(){
$('.browseText').val($(this).val());
});
沒有留言:
張貼留言