-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
56 lines (50 loc) · 1.47 KB
/
index.html
File metadata and controls
56 lines (50 loc) · 1.47 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<!DOCTYPE html>
<html lang="fa">
<head>
<meta charset="UTF-8">
<title>Input Text Display</title>
<style>
body {
font-family: Arial, Tahoma, sans-serif;
padding: 20px;
}
input {
width: 300px;
padding: 6px;
}
button {
margin-left: 5px;
padding: 6px 10px;
cursor: pointer;
}
.output {
margin-top: 20px;
padding: 10px;
border: 1px solid #ccc;
min-height: 30px;
}
</style>
</head>
<body>
<input type="text" id="textInput" placeholder="متن را وارد کنید">
<button onclick="showText()">نمایش متن (LTR)</button>
<button onclick="showTextRTL()">نمایش متن (RTL)</button>
<div id="output" class="output"></div>
<script>
function showText() {
const text = document.getElementById("textInput").value;
const output = document.getElementById("output");
output.innerText = text;
output.style.direction = "ltr";
output.style.textAlign = "left";
}
function showTextRTL() {
const text = document.getElementById("textInput").value;
const output = document.getElementById("output");
output.innerText = text;
output.style.direction = "rtl";
output.style.textAlign = "right";
}
</script>
</body>
</html>