css 怎么调input text 属性的长度?

html-css037

css 怎么调input text 属性的长度?,第1张

<!DOCTYPE HTML>                                                                 

<html>                                                                          

<meta charset="UTF-8" />                                                

<head>                                                                  

<title></title>                                 

</head>                                                                 

        <script src="

        <style type="text/css">                                                 

</style>                                                                

<body>                                                                  

<input type="text" name="" id="mytext" value="" placeholder="宽度为150px" style="width: 150px"/>   

                <button id="confirm">点击改变宽度为300px</button>               

</body>                                                                 

<script type="text/javascript">                                         

$(function(){                                                   

$('#confirm').click(function(){                         

$('#mytext').css('width','300px')              

})                                                     

})                                                              

</script>                                                               

</html>

<html>

<head>

<style>

#tb1 td{white-space:nowraptext-overflow:ellipsisoverflow:hiddenwidth:50px}//在这里调节width的值就可以了

</style>

</head>

<body>

<table id="tb1" border=1px style="table-layout:fixed">

<tr>

<td>AAAAAAAAAAAAAAAAAA</td>

</tr>

<tr>

<td>1111111111111111111111111111111</td>

</tr>

</table>

</body>

</html>

////////不知道怎么回事,在table里面的中文就不行,其他元素里面都没问题的,你要的效果用javascript也可以实现的,我写个程序给你

/////////////////////////////////////////////////////////////

<html>

<head>

<script>

function cc()

{

var a=document.getElementById("tb1").rows.length//获取表格的行数

for(var zz=0zz<azz++)

{

var b=document.getElementById("tb1").rows[zz].cells[0].innerText

if(b.length>10) //如果字符长度大雨10位

{

document.getElementById("tb1").rows[zz].cells[0].innerText=b.substring(0,10)+"..."//截取第1到10位 ,并加省略号

}

}

}

</script>

</head>

<body onload=cc()>

<table id="tb1" border=1px style="table-layout:fixedwidth:auto" >

<tr>

<td>AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA</td>

</tr>

<tr>

<td>1111111111111111111111111111111AAA</td>

</tr>

</table>

</body>

</html>