0
所以我編程我的搜索欄,我不知道爲什麼它不工作。我想當用戶鍵入「論壇」它說一條消息,當他們點擊好它將它們發送到論壇,但我正在測試,看看它是否會顯示警報,我不能讓它說什麼。修復我的JavaScript搜索欄
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>website name/slogan</title>
<link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.css" />
<link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.min.css" />
</head>
<body>
<div class="row">
<div class="span12">
<form method="get" action="/" class="form-inline" >
<input name="q" class="span5" id="searchBar" type="text" placeholder="Click below on how to use" />
<button type="submit" id="submit" class="btn btn-primary"> <i class="icon-search icon-white"></i></button>
</form>
</div>
</div>
<script type="text/javascript" src="js/bootstrap.js"></script>
</body>
的Javascript
function myNavSystem() {
var mySearchBar = document.getElementById('searchBar');
if(mySearchBar = "forums")
document.getElementById('submit');
alert("you have tried accessing forums")
else
alert("You have entered invalid text, try again.")
}
And =!== ==;有一個失蹤。值 – bfavaretto 2013-05-04 03:46:26
@bfavaretto我被大括號遮掩了。謝謝。 – Tchoupi 2013-05-04 03:47:15
謝謝,我解決了這個問題。但是,問題仍然存在:( – user2152375 2013-05-04 03:47:28