Как правильно определить функцию в onClick? Выдает ошибку Unhandled Error: Undefined variable
Как правильно определить функцию fun1:
html-файл:
<script src="fun.js"></script>
js-файл fun.js:
function fun1(){alert('fun1');}
function fun(){
str='<input type=button value="Press"> ';
document.open();
document.write(str);
document.close();
}
onload = fun;
Выдает:
Unhandled Error: Undefined variable: fun1
Источник: Stack Overflow на русском