删除标签之间的内容 [英] remove the content in between tags
问题描述
如何删除标签之间的内容?我有一个页面有几个自定义标签:<! - tag:1 - >内容1<! - / tag:1 - > < br>
<! - tag:2 - >内容2<! - / tag:2 - > <峰; br> < - 标记:3 - >内容3
<! - / tag:3 - >如果我只想看到标签2的内容为
的例子,我怎么能去除1和3?
How can I remove the content in between tags? I have a page that has
several custom tags: <!--tag:1--> Content 1 <!--/tag:1--> <br>
<!--tag:2--> Content 2 <!--/tag:2--> <br> <!--tag:3--> Content 3
<!--/tag:3--> If I only wanted to see the contents of tag 2 for
example, how could I strip out 1 and 3?
推荐答案
它必须是InStr()的组合,以获得第一个标签的
结束位置和第二个标记的开始位置。然后可能只是一个
夫妇Left()和Right()调用重组。
-
Curt Christianson
网站&脚本: http://www.Darkfalz.com
博客: http://blog.Darkfalz.com
" j1c" <菊******** @ yahoo.ca>在消息中写道
news:11 ********************** @ g14g2000cwa.googlegr oups.com ...
Its going to have to be a combination of InStr() to get the positions of the
end of the first tag and the start of the second. Then probably just a
couple Left() and Right() calls to recombine.
--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"j1c" <ju********@yahoo.ca> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
如何删除标签之间的内容?我有一个页面有几个自定义标签:<! - tag:1 - >内容1<! - / tag:1 - > < br>
<! - tag:2 - >内容2<! - / tag:2 - > <峰; br> < - 标记:3 - >内容3
<! - / tag:3 - >如果我只想看到标签2的内容为
示例,我怎么能去除1和3?
How can I remove the content in between tags? I have a page that has
several custom tags: <!--tag:1--> Content 1 <!--/tag:1--> <br>
<!--tag:2--> Content 2 <!--/tag:2--> <br> <!--tag:3--> Content 3
<!--/tag:3--> If I only wanted to see the contents of tag 2 for
example, how could I strip out 1 and 3?
你能给一个例如?
Could you give an example?
" j1c" <菊******** @ yahoo.ca>在消息中写道
news:11 ********************** @ g14g2000cwa.googlegr oups.com ...
"j1c" <ju********@yahoo.ca> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
如何删除标签之间的内容?我有一个页面有几个自定义标签:<! - tag:1 - >内容1<! - / tag:1 - > < br>
<! - tag:2 - >内容2<! - / tag:2 - > <峰; br> < - 标记:3 - >内容3
<! - / tag:3 - >如果我只想看到标签2的内容为
示例,我怎么能去除1和3?
How can I remove the content in between tags? I have a page that has
several custom tags: <!--tag:1--> Content 1 <!--/tag:1--> <br>
<!--tag:2--> Content 2 <!--/tag:2--> <br> <!--tag:3--> Content 3
<!--/tag:3--> If I only wanted to see the contents of tag 2 for
example, how could I strip out 1 and 3?
你可以改变
<! - tag:1 - >内容1< ;! - / tag:1 - >
到
< span id =" tag1">内容1< / span>
如果是,那么以下帮助会是什么?请注意自动换行。
< html>
< head>
< title> tags.htm< / title>
< script type =" text / javascript">
函数标签(什么){
document.getElementById( " tag" + what).style.visibili ty =" hidden";
}
< / script>
< / head>
< body>
< span id =" tag1">内容1< / span>
< br>
< span id =" tag2">内容2< / span>
< br>
< span id =" tag3">内容3< / span>
< input type =" button" value ="隐藏1" onclick =" tags(1)">
< input type =" button" value ="隐藏2" onclick =" tags(2)">
< input type =" button" value ="隐藏3" onclick =" tags(3)">
< / body>
< / html>
Can you change
<!--tag:1--> Content 1 <!--/tag:1-->
to
<span id="tag1"> Content 1 </span>
if so then will the following help? Watch for word-wrap.
<html>
<head>
<title>tags.htm</title>
<script type="text/javascript">
function tags(what) {
document.getElementById("tag"+what).style.visibili ty = "hidden";
}
</script>
</head>
<body>
<span id="tag1"> Content 1 </span>
<br>
<span id="tag2"> Content 2 </span>
<br>
<span id="tag3"> Content 3 </span>
<input type="button" value="Hide 1" onclick="tags(1)">
<input type="button" value="Hide 2" onclick="tags(2)">
<input type="button" value="Hide 3" onclick="tags(3)">
</body>
</html>
这篇关于删除标签之间的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!