首页 > 代码库 > 使用target属性跳转到指定位置

使用target属性跳转到指定位置

先上代码,使用frameset将网页分割为三个窗口,上,左和右。

  1 <html>  2 <head>  3     <title>Main</title>  4     <meta content = ‘text/html‘; charset = ‘utf-8‘>  5 </head>  6 <frameset rows = ‘15%, *‘>  7     <frame src = ‘top.html‘>  8     <frameset cols = ‘35%, *‘>  9         <frame src = ‘left.html‘> 10         <frame src = ‘right.html‘ name = ‘right‘> 11     </frameset> 12 </frameset> 13 </html>

效果如下:

 

现在想让Lookup the information of leaguer在右下角的窗口中打开,可以使用target属性。做法是在右下角的页面布局语句中加入name属性用来标记跳转的位置,见上述代码第10行。同时在链接标签中设置target = ‘right‘即可。完整代码如下:

  1 <html>  2 <head>  3     <title>Left</title>  4 </head>  5 <body bgcolor = ‘grey‘>  6 <div align = ‘center‘>  7 <h2><a href = ‘lookLeaguer.html‘ target = ‘right‘>Lookup the information of leaguer</a></h2>  8 <h2><a href = ‘modifyLeaguer.html‘ target = ‘right‘>Modify the information of leaguer</a></h2>  9 <h2><a href = ‘deleteLeaguer.html‘ target = ‘right‘>Delete the information of leaguer</a></h2> 10 </div> 11 </body> 12 </html>

 

使用target属性跳转到指定位置