用javascript实现分割提取页面所需内容

2016-02-19 09:34 3 1 收藏

get新技能是需要付出行动的,即使看得再多也还是要动手试一试。今天图老师小编跟大家分享的是用javascript实现分割提取页面所需内容,一起来学习了解下吧!

【 tulaoshi.com - Web开发 】

!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
meta http-equiv="Content-Type" content="text/html; charset=gb2312" /
title文档/title
style
textarea {
    width:100%;
    height:200px;
}
/style
/head

body
textarea id="xxx"
PKBD class=showflash title=http://localhost/elearning/storeagemultimirror/multiMirror.swf 正文正文a href="javascript:;" onClick="javascript:tagshow(event, '%D0%E9%C4%E2%BB%AF');" target="_self"ustrong标签/strong/u /a正文正文正文正文正文正文。/KBDBR/P
/textarea

input type="button" value="获取内容" onclick="getcontent();" /
textarea id="aaa"/textarea
textarea id="bbb"/textarea
script
function getcontent(){
    var str=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

来源:https://www.tulaoshi.com/n/20160219/1591319.html

延伸阅读
标签: Web开发
HTML   HEAD     titleWEB页面导出为EXCEL文档的方法     /title   /HEAD body BR table id = "PrintA" width="100%" border="1" cellspacing="0" cellpadding="0" bgcolor = "#61FF13" TR style="text-align : center;"  TD单元格A/TD  TD单元格A/TD  TD单元格A/TD  TD单元格A/T...
标签: Web开发
div    label for="email"Email/label    input name="email" type="text" id="email" style="width:134px;" onfocus="if(this.value==’Input your email’)this.value=’’;"onblur=&qu...
标签: Web开发
不太像,而且比较耗资原,不知道有没有更好的办法=.= 火焰 [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行]
标签: Web开发
function getparastr(strname)   {    var hrefstr,pos,parastr,para,tempstr;    hrefstr = window.location.href;    pos = hrefstr.indexOf("?")    parastr = hrefstr.substring(pos+1);    para = parastr.split("&");    tempstr="";    for(i=0;ipara....
标签: Web开发
在项目,要实现把页面中的一个Table保存到Excel中,代码如下: Html代码 html    head       title保存HTML中的Table到Excel中/title    /head    body       h1保存内容到Excel中/h1       table id='content'&nb...

经验教程

557

收藏

23
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部