Discuss Scratch

DeleteThisAcount
Scratcher
1000+ posts

i need some help with html and js

i need help with a code that basicly is a textbox that when you type a scratch username and click submit button it takes you to a scratch profile that you typed.

who exactly would you do that? my code so far:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>scratch user finder</title>
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
</head>
<body>
<div class="w3-container w3-teal">
<h1 class="w3-center w3-animate-top"> Scratch User Finder</h1>
</div>
<div class="w3-container w3-animate-left">
Ever been too hard to change a few letters in a scratch URL to go to a different account?
<br><br>
Well than this is for you! Type in the user you want to find below:
</div>
<input type="text" id="mytextbox" value="deletethisacount" />
<button onclick="gotoUser()">submit</button>
<script>var textbox = document.getElementById('mytextbox');</script>
<script>
function gotoUser() {
window.location.replace(textbox.value)
}
</script>
</body>
</html>
right now it redirects you to (thesite)/username but how would i specify that I want it to redirect to https://scratch.mit.edu/users/username

Last edited by DeleteThisAcount (April 11, 2018 18:00:19)




DeleteThisAcount
Scratcher
1000+ posts

i need some help with html and js

:O i created something that works!

reporting this to be closed

Last edited by DeleteThisAcount (April 11, 2018 18:04:00)




bybb
Scratcher
1000+ posts

i need some help with html and js

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>scratch user finder</title>
  <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
</head>
<body>
<div class="w3-container w3-teal">
  <h1 class="w3-center w3-animate-top"> Scratch User Finder</h1>
</div>
<div class="w3-container w3-animate-left">
Ever been too hard to change a few letters in a scratch URL to go to a different account?
<br><br>
Well than this is for you! Type in the user you want to find below:
</div>
<input type="text" id="mytextbox" value="deletethisacount" />
<button onclick="gotoUser()">submit</button>
<script>var textbox = document.getElementById('mytextbox');</script>
<script>
function gotoUser() {
window.location.replace("https://scratch.mit.edu/users/" + textbox.value)
}
</script>
</body>
</html>

Game Over
You'll find me on @LastContinue from now on.
DeleteThisAcount
Scratcher
1000+ posts

i need some help with html and js

bybb wrote:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>scratch user finder</title>
  <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
</head>
<body>
<div class="w3-container w3-teal">
  <h1 class="w3-center w3-animate-top"> Scratch User Finder</h1>
</div>
<div class="w3-container w3-animate-left">
Ever been too hard to change a few letters in a scratch URL to go to a different account?
<br><br>
Well than this is for you! Type in the user you want to find below:
</div>
<input type="text" id="mytextbox" value="deletethisacount" />
<button onclick="gotoUser()">submit</button>
<script>var textbox = document.getElementById('mytextbox');</script>
<script>
function gotoUser() {
window.location.replace("https://scratch.mit.edu/users/" + textbox.value)
}
</script>
</body>
</html>
i finshed it already



Powered by DjangoBB