0

I'm looking to make a simple web page (mainly used on the local machine) that would just be a single file (such as htm or html) but would dynamically change based on the url.

For example, if I went to 'file:///C:/Sandbox/test.htm' it might display the following...

Hello World

But if I went to 'file:///C:/Sandbox/test.htm?page=2' it might display the following...

You are visiting my second page!

I know I can do this type of thing with PHP or ASP but is it possible to do it with HTML or javascript or anything "native" to the browser yet?

Thanks in advance for the help!

4

1 回答 1

4

客户端 javascript 可以知道 URL 上的查询字符串。在 javascript 中,可以通过location.search.

您可以根据查询字符串中的信息让您的 javscript 显示和隐藏页面的不同部分。

于 2013-07-27T10:53:56.867 回答