-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconverthtml2javascript.html
More file actions
36 lines (33 loc) · 930 Bytes
/
converthtml2javascript.html
File metadata and controls
36 lines (33 loc) · 930 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<center>
<form id="codeconverter">
Input Text:<br>
<textarea autofocus name="inputtext" cols=60 rows=10></textarea><br>
<input onclick="javascript:converttext();" style="margin-top: 5px;" type="button" value="Convert" /><br>
Output Text:<br>
<textarea name="outputtext" cols=60 rows=10></textarea><br>
</form>
<script language="javascript" type="text/javascript">
/* <![CDATA[ */
function converttext(){
inputtext = document.getElementById('codeconverter').inputtext.value;
out = inputtext.replace(/\&/g, '&')
out = out.replace(/\</g, '<')
out = out.replace(/\>/g, '>')
out = out.replace(/\"/g, '"')
out = out.replace(/\'/g, ''')
out = out.replace(/\|/g, '|')
out = ''+out+''
document.getElementById('codeconverter').outputtext.value = out;
}
/* ]]> */
</script>
</center>
</body>
</html>