<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>JavaScript edit onClick</title>
<script type="text/javascript">
function FunA()
{
var button = document.getElementById('A')
button.id = 'idB'
button.className = 'classB'
button.setAttribute('onclick','FunB()')
button.innerHTML = 'Выполнить FunB'
}
function FunB()
{
var button = document.getElementById('B')
button.id = 'idA'
button.className = 'classA'
button.setAttribute('onclick','FunA()')
button.innerHTML = 'Выполнить FunA'
}
</script>
</head>
<body>
<button id="idA" class="classA" onclick="FunA()">Выполнить FunA</button>
</body>
</html>
|