使用一个网页编辑小工具FCKeditor,需要将插入文中的图片及flash地址提取单独保存,如果在插入的时候保存则不能监听到后面的删除,所以只能在用户保存的时候处理 整段的HTML代码,提取其中的图片与flash的URL地址保存。。
如:<p><embed src="/WebSite2/Upload/flash/890.swf" type="application/x-shockwave-flash" play="true" loop="true" menu="true"></embed><img height="391" width="480" alt="" src="/WebSite2/Upload/image/hello.jpg" /><img alt="" src="http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif" /></p>
截取其中的 图片和flash的 URL地址
如:<p><embed src="/WebSite2/Upload/flash/890.swf" type="application/x-shockwave-flash" play="true" loop="true" menu="true"></embed><img height="391" width="480" alt="" src="/WebSite2/Upload/image/hello.jpg" /><img alt="" src="http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif" /></p>
截取其中的 图片和flash的 URL地址
解决方案 »
- js select 下拉框 如何当选择一个内容的时候,变回默认值 请选择
- 求指导
- (问题解决了,谁接个分结贴了)Jquery 二级导航 focusout ie和其他浏览器不同的 问题
- javascript的事件机制不明白,请高人指点。
- Javascript调试问题
- 早起的鸟儿~有虫吃,早起的虫儿~被鸟吃,提个问,输出连续数值是‘怪怪的,why
- 用ArcIMS怎么做专题地图?谢谢
- 关于关键字的做法
- 求关于javascript访问XML方面的帮助文件(手册),越详细越好(急!送高分!)
- 怎么样用JavaScript或者JScript将“2003-1-6”这样的格式转换成“2003-01-06”这样的格式?
- 一个JS 写法
- 如何对动态创建出来的DIV层添加鼠标事件?
<script type="text/javascript">
<!--
var str = 's<p> <embed src="/WebSite2/Upload/flash/890.swf" type="application/x-shockwave-flash" play="true" loop="true" menu="true"> </embed> <img height="391" width="480" alt="" src="/WebSite2/Upload/image/hello.jpg" /> <img alt="" src="http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif" /></p>'; var reg = /src\s*=\s*("|')([^"]+?)\1/g; while((result = reg.exec(str)) != null){
alert(result[2])
}//-->
</script>
s = "<p> <embed src=\"/WebSite2/Upload/flash/890.swf\" type=\"application/x-shockwave-flash\" play=\"true\" loop=\"true\" menu=\"true\"> </embed> <img height=\"391\" width=\"480\" alt=\"\" src=\"/WebSite2/Upload/image/hello.jpg\" /> <img alt=\"\" src=\"http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif\" /> </p>"
re = /src="([^"]+)"/ig;
while((arr=re.exec(s))!=null){
alert(arr[1])
}
还能不能麻烦二位一下呢
我这想将图片与flash 分开匹配查找
这样的正则表达式该怎么写呢?
s = "<p> <embed src=\"/WebSite2/Upload/flash/890.swf\" type=\"application/x-shockwave-flash\" play=\"true\" loop=\"true\" menu=\"true\"> </embed> <img height=\"391\" width=\"480\" alt=\"\" src=\"/WebSite2/Upload/image/hello.jpg\" /> <img alt=\"\" src=\"http://localhost:3375/WebSite2/fckeditor/editor/images/smiley/20090515/115.gif\" /> </p>"
re = /src="([^"]+.swf)"/ig;
while((arr=re.exec(s))!=null){
alert(arr[1])
}
re = /src="([^"]+(.jpg|.gif|.jpeg|.png))"/ig;
while((arr=re.exec(s))!=null){
alert(arr[1])
}