项目中的小问题

 var img  = $("#preview").attr("src");
 if(img.indexOf('img_03.png') != -1){
    alert('图片不能为空');
    return false;
}
js截取文字  后面省略
 $(".p2").each(function(){
			var str=$(this).text();
			if(str.length>100){
				var s=str.substring(0,48)+"...";
				$(this).text(s);
			}
		})

  

<select name=sel onchange="bao(this.options[this.options.selectedIndex].value)"> 
<option value="">请选择 
<option value="1">Item 1 
<option value="2">Item 2 
<option value="3">Item 3 
</select> 
<script> 
function bao(s) 
{ 
    txt.value+=s; 
    //选择后,让第一项被选中,这样,就有Change啦. 
    document.all.sel.options[0].selected=true; 
} 
</script> 

 

posted @ 2016-06-02 09:17  飞翔的小鸟11  阅读(107)  评论(0编辑  收藏  举报