当前位置:网站首页>According to the variable name we want to visit
According to the variable name we want to visit
2022-04-21 08:18:00 【395 Long Street】
Sometimes we need to visit a website dynamically , For example, in a large number of static websites , We may be because after the database call , Render at the front end html More difficult , At this time, we may want to use a large number of already written html file , As an alternative " database ", Search a web page for , We use the value they entered as the name of our website , In this way, a kind of , We have the illusion of a database , So how do we achieve this effect
Look at my code
<style>
.flex-container {
display: -webkit-flex;
display: flex;
width: 1200px;
height: 800px;
}
.flex-item {
width: 600px;
height: 800px;
margin: 10px;
}
.container{
width: 500px;
height: 50px;
margin: 150px 50px 50px 50px;
}
.parent {
width: 100%;
height: 42px;
margin: 50px 50px 50px 50px;
position: relative;
}
.parent>input:first-of-type {
/* The input box height is set to 40px, border occupy 2px, The total height is 42px*/
width: 380px;
height: 40px;
border: 1px solid #ccc;
font-size: 16px;
outline: none;
}
.parent>input:first-of-type:focus {
border: 1px solid #317ef3;
padding-left: 10px;
}
.parent>input:last-of-type {
/*button Button border Does not occupy the peripheral size , Set height 42px*/
width: 100px;
height: 44px;
position: absolute;
background: #317ef3;
border: 1px solid #317ef3;
color: #fff;
font-size: 16px;
outline: none;
}</style>
<div class="container">
<br>
<div class="parent">
<input id="litter" type="text" placeholder=" Please enter the Chinese characters to search " />
<input type="button" value=" Search for " id="btn"/>
<br>
</div>
<script type="text/javascript">
// function $(id){ return document.getElementById(id);}// Packaged $(id) function
btn.onclick = function(){ // When the button is clicked , Execute function ( Event source . event = Event handler )
alert(litter.value);
// TestAjax1();
let name=litter.value;
window.location.href='../fz/'+name+'.html'
}
</script>
The effect is as follows :

Here we search Han
result :

So we can see that it can give the public the illusion of having a database , Because this style is much more difficult in front-end rendering than in table rendering , So the author directly uses a large number of static websites to imitate the form of database , Search through the contents of the search bar .
Because the above code is not complete , But the core has given , Readers can adopt... According to their own situation
版权声明
本文为[395 Long Street]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204210743206046.html
边栏推荐
- ehcart 地图
- Convertir la chaîne C # en chaînes de restauration base64 et base64
- MySQL查看字符集和校对规则
- 【get C】数据在内存是如何存储的
- 【大话云原生】负载均衡篇-小饭馆客流量变大了
- Express architecture in nodejs
- 31 drop down box codes of provinces, municipalities and autonomous regions directly under the central government
- 【精品】利用动态代理实现事务统一管理一
- Postgresql limit sql性能分析
- Vim这么难用,为啥这么多人热衷?
猜你喜欢
随机推荐
若依将ehcache改为redis缓存详细整合步骤
js第十二篇
【C语言入门系列(8)(9)】第八、九章、指针、结构体
求其最大公约数和最小公倍数
No . egg-info directory found in xxx\pip-pip-egg-info-mq
小米路由器3G R3G 刷入Breed和OpenWrt 20.02.2 的记录
记C#的操蛋字符串转Base64和Base64还原字符串
什么是父子关系和菱形继承
Redis (15) -- master-slave replication of redis -- sentinel mode
Antv X6 画布平移
ESP32 VHCI实现BLE广播,就是这么神奇
SQL Server 数据库之SQL Server 数据库的安全设置
Xiaomi router 3G R3G brushes in the records of feed and openwrt 20.02.2
阿里云性能测试 PTS 3 月新功能
Introduction to cyberspace and implementation of cryptography operation
第五章 函数
web应用中的乱码问题
第八章 事务
ARM64体系结构编程与实践:算术与移位指令
MySQL创建新表







