For content separation, extract Images Using Regular Expressions (must be refined)
Source: Internet
Author: User
For example, I want to display an image of the content I added on the left side of the page template (separated by two cells), while on the right side is ArticleThe text content is like this. If we follow the label provided by fengxun, it is impossible to say this! I will not talk much about it. Please refer to the following CodeRight:
Add this JS function to the template.
<Script language = "JavaScript">
Function splitimgcontent (tdimg, tdcontent ){
VaR myreg =/ /;
VaR STR = Document. getelementbyid (tdcontent). innerhtml;
VaR I = Str. Match (myreg );
VaR Mm = I [0];
Mm = mm. Replace ("<","");
Mm = mm. Replace ("> ","");
Mm + = "width = 400 Height = 400 ";
Mm = "<" + mm + "> ";
Document. getelementbyid (tdimg). innerhtml = mm;
VaR newstr = Str. Replace (myreg ,"");
Document. getelementbyid (tdcontent). innerhtml = newstr;
}
</SCRIPT>
Call <body onload = "splitimgcontent ('f _ IMG ', 'f _ content')">
F_img is the ID of the <TD> ID f_content that is originally placed in the <TD> image. You only need to add an ID to the <TD> table for which you want them to appear. is that convenient! In fact, according to this practice, there are a lot of long-term D .....
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service