html JS.DOM.ContentHtml.textContent.innerHTML.ChangingAttr

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html JS.DOM.ContentHtml.textContent.innerHTML.ChangingAttr相关的知识,希望对你有一定的参考价值。

function resetName() {
  var inputField = document.querySelector("#name");
  inputField.value = "";
}

function setToGreen() {
  var colorChooser = document.querySelector("#color");
  colorChooser.value = "#00FF00";
}

function changeStep() {
  var number = document.querySelector("#number");
  number.value = 10;
  number.step = "0.1";
  number.max = 11;
}

function changeAndResize(img) {
    img.src="https://pbs.twimg.com/profile_images/110455194/n666194627_2302_400x400.jpg";
  img.width=250;
  img.style.border = "4px solid red";
}
JS.DOM.ContentHtml.textContent.innerHTML.ChangingAttr
-----------------------------------------------------


A [Pen](https://codepen.io/Onlyforbopi/pen/KxLKQR) by [Pan Doul](https://codepen.io/Onlyforbopi) on [CodePen](https://codepen.io).

[License](https://codepen.io/Onlyforbopi/pen/KxLKQR/license).
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>Modifying content of selected DOM nodes</title>
</head>
<body>
  <h1>Try these</h1>
<p>What is your name: <input type="text" id="name" value="Michel"> <button onclick="resetName();">Reset (click to empty the input field)</button></p>
  <p>Pick a color: <input id="color" type="color" value='#FF0000'><button onclick="setToGreen();">Set color chooser to green</button></p>
  <p>In the next example, click on the input field and use the small vertical arrows to increase the value. Notice that the numbers go 1 by 1 and that the maximum value is 20. Then click the button and do the same thing!</p>
    <p>Pick a number between 0 and 20: <input id="number" type="number" min=0 max=20 step = 1 value='10'><button onclick="changeStep();">Change step and max attribute values </button></p>
  <p>Click the next image to change its url and size:</p>
<img src="https://www.paris-web.fr/2013/assets_c/2013/08/michel-buffa-thumb-143x143-372.jpg" onclick="changeAndResize(this)" alt="Michel Buffa">
</body>
</html>

以上是关于html JS.DOM.ContentHtml.textContent.innerHTML.ChangingAttr的主要内容,如果未能解决你的问题,请参考以下文章

html Html模板/ Html Boilerplate |标签HTML

html里怎么引用一个html的头部

html5与传统html区别

html4和html5的区别

HTML元素

head标签怎么给多个html引用