<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>index</title>
</head>
<body >
<div >
<div style="float: right;margin-right: 25px">
<img src="./img/微信图片.jpg" name="pic" >
</div>
<div style="float: right;">
<form action="" name="register">
<input type="text" placeholder="用户名" ><br>
<input type="password" placeholder="密码不少于8位" ><br>
<button>提交</button>
</form>
</div>
</div>
<script type="text/javascript">
//通过class获取元素
let info= document.getElementsByClassName('info').item(0);
info.style.backgroundColor='black';
info.style.width='100%';
info.style.height='200px';
//通过name获取元素
let pic=document.getElementsByName('pic').item(0);
pic.style.width='200px'
//通过标签名和name来获取元素
document.images[0].style.height="200px";
//通过css选择器来获取元素
let input=document.querySelectorAll('input');
for(let i=0;i<input.length;i++){
input[i].style.marginRight='25px';
input[i].style.marginTop='15px';
input[i].style.width='200px';
input[i].style.height='25px';}
</script>
</body>
</html>