Extracting some code fields from your code

Source: Internet
Author: User


<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

xmlns= "http://www.w3.org/1999/xhtml" >


<meta http-equiv= "content-type" Content= "text/html; charset=utf-8"/>

<title> Extracting some code fields from your code </title>

<style Type= "text/css" >

. left_part {width:600px; float:left;}

. left_part textarea {width:100%;}

. right_part {float:left; width:600px; margin:0 0 0 30px; }

. right_part textarea {width:100%;}

</style>


<body>

<div Class= "left_part" >

<textarea Name= "" " id="code" cols=" + " rows="40 the > paste text </textarea>

<br>

<br>

<input Type= "button" value= " build " id= "build_btn" style = "width:100px; height:100px; font-size:20px; float:right ;" >

</div>

<div Class= "right_part" >

<textarea Name= "" " id="build" cols=" + " rows="40 "></textarea>

</div>

<script>

var reg = after = ';

var t = document.getElementById (' code ');

var B = document.getElementById (' build_btn ');

var c = document.getElementById (' Build ');



Reg =/\<destination\> (. *) (\.) (Shtml|html|jsp|js|css|xml) \<\/destination\>/g;

after = "$1$2$3";



B.onclick = function () {

var v = t.value;

var sc = r = "";

var result = [];

var i = 0;

while ((r = reg.exec (v)) = null) {

Result[i] = r[0];

i++;

}

for (var i = 0; i < result.length; i++) {

for (var j = i + 1; j < Result.length; J + +) {

if (result[i] = = Result[j]) {

Result.splice (j,1);

j--;

}

}

}

sc = result.join (' \ n ');

sc = sc.replace (reg,after). Replace (/\\/g, '/');

C.value = SC;

C.select ();

}

</script>

</body>




Extracting some code fields from your code

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.