Сообщение от Царь Леонид
|
нужно сделать запрос, вывод этой строки на странице ничего не изменит)
|
Какой запрос? почему не изменит? Все будет работать нормально
<html>
<head>
</head>
<body>
<select>
<option>default</option>
<option>1</option>
</select>
<button>
test
</button>
<script>
document.querySelector("select").onchange=function(){
var el=document.createElement("script")
el.innerHTML="test=function(){alert('Hello!')}"
document.body.appendChild(el)
}
document.querySelector("button").onclick=function(){window.test&&test()}
</script>
</body>
</html>