Files
scc-astro/src/pages/learn.astro
2023-05-17 22:16:34 +05:30

149 lines
5.1 KiB
Plaintext

<body class="container mx-auto px-4">
<main onclick="bodyColor()" >
<a href="youtube.com">Youtube</a>
<div>
<button class="bg-blue-700 text-white" onclick="myfunction()">Click Me</button>
<p id="demo"></p>
<p id="demo2" onclick="myfunction2()">Click me</p>
<!-- <p id="demo3" onclick="myfunction3()">Click</p> -->
<button onclick="myfunction3()">Click Me</button>
<p id="demo3"></p>
<p id="color" onclick="changeColor()">Click To change Color</p>
<input oncut="textCopied()" type="text" value="Try cut me" class="border">
<p id="copy"></p>
<label for="">Enter name</label>
<input type="text" id="fname" onblur="onBlur()" class="border" />
</div>
<select name="" id="mySelect" onchange="nameChange()">
<option value="Select" selected>-Select-</option>
<option value="Kumra">Kumra</option>
<option value="Habra">Habra</option>
<option value="Barasat">Barasat</option>
<option value="Kolkata">Kolkata</option>
<option value="North 24 parganas">North 24 parganas</option>
<option value="West Bengal">West Bengal</option>
</select>
<p id="name"></p>
<button onclick="fullScreen()" class="bg-green-800 text-white font-bold px-6 py-2 rounded-lg">Open Full Screen</button>
<button onclick="closeScreen()" class="bg-red-800 text-white px-6 py-2 font-bold rounded-lg" >Close Full Screen</button>
</main>
</body>
<script is:inline>
let a = null;
let b = 345;
let c = true;
// let d = BigInt("BifInt")
let e = "JavaScript";
let f = Symbol("I am a symbol");
let g = undefined;
// console.log(a, b, c, e, f, g)
var x = 20;
// a = "suvo";
// a = "java";
// console.log(typeof x)
let data =[10, 22, 37, 48, 88, 92, 99, 100];
let evenArray=[];
for(let i=0;i<data.length;i++) {
if (data[i]%2==0){
evenArray.push(data[i])
}
}
for (let i=0;i<evenArray.length;i++) {
evenArray[i]=evenArray[i]*2
}
// console.log(evenArray)
var elem = document.documentElement;
function fullScreen() {
if (elem.requestFullscreen) {
elem.requestFullscreen();
}
else if (elem.mozRequestFullScreen) {
elem.mozRequestFullScreen();
}
else if (elem.webkitRequestFullScreen) {
elem.webkitRequestFullScreen();
}
else if (elem.msRequestFullScreen) {
elem = window.top.document.body;
elem.msRequestFullScreen();
}
}
function closeScreen(){
if (document.exitFullscreen) {
document.exitFullscreen();
}
else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
}
else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
else if (document.msExitFullscreen) {
window.top.document.msExitFullscreen
}
}
var output = document.getElementById("myP");
document.addEventListener("fullscreenchange", function() {
output.innerHTML = "fullscreenchange event fired!";
});
document.addEventListener("mozfullscreenchange", function() {
output.innerHTML = "mozfullscreenchange event fired!";
});
document.addEventListener("webkitfullscreenchange", function() {
output.innerHTML = "webkitfullscreenchange event fired!";
});
document.addEventListener("msfullscreenchange", function() {
output.innerHTML = "msfullscreenchange event fired!";
});
function nameChange() {
var s = document.getElementById("mySelect").value;
document.getElementById("name").innerHTML = "You Selected: " + s;
}
// function unload() {
// return "Write Something Here......!";
// }
function myfunction() {
document.getElementById("demo").innerHTML="A paragraph is a series of sentences that are organized and coherent, and are all related to a single topic. Almost every piece of writing you do that is longer than a few sentences should be organized into paragraphs.";
}
function myfunction2() {
document.getElementById("demo2").innerHTML = "YOU CLICKED ME!";
}
function myfunction3() {
document.getElementById("demo3").innerHTML= "You Clicked Me";
}
function changeColor() {
document.getElementById("color").style.background = "red";
document.getElementById("color").style.color = "yellow"
}
function bodyColor() {
document.getElementsByTagName("main")[0].style.background = "yellow"
document.getElementsByTagName("main")[0].style.color = "#7c4c23"
document.getElementsByTagName("main")[0].style.fontWeight = "1000"
}
function textCopied() {
document.getElementById("copy").innerHTML = "You Copied Me";
}
function onBlur() {
let x = document.getElementById("fname");
x.value = x.value.toUpperCase();
}
</script>