HTML 5页面导航 [英] HTML 5 page navigation

查看:74
本文介绍了HTML 5页面导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在不使用任何服务器端脚本语言的情况下,在HTML5网页之间导航的首选方式是什么? Jquery会是一个不错的选择吗?



考虑用户登录并登陆主页。主页包含许多导航到其他页面的链接。

编辑1

我需要通过AJAX与服务器通信以执行一些操作操作并在网页之间传递变量和数据。但我无法动态地使用JSP或PHP来创建HTML。

解决方案

HTML

 < NAV> 
< a href =index.html>索引< / a>
< a href =contact.html>联络人< / a>
< / nav>
< section id =content>< / section>

jQuery

 <$ ('click',function(e){
var htmlFile = $(this).attr('href' );
e.preventDefault();
$('#content')。load(htmlFile);
});
});


What is the preferred way to navigate between HTML5 web pages without using any server side scripting language. Would Jquery be a good choice?

Consider a user logs in and lands at home page. Home page contains many links to navigate to other pages.

Edit 1

I need to communicate to server via AJAX to perform some operations and pass on variables and data between web pages. But I cannot use JSP or PHP to create HTML dynamically.

解决方案

HTML

<nav>
  <a href="index.html">Index</a>
  <a href="contact.html">Contact</a>
</nav>
<section id="content"></section>

jQuery

$(function(){
  $('nav a').on('click', function(e) {
    var htmlFile = $(this).attr('href');
    e.preventDefault();
    $('#content').load(htmlFile);
  });
});

这篇关于HTML 5页面导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆