Apps script Webapp | Lấy giá trị Input hiển thị lên – Web Get value input field display on web
Giaoan.link chia sẻ đến các bạn một project về “Apps script Webapp | Lấy giá trị Input hiển thị lên – Web Get value input field display on web” khá thú vị. Đây là một ứng dụng nhỏ và bạn có thể thêm nó vào các form nhập liệu của mình.
Chức năng của nó là sẽ lấy giá trị của một trường input để hiển thị ngược lại trên một trường khác của webapp. Dưới đây là code apps script và video demo trên youtube.
Bạn dễ dàn tìm kiếm các project apps script, googlesheet ở đây.
Các project googleapps script ngẫu nhiên
- HTML WEBAPP CSS -Mô phỏng hệ mặt trời -Trái đất -Mặt trăng đơn giản trên nền vũ trụ đen sao lấp lánh
- Google sheet Webapp Script | Tìm kiếm, lọc và In chi tiết thông tin sản phẩm của mã Khách hàng
- Google sheet Apps script | Data Entry Popup From – Thêm mới – Chỉnh sửa – Xóa
- Google sheet Webapp Script | Quản lý đặt xe cho chuyến đi – Tài xế cập nhật hoàn thành thông tin
- Apps script Webapp | Lấy giá trị Input hiển thị lên – Web Get value input field display on web
- Google sheet Apps script | Todo List and Send mail – Tạo danh sách nhắc việc và gửi mail
- Web App Script | Bộ Icon CSS Rất dễ lập trình cho giao diện webapp
- Google sheet Webapp | Project Quản lý khách hàng – Cập nhật tiến độ sửa chữa
- Google sheet Apps script Webapp | Login form OTP xác minh qua email, Chuyển link cho từng User
- Web App Script CSS JS | Tạo hiệu ứng Click button Nổ tung các mảnh giấy và chuyển link
Mã apps script trang “Code.gs”
function doGet(){
return HtmlService.createTemplateFromFile("index")
.evaluate()
}
Mã apps script trang “Index.html”
<!DOCTYPE html>
<html>
<head>
<base target="_top">
<style>
.container{
border: 2px solid blue;
border-radius: 10px;
width: 600px;
height: 300px;
padding: 5px;
margin-left: auto;
margin-right: auto;
box-shadow: 5px 5px 5px #aaaaaa;
}
.fields{
display: flex;
justify-content: center;
flex-wrap: wrap;
gap: 20px;
}
h2{
color: #BA55D3;
text-align: center;
text-shadow: -1px 0 #fff, 0 1px #fff, 1px 0 #fff, 0 -1px #fff;
padding-top: 5px;
}
.input-field{
width: 400px;
height: 20px;
font-size: 15px;
border: 1px solid blue;
outline: none;
border-radius: 15px;
padding: 10px;
}
.contact-inputs:focus{
border: 2px solid #000;
}
.input-field:focus{
border: 2px solid #BA55D3;
}
button{
height: 40px;
padding: 10px 10px;
border: none;
border-radius: 10px;
font-size: 14px;
font-weight: bold;
color: #fff;
background-image: linear-gradient(270deg,#BA55D3,#EE82EE);
cursor: pointer;
}
p{
width: 100%;
font-size: 20px;
font-weight: bold;
text-align: center;
height: 40px;
border: 2px solid red;
border-radius: 10px;
background-color: yellow;
padding: 10px;
margin: 10px;
}
</style>
</head>
<body>
<div class="container">
<h2>Lấy giá trị từ Input hiển thị lên trang web khi click button</h2>
<div class="fields">
<input class="input-field" name="input1" id="input1" type="text" placeholder="Họ tên của bạn">
<button id="btn1">Thực thi</button>
<p id="message"> </p>
</div>
</div>
<script>
const input1 = document.getElementById("input1");
const btn1 = document.getElementById("btn1");
function sendmessage(){
document.getElementById("message").innerHTML = 'Xin chào bạn '+input1.value+ '!';
input1.value = "";
}
btn1.addEventListener("click",sendmessage);
</script>
</body>
</html>