Some references with JavaScript
Template Literals
#JS
const name = "kaito";
var message = `Hi I'm ${name}`
console.log(message);
Position the Text Animation
Position the Text Animation
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<script>
function init(){
img=document.getElementById('mytext');
img.style.position='relative';
img.style.left='0px';
img.style.top='10';
}
function right(){
img.style.left=parseInt(img.style.left)+10+'px';
}
window.onload=init;
</script>
<form>
<h1 id="mytext">This is my text</h1>
<input type="button" onclick="right()" value="Go to left side">
</form>
</body>
</html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<script>
function init(){
img=document.getElementById('mytext');
img.style.position='relative';
img.style.left='0px';
img.style.top='10';
}
function right(){
img.style.left=parseInt(img.style.left)+10+'px';
}
window.onload=init;
</script>
<form>
<h1 id="mytext">This is my text</h1>
<input type="button" onclick="right()" value="Go to left side">
</form>
</body>
</html>
Comments
Post a Comment