<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>catalog</title><style type="text/css"> li{list-style:none;}a{color:black;text-decoration:none;}#catalog{ background-color:red; padding-right:25px; margin-right:20px; float:left;}</style><script type="text/javascript"> var myBoolean = new Boolean(true); function showTree(){ var tree = document.getElementById("tree"); var list = document.getElementById("list"); if(myBoolean == true) { tree.value="-"; list.style="display:block;"; myBoolean=false; } else { tree.value="+"; list.style="display:none;"; myBoolean=true; } }</script></head><body><div id="catalog"><ul> <li><input type="button" value="+" id="tree" onclick="showTree()" />帮助文档:</li> <ul id="list" style="display:none;" > <li><a href="http://www.baidu.com" target="content">办公室</a></li> <li>绘图室</li> </ul></ul></div><div id="content"><iframe name="content" width="1024" height="768" frameborder="0" ></iframe></div></body></html>
求高手看看,是不是兼容性问题,是的话如何修改下代码?跪谢。
回复讨论(解决方案)
if(myBoolean == true)
{
tree.value="-";
list.style.display="block";
myBoolean=false;
}
else
{
tree.value="+";
list.style.display="none";
myBoolean=true;
}
改成下面的就好了
IE8 IE 9 FF 都可以
写那么多,只要一句就可以实现了。。
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>catalog</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script><style type="text/css"> li{list-style:none;}a{color:black;text-decoration:none;} #catalog{ background-color:red; padding-right:25px; margin-right:20px; float:left;} </style> <script type="text/javascript"> $(function () { $('#tree').bind('click', function () { $('#list').toggle(); }) })</script></head><body><div id="catalog"><ul> <li><input type="button" value="+" id="tree"/>帮助文档:</li> <ul id="list" style="display:none;" > <li><a href="http://www.baidu.com" target="content">办公室</a></li> <li>绘图室</li> </ul></ul></div><div id="content"><iframe name="content" width="1024" height="768" frameborder="0" ></iframe></div> </body></html>
另外,你的结构是有问题的。ul 里面写ul,那么第二个ul应该在li里面
你的不符合标准。
-
- ....
下面改装:
<script type="text/javascript"> $(function () { var ss = $('#catalog').find('li').not($('#catalog').find('li').eq(0)); ss.hide(); var x = 0; $('#tree').click(function () { if(x == 0) { ss.show(); $('#tree').val('-'); x = 1; } else { ss.hide(); $('#tree').val('+'); x = 0; } }) })</script></head><body><div id="catalog"><ul> <li><input type="button" value="+" id="tree"/>帮助文档:</li> <li><a href="http://www.baidu.com" target="content">办公室</a></li> <li>绘图室</li></ul></div>
另外,你的结构是有问题的。ul 里面写ul,那么第二个ul应该在li里面
你的不符合标准。
-
- ....
下面改装:
<script type="text/javascript"> $(function () { var ss = $('#catalog').find('li').not($('#catalog').find('li').eq(0)); ss.hide(); var x = 0; $('#tree').click(function () { if(x == 0) { ss.show(); $('#tree').val('-'); x = 1; } else { ss.hide(); $('#tree').val('+'); x = 0; } }) })</script></head><body><div id="catalog"><ul> <li><input type="button" value="+" id="tree"/>帮助文档:</li> <li><a href="http://www.baidu.com" target="content">办公室</a></li> <li>绘图室</li></ul></div>
多谢提醒,我会修正这个结构问题。

htmlattributesarecrucialinwebdevelopment forcontrollingBehavior,外观和功能

alt属性是HTML中标签的重要部分,用于提供图片的替代文本。1.当图片无法加载时,alt属性中的文本会显示,提升用户体验。2.屏幕阅读器使用alt属性帮助视障用户理解图片内容。3.搜索引擎索引alt属性中的文本,提高网页的SEO排名。

HTML、CSS和JavaScript在网页开发中的作用分别是:1.HTML用于构建网页结构;2.CSS用于美化网页外观;3.JavaScript用于实现动态交互。通过标签、样式和脚本,这三者共同构筑了现代网页的核心功能。

设置标签的lang属性是优化网页可访问性和SEO的关键步骤。1)在标签中设置lang属性,如。2)在多语言内容中,为不同语言部分设置lang属性,如。3)使用符合ISO639-1标准的语言代码,如"en"、"fr"、"zh"等。正确设置lang属性可以提高网页的可访问性和搜索引擎排名。

htmlattributeseresene forenhancingwebelements'functionalityandAppearance.TheyAdDinformationTodeFineBehavior,外观和互动,使网站互动,响应式,visalalyAppealing.AttributesLikutesLikeSlikEslikesrc,href,href,href,类,类型,类型,和dissabledtransfransformformformformformformformformformformformformformformforment

toCreateAlistinHtml,useforforunordedlistsandfororderedlists:1)forunorderedlists,wrapitemsinanduseforeachItem,RenderingeringAsabulleTedList.2)fororderedlists,useandfornumberedlists,useandfornumberedlists,casundfornumberedlists,customeizableWithTheTtheTthetTheTeTeptTributeFordTributeForderForderForderFerentNumberingSnumberingStyls。

HTML用于构建结构清晰的网站。1)使用标签如、、定义网站结构。2)示例展示了博客和电商网站的结构。3)避免常见错误如标签嵌套不正确。4)优化性能通过减少HTTP请求和使用语义化标签。

toinsertanimageIntoanhtmlpage,usethetagwithsrcandaltattributes.1)usealttextforAcccessibilityandseo.2)instementRcsetForresponSiveImages.3)applylazyloadingWithLoadingWithLoading =“ lazy” tooptimizeperformance.4)tooptimizeperformance.4)


热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

Atom编辑器mac版下载
最流行的的开源编辑器

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

Dreamweaver CS6
视觉化网页开发工具

EditPlus 中文破解版
体积小,语法高亮,不支持代码提示功能

DVWA
Damn Vulnerable Web App (DVWA) 是一个PHP/MySQL的Web应用程序,非常容易受到攻击。它的主要目标是成为安全专业人员在合法环境中测试自己的技能和工具的辅助工具,帮助Web开发人员更好地理解保护Web应用程序的过程,并帮助教师/学生在课堂环境中教授/学习Web应用程序安全。DVWA的目标是通过简单直接的界面练习一些最常见的Web漏洞,难度各不相同。请注意,该软件中