1
이는
onclick
속성과 작동
<button type="button" onclick="this.style.color='red';">Astringents</button>
이것은 온 클릭 속성에 작동하지만 헤드 요소에서 호출되지 않은 경우 :
<head>
<script type="text/javascript">
function red() {
this.style.color='red';
}
</script>
</head>
<button type="button" onclick="red();">Astringents</button>
편집 : 몇 가지 버튼을 제공하는 하나의 기능을 사용하고 싶습니다. 예를 들어 : - 요소의 속성을 편집 할 수 없습니다, 따라서이 시나리오에서
<button type="button" onclick="red();">Astringents</button>
<button type="button" onclick="red();">Exfoliators</button>
<button type="button" onclick="red();">Moisturizers</button>
<button type="button" onclick="red();">Masques</button/>
감사합니다. – Corey