---
title: "用onclick代替<a   href=\"index.jsp\"   target=\"_top\">首页</a>"
author: "ydsakyclguozi"
date: "2009-08-03T14:16:14Z"
tags: []
slug: "onclick-a-href-index-jsp-target-top-a"
draft: false
lastmod: "2009-08-03T14:16:14Z"
id: 438521
url: "https://52347.iteye.com/blog/438521"
---

代码如下：
<script>
function index()
{
    parent.location.href="index.jsp"; 
    //用此语句也行top.location.href="index.jsp"; 
}
</script>

<span onclick="index()">首页</span>