在td单元格中,有一个过长的title属性,在有的电脑上将鼠标放至td上,显示的是非常宽的一个title,但在其它电脑上执行的则是一个大小适合的title显示界面,请问这可能是什么原因造成的,是IE的版本,操作系统的原因还是IE的设置问题
回复讨论(解决方案)
可能和浏览器有关。
可以加上换行符来分行显示
恩,关于这一块查不到资料,由于公司的操作系统和浏览器是配套的,因此无法断定到底是操作系统的原因还是浏览器的原因
恩,关于这一块查不到资料,由于公司的操作系统和浏览器是配套的,因此无法断定到底是操作系统的原因还是浏览器的原因
放在别的机子上面测试一下。。。
现在求教解决办法,最好能同时兼容两种显示方法,我发现不好处理,因为每个字符的宽度不一样,而会自动换行的IE会有一个固定的宽度而不是长度,怎么样才使过长title显示时自动换行,并且兼容上述的两种显示情况
可能和浏览器的版本有关,但是一般的浏览器是不会在词内换行的,比如title="aaaa....verylong.....aaa" 这种是不会自动换行的,显示不完的就被截断了。所以在可能会换行的地方适当加一些空格可以避免这一问题。如果强制换行也可用转义符\n
显示器分辨率的问题,这个你用firebug在不同分辨率上调试一下就可以了
如果title的内容过多的话并且客户需要显示的话,建议给个小弹窗来显示内容,我也遇到过这个问题 原先比较懒就放在title中结果最后客户还是非要弹窗来显示!
应该是IE的版本问题,和操作系统关系不大
加个换行就应该可以解决你的问题了 换行:
title='1111111111111111111111111111111111111111
2222222222222222222222222222222222222222'
现在求教解决办法,最好能同时兼容两种显示方法,我发现不好处理,因为每个字符的宽度不一样,而会自动换行的IE会有一个固定的宽度而不是长度,怎么样才使过长title显示时自动换行,并且兼容上述的两种显示情况
<script> function fun(){ var arrAll=document.all; for (i=0;i <arrAll.length;i++){ if(arrAll[i].title.length > 80){ // 处理所有title长度超过80的提示 // alert(arrAll[i].title); } } } </script> <body onload='fun()'> <input type='button' value='测试按钮' id='bn' title='1111111111111111111111111111111111111111 2222222222222222222222222222222222222222'/> </body>
至于怎么处理还没想好,下班了,明天再想,做个标签
<script> function fun(){ var arrAll=document.all; for (i=0;i <arrAll.length;i++){ var size = 0; if(arrAll[i].title.length > 50){ var size = arrAll[i].title.length/2; while(size>30){ size=size/2; } } if(arrAll[i].title.length > 50){ var reg=new RegExp('.{'+size+'}','g'); var titleText = arrAll[i].title.replace(reg,repText); arrAll[i].title = titleText; } } } function repText($1){ return $1+"\n"; } </script> <body onload='fun()'> <input type='button' value='测试按钮' id='bn' title='五笔打字员五笔打字员五木木sssdfsdfsdfsd笔打字员五笔打字员五笔打字员五笔打字员五笔打字员五笔打字员五笔打字员五笔打字员五笔打字员五笔打字员五笔打sdfsdf字员五笔打字员五笔sdfsdfs打字员五笔打字员五笔打字员五sdfsdfsdfsdfsdf笔打字员五笔打字员五笔打字员五笔打字员'/> </body>
// 写的不好,待高人指正。
支持楼上
现在没环境可试了,先结了

HTMLtagsdefinethestructureofawebpage,whileattributesaddfunctionalityanddetails.1)Tagslike,,andoutlinethecontent'splacement.2)Attributessuchassrc,class,andstyleenhancetagsbyspecifyingimagesources,styling,andmore,improvingfunctionalityandappearance.

The future of HTML will develop in a more semantic, functional and modular direction. 1) Semanticization will make the tag describe the content more clearly, improving SEO and barrier-free access. 2) Functionalization will introduce new elements and attributes to meet user needs. 3) Modularity will support component development and improve code reusability.

HTMLattributesarecrucialinwebdevelopmentforcontrollingbehavior,appearance,andfunctionality.Theyenhanceinteractivity,accessibility,andSEO.Forexample,thesrcattributeintagsimpactsSEO,whileonclickintagsaddsinteractivity.Touseattributeseffectively:1)Usese

The alt attribute is an important part of the tag in HTML and is used to provide alternative text for images. 1. When the image cannot be loaded, the text in the alt attribute will be displayed to improve the user experience. 2. Screen readers use the alt attribute to help visually impaired users understand the content of the picture. 3. Search engines index text in the alt attribute to improve the SEO ranking of web pages.

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Safe Exam Browser
Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Chinese version
Chinese version, very easy to use

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
