发布于 2017-01-07 23:58:37 | 113 次阅读 | 评论: 0 | 来源: 网友投递
这里有新鲜出炉的Javascript教程,程序狗速度看过来!
JavaScript客户端脚本语言
Javascript 是一种由Netscape的LiveScript发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如Perl,遗留的速度问题,为客户提供更流畅的浏览效果。
.subLongText{
width:150px;
height:24px;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
text-overflow: ellipsis;/* IE/Safari */
-ms-text-overflow: ellipsis;
-o-text-overflow: ellipsis;/* Opera */
-moz-binding: url("ellipsis.xml#ellipsis");/*FireFox*/
}
<span class="subLongText">任意长度文本</span>
<HTML>
<HEAD>
<TITLE>JQUERY 文本截取方法</TITLE>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="jquery-1.3.2.js"></script>
<script type="text/javascript">
$.fn.substr = function(length,content){
$(this).each(function(i,item){
var val=$(item).html();
if(!val) return;
if(val.length>length) {
val = val.substring(0,length);
val += content || "..."
$(item).html(val);
}
});
}
function subTdContent(){
$('td').substr(20);
}
</script>
</HEAD>
<BODY onload="javascript:subTdContent();">
<table style="border:1px solid #b3c0f5;" border="1">
<tr>
<td>我是代码:$.fn.substr = function(l,c){ $(this).each(function(i,item)</td>
<td>以下两种方式都可以解决textarea行高自动适应类容的高度</td>
<td>以下两种方式都可以解决textarea行</td>
</tr>
</table>
</BODY> </HTML>