From 1276f026edf4122b682d2fcffc68bc84b24b382a Mon Sep 17 00:00:00 2001 From: Nishant326 Date: Mon, 3 Mar 2025 16:11:29 +0530 Subject: [PATCH] add a project-file university Deletctor --- University-detector/app.js | 135 +++++++++++++++++++++++++++++++++ University-detector/index.html | 37 +++++++++ University-detector/style.css | 67 ++++++++++++++++ 3 files changed, 239 insertions(+) create mode 100644 University-detector/app.js create mode 100644 University-detector/index.html create mode 100644 University-detector/style.css diff --git a/University-detector/app.js b/University-detector/app.js new file mode 100644 index 0000000..bf6922a --- /dev/null +++ b/University-detector/app.js @@ -0,0 +1,135 @@ +// let h1=document.querySelector('h1'); +// let p=document.querySelector('p'); +// let btn=document.querySelector("button"); +// let img=document.querySelector("img"); +// btn.addEventListener('click',async()=>{ +// let randImg=await getFact(); +// console.log(randImg) +// img.setAttribute("src",randImg) +// }) + + +// // let fact = "https://catfact.ninja/fact?max_length=110";// +// let fact="https://dog.ceo/api/breeds/image/random" +// async function getFact(){ +// try{ +// let res=await axios(fact) +// return res.data.message +// } +// catch(er){ +// let noData="noData"; +// return noData + +// } + + +// }; + +// getFact() + + + +// let fact="https://icanhazdadjoke.com/"; + +// async function getData(){ +// try{ +// const config={headers:{Accept:"application/json"}} +// let res=await axios.get(fact,config) +// console.log(res.data.joke) +// } +// catch(er){ +// console.log(er); +// } +// } + +// getData() + + + +//Univercityu detector + +let inp=document.querySelector("input"); +let inpState=document.querySelector("#inp_state"); +let btn=document.querySelector("button"); +let li=document.querySelector("#list"); + +let url="http://universities.hipolabs.com/search?country="; + +btn.addEventListener('click',async()=>{ + let cunName=inp.value; + let stateName=inpState.value; + let res2=await getUnivercity(cunName,stateName); + + + // console.log(res2) + // console.log(stateName) + + listName(res2) + + +}) + + + +async function getUnivercity(cunName,stateName){ + try{ + + let jointUrl=url+cunName+"&name="+stateName; + let res=await axios.get(jointUrl); + + // console.log(jointUrl) + // console.log(url) + // console.log(res) + return res.data + + } + catch(er){ + return er + } + +}; + +// console.log(getUnivercity("india","jharkhand")) + +function listName(arry){ + li.innerText=""; + for(let i=0;i { + // console.log(result); + // return result.json() + + // }) + // .then((data) => { + // console.log("data1:",data.fact) + // return fetch(fact) + // }) + // .then((res) => { + // return res.json() + + // }) + // .then((data) => { + // console.log("data 2:", data.fact) + // }) + // .catch((err) => { + // console.log(err) + // }) \ No newline at end of file diff --git a/University-detector/index.html b/University-detector/index.html new file mode 100644 index 0000000..a2f30d8 --- /dev/null +++ b/University-detector/index.html @@ -0,0 +1,37 @@ + + + + + + + Document + + + + + + + + + + +
+
+

University Detecter

+
+ + + + + +
    +
+ + +
+ + + + + + \ No newline at end of file diff --git a/University-detector/style.css b/University-detector/style.css new file mode 100644 index 0000000..4010e32 --- /dev/null +++ b/University-detector/style.css @@ -0,0 +1,67 @@ + +.body{ + text-align: center; + display: flex; + align-items: center; +} + +.container{ + background-color: rgb(189, 200, 200); + + + width: 50rem; + border-radius:1rem; + margin: 0 auto; + +} +h1{ + font-size: 1.9rem; + font-family: "Poppins", serif; + display: block; + + +} +.hcontaner{ + text-align: center; +} +.inp{ + height: 2rem; + width: 20rem; + background-color:#f0f0f0; + color: #000000; + border-radius: .0.5rem ; + opacity:0.9; + cursor: pointer; + display: block; + margin: 0 auto; + margin-bottom:0.3rem; + + + + +} +.btn{ + background-color:#fff; + height:2rem; + width: 6rem; + border-radius:.0.5rem; + opacity: 0.8; + cursor: pointer; + margin: 0 auto; + display: block; +} +.inp:hover{ + box-shadow: 2px 2px 2px 5px #cdcdcd; + opacity:1; +} +.btn:hover{ + box-shadow:2px 2px 2px 1px #828897; + scale: 0.95; +} + +li{ + margin-top: 10px; + font-family: "Poppins", serif; + + +} \ No newline at end of file