Click here to Skip to main content
15,065,328 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
<!DOCTYPE html>
<html>
<head>



<body>




<img src="google.png"/>








<form action="search.cgi">
<input style="width:620px;height:32px;>
<input "width:500px;height:20px;" type="text" name="search" id="tipue_search_input" autocomplete="off" required>
</form>

<script LANGUAGE="JavaScript">



funtion searchfunction() {
var searching2 = document.getElementByName ("search").value;
if (searching2 = "Reuben") {

} else if (searching2="Brayden") {

} else if (searching2="scrub") {

} else if (searching2="brayden") {

} else if (searching2="retard") {

} else if (searching2="Retard") {

} else if (searching2="reuben") {

} else if (searching2="god") {

} else if (searching2="God") {

} else if (searching2="legend") {

} else {

}

</script>




<img src="google Im feeling lucky.png" alt="google Im feeling lucky" style=width:"250px;height:36px;">


</body>
</html>
Posted
Comments
ZurdoDev 25-Jan-16 16:11pm
   
And what should happen?
Member 12286745 25-Jan-16 16:23pm
   
When you type one of the many things such as "Brayden" or "Reuben" it should go to one of the pages such as "godpg1.html"
ZurdoDev 25-Jan-16 16:25pm
   
Use the developer tools in the browser and debug it and you'll see very quickly what is happening.

1 solution

Please update your conditional operators to be like this:

} else if (searching2==="Brayden") {


instead of this:

} else if (searching2="Brayden") {



A single "=" is an assignment operator - it is not a conditional operator.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900