用javascript实现分割提取页面所需内容_Javascript教程-查字典教程网
用javascript实现分割提取页面所需内容
用javascript实现分割提取页面所需内容
发布时间:2016-12-30 来源:查字典编辑
摘要:文档textarea{width:100%;height:200px;}正文正文标签正文正文正文正文正文正文。functiongetcont...

<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<htmlxmlns="http://www.w3.org/1999/xhtml">

<head>

<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>

<title>文档</title>

<style>

textarea{

width:100%;

height:200px;

}

</style>

</head>

<body>

<textareaid="xxx">

<P><KBDclass=showflashtitle=http://localhost/elearning/storeagemultimirror/multiMirror.swf>正文正文<ahref="javascript:;"onClick="javascript:tagshow(event,'%D0%E9%C4%E2%BB%AF');"target="_self"><u><strong>标签</strong></u></a>正文正文正文正文正文正文。</KBD><BR></P>

</textarea>

<inputtype="button"value="获取内容"onclick="getcontent();"/>

<textareaid="aaa"></textarea>

<textareaid="bbb"></textarea>

<script>

functiongetcontent(){

varstr=document.getElementById("xxx").value;

document.getElementById("aaa").value=str.match(/<KBD.+?title=["']?(.+?)['">]/i)[1];

document.getElementById("bbb").value=str.match(/<KBD.+?>((?:.|n)+?)</KBD>/i)[1];

}

</script>

</body>

</html>

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新Javascript教程学习
    热门Javascript教程学习
    编程开发子分类