๋ฐ์ํ
์๋ ํ์ธ์ yunamom ์ ๋๋ค :D
์ด๋ฒ์๊ฐ์๋ JavaScript ์์ ํค๋ณด๋, ๋ง์ฐ์ค ์ด๋ฒคํธ ํจ์์ ๋ํ์ฌ ํฌ์คํ ํ๊ฒ ์ต๋๋ค.๐
onclick : ํด๋ฆญํ์๋
onclick
<div onclick="on1()">onclick</div>
<input id="o1">
function on1(){
var values = document.getElementById('o1').value;
document.getElementById('o1').value = (values.length < 1)?"yunamom":"";
}
onmouseover : ๋ง์ฐ์ค๋ฅผ ์ฌ๋ ธ์ ๋ / onmouseout : ๋ง์ฐ์ค๋ฅผ ๋ฐ์ผ๋ก ์ฎ๊ฒผ์ ๋
onmouseover/onmouseout
<div onmouseover="on2()" onmouseout="on3()">onmouseover/onmouseout</div>
<input id="o2">
function on2(){
document.getElementById('o2').value = "yunamom";
}
onchange : ์ ๋ ํธ๋ฐ์ค ๊ฐ ์ ํํ์๋
<select id="on" onchange="on4()">
<option value="">onchange</option>
<option value="test1" >test1</option>
<option value="test2" >test2</option>
</select>
<input id="o4">
function on4(){
var values = document.getElementById('on').value;
document.getElementById('o4').value = values;
}
onkeyup : ๊ฐ์ ์ ๋ ฅํ ๋
<input id="5" onkeyup="on5()" placeholder="onkeyup">
<input id="o5">
function on5(){
var values = document.getElementById('5').value;
document.getElementById('o5').value = values;
}
300x250
'๊ฐ๋ฐ์ธ์ด > JS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CSS] <h1> ~ <h6> ๊ธฐ๋ณธ๊ฐ ์ฝ๋ (0) | 2022.06.30 |
---|---|
[JS] replace, replaceAll ์ฌ์ฉ๋ฐฉ๋ฒ (0) | 2022.05.03 |
[CSS] ์ด๋ฏธ์ง์ ์ ์ฉํ ๋ง์ฐ์ค hover ํจ๊ณผ๋ค (์์ํฌํจ) (1) | 2022.04.17 |
[CSS] ํฌ๋ช ๋ ์ค์ ํ๋๋ฒ - opacity / rgba (0) | 2022.04.10 |
[CSS] background-repeat (๋ฐฐ๊ฒฝ ์ด๋ฏธ์ง ๋ฐ๋ณต ์ฌ๋ถ) (0) | 2022.04.09 |