1
그래서 나는 매일 사진을 변경할 수있는 웹 사이트를 만들려고합니다. 이미지 소스를 변수 imageurl
으로 설정하는 데 도움이 필요합니다. 또한 변수 imageurl
이 전역이되도록합니다.변경 가능한 이미지 소스가있는 웹 사이트
변수를 imageurl
링크로 설정하고 프롬프트로 설정 한 후 이미지를 imageurl
으로 설정합니다.
<!DOCTYPE html>
<html>
<head>
<div align="center">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>picture of the day</title>
<h1>Jere's picture of the day</h1>
<link href="style.css" rel="stylesheet" type="text/css">
</div>
</head>
<body>
<style>
div {
background-color: #8000ff;
color: #ffffff;
padding: 20px;
}
</style>
<script src="code.js" type="text/javascript" charset="utf-8"></script>
<script>
function myFunction() {
isitjere = prompt("Password?");
if (isitjere === "thedog")
alert("password:" + isitjere + " " + "has been accepted");
editimage = prompt("do you want to change the image?(type yes or no)");
if (editimage === "yes")
imageurl = prompt("paste the image url(if you dont have a url for it you can upload it and paste the upload link)");
}
</script>
<button onclick="myFunction()">edit</button>
<img src=imageurl>
</div>
</body>
</html>
작업 코드는 자바 코드를 아직 작성 당신이 실제로 있습니까? –
Java 또는 Javascript? body 태그 아래 –
그것은 "function myFunction()"에서 시작합니다. –