为什么这不起作用? [英] Why isnt this working?
本文介绍了为什么这不起作用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
<!DOCTYPE html>
< html>
< head>
<!DOCTYPE html>
<html>
<head>
< body>
<body>
< img src =google.png/>
<img src="google.png"/>
< form action = search.cgi>
< input style =width:620px; height:32px;>
< inputwidth:500px; height:20px; type =textname =searchid =tipue_search_inputautocomplete =offrequired>
< / form>
< script LANGUAGE =JavaScript>
功能搜索功能(){
var searching2 = document.getElementByName(search)。value;
if(searching2 =Reuben){
}否则if(search2 =Brayden){
}否则if(searching2 =scrub){
}否则if(searching2 =brayden){
}否则如果(search2 =延迟){
}否则if(searching2 =Retard){
} else if(searching2 =reuben){
}否则if(searching2 =god) ){
}否则if(searching2 =God){
}否则if(searching2 =legend){
}否则{
}
< / script>
<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.pngalt =google Im feel luckysty le = width:250px; height:36px;>
<img src="google Im feeling lucky.png" alt="google Im feeling lucky" style=width:"250px;height:36px;">
< / body>
< / html>
</body>
</html>
推荐答案
请将您的条件运算符更新为像这样:
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.
这篇关于为什么这不起作用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文