<!DOCTYPE html>
<html>
<body>
<h2>What Can JavaScript Do?</h2>
<p id="demo">JavaScript can change HTML content.</p>
<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>
</body>
</html>
<!DOCTYPE html>
<html>
<body>
<h2>What Can JavaScript Do?</h2>
<p>JavaScript can change HTML attribute values.</p>
<p>In this case JavaScript changes the value of the src (source) attribute of an image.</p>
<button onclick="document.getElementById('myImage').src='pic_bulbon.gif'">Turn on the light</button>
<img id="myImage" src="pic_bulboff.gif" style="width:100px">
<button onclick="document.getElementById('myImage').src='pic_bulboff.gif'">Turn off the light</button>ً
</body>
</html>
document.getElementById("demo").style.fontSize = "35px";
document.getElementById("demo").style.display = "none";
document.getElementById("demo").style.display = "block";
<!DOCTYPE html>
<html>
<body>
<form id="myForm">
Select your favorite fruit:
<select id="mySelect">
<option>Apple</option>
<option>Orange</option>
<option >Pineapple</option>
<option>Banana</option>
</select>
</form>
<p>Click the button to return the id of the form the dropdown list belongs to.</p>
<button type="button" onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
var x = document.getElementById("mySelect").form.id;
document.getElementById("demo").innerHTML = x;
}
</script>
</body>
var select_y =document.getElementById('id_ye_select').value
<form id="myForm">
Yek matn:
<select id="id_ye_select">
<option>5</option>
<option>4</option>
</select>
</form>
document.getElementById("its_id").addEventListener("click", naame_taabe, false);
function naame_taabe()
{
}
<button id="id_ye_button" style="width:70px; height:50px;">neveshteye roye dokme</button>