请问这段代码怎么写

来源:百度知道 编辑:UC知道 时间:2024/05/15 04:28:05
<script language="javascript">
if(location.toString().indexOf("aaa")!= -1)
{
location.href="http://aaa/"
}
</script>

现在是包含aaa就跳转到http://aaa/
我想修改成只有等于aaa的时候才跳转到http://aaa/

请问怎样修改

谢谢

if(location.toString()=="aaa")

if(location.toString().indexOf("http://aaa")!= -1)

如果你的网站是动态的 就要涉及到一个读数据库的问题 比如一篇文章标题中有aaa你先通过查找还有aaa的数据库表标题 然后再用你上边的跳转代码 ,如果是静态的 我还没有考虑过 抱歉