让GPT3.5用HTML、JS、CSS编写不用任何第三方库一个浏览器起始页!

求关注,也许还能看到其他这样的文章!

<h1>第一次编写<h1/>

<h2>HTML<h2/>

<!DOCTYPE html>
<html>
<head>
  <title>My Browser Start Page</title>
  <link rel="stylesheet" type="text/css" href="style.css">
  <script src="script.js"></script>
</head>
<body>
  <header>
    <h1>Welcome to my Browser Start Page</h1>
  </header>
  
  <main>
    <div class="search-container">
      <input type="text" id="search-input" placeholder="Search...">
      <button id="search-button">Search</button>
    </div>
  
    <div id="weather">
      <h2>Loading weather...</h2>
    </div>
  
    <div id="quote">
      <h2>Loading quote...</h2>
    </div>
  </main>
</body>
</html>

<h2>CSS<h2/>

body {
  font-family: Arial, sans-serif;
  background-color: #f1f1f1;
  margin: 0;
  padding: 0;
}

header {
  background-color: #333;
  color: white;
  padding: 20px;
}

main {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.search-container {
  margin-bottom: 20px;
}

#search-input {
  width: 70%;
  padding: 10px;
}

#search-button {
  padding: 10px;
}

#weather, #quote {
  margin-bottom: 10px;
}

h2 {
  font-size: 16px;
}

<h2>JS<h2/>

document.addEventListener('DOMContentLoaded', function() {
  fetchWeather();
  fetchQuote();
  
  document.getElementById('search-button').addEventListener('click', function() {
    var query = document.getElementById('search-input').value;
    search(query);
  });
});

function fetchWeather() {
  // Simulating API call to fetch weather data
  setTimeout(function() {
    var weatherData = "Sunny";
    document.getElementById('weather').innerHTML = '<h2>' + weatherData + '</h2>';
  }, 1500);
}

function fetchQuote() {
  // Simulating API call to fetch quote
  setTimeout(function() {
    var quote = "Life is either a daring adventure or nothing at all.";
    document.getElementById('quote').innerHTML = '<h2>' + quote + '</h2>';
  }, 2000);
}

function search(query) {
  // Simulating search functionality
  alert('Searching for: ' + query);
}

<h2>文件地址和第二次编写の导语<h2/>

我们打开起始页就会发现根本不行!当你搜索后就会发现写什么就回复什么。于是又开始了第二次

<h1>第二次编写<h1/>

<h2>HTML<h2/>

<!DOCTYPE html>
<html>
<head>
  <title>My Browser Start Page</title>
  <link rel="stylesheet" type="text/css" href="style.css">
  <script src="script.js"></script>
</head>
<body>
  <header>
    <h1>Welcome to my Browser Start Page</h1>
  </header>
  
  <main>
    <div class="search-container">
      <input type="text" id="search-input" placeholder="Search...">
      <button id="search-button">Search</button>
    </div>
  
    <div id="weather">
      <h2>Loading weather...</h2>
    </div>
  
    <div id="quote">
      <h2>Loading quote...</h2>
    </div>
  </main>
</body>
</html>

<h2>CSS<h2/>

body {
  font-family: Arial, sans-serif;
  background-color: #f1f1f1;
  margin: 0;
  padding: 0;
}

header {
  background-color: #333;
  color: white;
  padding: 20px;
}

main {
  max-width: 800px;
  margin: 20px auto;
  padding: 20px;
  background-color: white;
  border-radius: 5px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
}

.search-container {
  margin-bottom: 20px;
}

#search-input {
  width: 70%;
  padding: 10px;
}

#search-button {
  padding: 10px;
}

#weather, #quote {
  margin-bottom: 10px;
}

h2 {
  font-size: 16px;
}

<h2>JS<h2/>

document.addEventListener('DOMContentLoaded', function() {
  fetchWeather();
  fetchQuote();
  
  document.getElementById('search-button').addEventListener('click', function() {
    var query = document.getElementById('search-input').value;
    search(query);
  });
});

function fetchWeather() {
  // Simulating API call to fetch weather data
  setTimeout(function() {
    var weatherData = "Sunny";
    document.getElementById('weather').innerHTML = '<h2>' + weatherData + '</h2>';
  }, 1500);
}

function fetchQuote() {
  // Simulating API call to fetch quote
  setTimeout(function() {
    var quote = "Life is either a daring adventure or nothing at all.";
    document.getElementById('quote').innerHTML = '<h2>' + quote + '</h2>';
  }, 2000);
}

function search(query) {
  // Redirect to Baidu search with the query
  window.location.href = 'https://www.baidu.com/s?wd=' + encodeURIComponent(query);
}

<h2>文件地址<h2/>

那么文章到这也就结束了,感兴趣的可以再帮我修改并发给我,那我们的起始页也是完工了。那么下期做什么就投票选择!Bye!

代码:GPT3.5

文章:小小的寒露

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值