问题描述
- jsp页面如何获得上传的html文件里<span>标签的内容,这些标签不带ID和NAME。
-
上传的HTML文件内容如下:<!DOCTYPE html><!--[if IE]> <html class="ie"> <![endif]--> <html> <head> <meta charset="utf-8" /> <title> </title> <link rel="stylesheet" type="text/css" href="病案首页模板_files/style.css" /> </head> <body> <div class="stl_01"> <div class="stl_02"> <object data="病案首页模板_files/img_01.svg" type="image/svg+xml" class="stl_03" style="position:absolute; width:43.4167em; height:61.4167em;"> <embed src="病案首页模板_files/img_01.svg" type="image/svg+xml" class="stl_03" /> </object> </div> <div class="layer"> <div class="stl_04 stl_05"> <div style="position:absolute; top:4.6476em; left:3.752em;"><span class="stl_06 stl_07 stl_08">医疗机构:重庆市南川区三泉镇卫生院(组织机构代码: </span></div> <div style="position:absolute; top:4.7765em; left:31.8817em;"><span class="stl_09 stl_07 stl_10">450448232 </span></div> <div style="position:absolute; top:4.6476em; left:39.3558em;"><span class="stl_06 stl_07 stl_11">)</span></div> <div style="position:absolute; top:6.2232em; left:3.482em;"><span class="stl_12 stl_07 stl_13">医疗付费方式:</span><span class="stl_14 stl_07 stl_13">9 </span></div> <div style="position:absolute; top:6.0422em; left:9.6058em;"><span class="stl_15 stl_07 stl_11">□</span></div> <div style="position:absolute; top:5.9654em; left:16.6017em;"><span class="stl_16 stl_07 stl_17">三泉镇卫生院住院病案首页 </span></div> <div style="position:absolute; top:7.9332em; left:3.482em;"><span class="stl_12 stl_07 stl_18">健康卡号:无 </span></div> <div style="position:absolute; top:9.3132em; left:2.612em;"><span class="stl_12 stl_07 stl_19" style="word-spacing:-0.8472em;">姓名 韦会宣 </span></div> <div style="position:absolute; top:11.0249em; left:2.612em;"><span class="stl_12 stl_07 stl_20">年龄不足</span><span class="stl_14 stl_07 stl_20">1</span><span class="stl_12 stl_07 stl_20">周岁的)年龄 </span></div> <div style="position:absolute; top:12.4348em; left:2.162em;"><span class="stl_12 stl_07 stl_21" style="word-spacing:0.8341em;">出生地 </span><span class="stl_22 stl_07 stl_23" style="word-spacing:0.8638em;">省(区、市)重庆 </span></div> <div style="position:absolute; top:13.7573em; left:2.162em;"><span class="stl_12 stl_07 stl_24" style="word-spacing:2.2464em;">身份证号不详 职业务农 </span></div> <div style="position:absolute; top:7.9332em; left:20.1442em;"><span class="stl_12 stl_07 stl_25" style="word-spacing:-0.2874em;">第</span><span class="stl_14 stl_07 stl_25" style="word-spacing:-0.2874em;">1 </span><span class="stl_12 stl_07 stl_25" style="word-spacing:-0.2874em;">次住院 </span></div> <div style="position:absolute; top:7.9332em; left:34.5817em;"><span class="stl_12 stl_07 stl_26">病案号:</span><span class="stl_14 stl_07 stl_26">82277 </span></div> <div style="position:absolute; top:9.3132em; left:10.0858em;"><span class="stl_12 stl_07 stl_27" style="word-spacing:-0.5304em;">性别</span><span class="stl_09 stl_07 stl_28" style="word-spacing:-0.5493em;">1 1.</span><span class="stl_22 stl_07 stl_28" style="word-spacing:-0.5493em;">男</span><span class="stl_09 stl_07 stl_28" style="word-spacing:-0.5493em;">2.</span><span class="stl_22 stl_07 stl_28" style="word-spacing:-0.5493em;">女</span><span class="stl_12 stl_07 stl_27" style="word-spacing:-0.5304em;">出生日期</span><span class="stl_09 stl_07 stl_28" style="word-spacing:-0.5493em;">1942 </span><span class="stl_22 stl_07 stl_28" style="word-spacing:-0.5493em;">年</span><span class="stl_09 stl_07 stl_28" style="word-spacing:-0.5493em;">01 </span><span class="stl_22 stl_07 stl_28" style="word-spacing:-0.5493em;">月</span><span class="stl_09 stl_07 stl_28" style="word-spacing:-0.5493em;">15 </span><span class="stl_22 stl_07 stl_28" style="word-spacing:-0.5493em;">日 年龄</span><span class="stl_09 stl_07 stl_28" style="word-spacing:-0.5493em;">70</span><span class="stl_22 stl_07 stl_28" style="word-spacing:-0.5493em;">岁</span><span class="stl_12 stl_07 stl_27" style="word-spacing:-0.5304em;">国籍中国 </span></div>............
解决方案
挨个去取 getHtmlElements ,然后根据顺序判断,总可以吧。
还可以用正则表达式。
解决方案二:
也可以通过标签去取
var x=document.getElementsByTagName("p");
for (var i=0;i<x.length;i++)
{
// do something with each paragraph
}
解决方案三:
也可以通过标签去取
var x=document.getElementsByTagName("p");
for (var i=0;i<x.length;i++)
{
// do something with each paragraph
}
解决方案四:
用form写,或者是ajax、js提交
时间: 2024-12-18 23:37:43