Automagic上一页/下一页链接 [英] Automagic Previous / Next Links

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

问题描述

我做了一个网站,我在每个页面的底部都有一个上一个和下一个链接

。它看起来像是:


< p>< a href =" foo01.html"> Previous< / a> | < a href =" foo03.html"> Next< / a>< / p>


看到他们总是按顺序排列,有没有办法使用JS自动转到上一个文件或下一个文件?


Ian

-
< a rel =nofollowhref =http://sundry.wstarget =_ blank> http://sundry.ws

I do a site where I have a previous and next link at the bottom of
every page. It looks like:

<p><a href="foo01.html">Previous</a> | <a href="foo03.html">Next</a></p>

Seeing as they''re always in sequential order, is there a way to
automagically go to the previous file or the next file using JS?

Ian
--
http://sundry.ws

推荐答案

Ian Rastall于2006年18月18日在comp.lang.javascript中写道
Ian Rastall wrote on 18 mrt 2006 in comp.lang.javascript:
我做了一个网站,我有一个上一个和下一个链接在每页的底部。它看起来像:

< p>< a href =" foo01.html"> Previous< / a> | < a href =" foo03.html"> Next< / a>< / p>

看到他们总是按顺序排列,有没有办法
使用JS自动转到上一个文件或下一个文件?
I do a site where I have a previous and next link at the bottom of
every page. It looks like:

<p><a href="foo01.html">Previous</a> | <a href="foo03.html">Next</a></p>

Seeing as they''re always in sequential order, is there a way to
automagically go to the previous file or the next file using JS?




使用服务器端J(ava)脚本/ ASP:


<%@ language =" jscript"%>

<%

thisOne = request.servervariables(''SCRIPT_NAME'')

thisNumber = + thisOne.replace(/.*?\ // g,'''')。replace(/ \D + / g,'''')


nextNumber = ++ thisnumber

if(nextNumber< 0 || nextNumber> 99)nextNumber = 0

nextNumber =(nextNumber< 10)?''0' '+ nextNumber:nextNumber


//对于lastNumber大致相同


%>


< a href =" foo<%= lastNumber%> .html">上一页< / a> |

< a href =" foo<%= nextNumber%> .html"> Next< / a>


未经测试


-

Evertjan。

荷兰。

(请将x''改为我的电子邮件中的点)



Using serverside J(ava)script/ASP:

<%@ language="jscript"%>
<%
thisOne = request.servervariables(''SCRIPT_NAME'')
thisNumber = +thisOne.replace(/.*?\//g,'''').replace(/\D+/g,'''')

nextNumber = ++thisnumber
if(nextNumber<0||nextNumber>99)nextNumber=0
nextNumber = (nextNumber<10)?''0''+nextNumber:nextNumber

//about the same for lastNumber

%>

<a href="foo<%=lastNumber%>.html">Previous</a> |
<a href="foo<%=nextNumber%>.html">Next</a>

Not tested

--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


Evertjan。写道:
Evertjan. wrote:
使用serverside J(ava)脚本/ ASP:
Using serverside J(ava)script/ASP:




你好Evertjan。我从来没有使用过服务器端的JS,也不知道是否
AffordableHost使用它。 (我不得不问。)两个问题:


1.是否需要我更改扩展名?

2.可以完成吗客户端?


我要做的是让每一页尽可能接近

。我现在正在处理超过2,500个文件,并且手工执行这些文件




我想知道预处理器是否可行,但是''一个问题

CIWAH,我想。


Ian

-
http://sundry.ws


Ian Rastall写道:
Ian Rastall wrote:
Evertjan。写道:
Evertjan. wrote:
使用serverside J(ava)脚本/ ASP:
Using serverside J(ava)script/ASP:


1.是否需要我更改扩展名?


这取决于主机

2.可以在客户端完成吗?


如果客户端脚本不可用或关闭它会破坏

(这涵盖了大量用户和所有主要搜索引擎

索引器)。

我想知道预处理器是否可行,


可能

但这是一个问题对于CIWAH,我想。

1. Would it require me to change the extensions?
That depends on the host
2. Can it be done client-side?
Then it would break if client side scripting was unavailable or turned off
(this covers a significant number of users and all major search engine
indexers).
I wonder if a preprocessor would work,
Probably
but that''s a question for CIWAH, I imagine.




你可以在JavaScript中写一个:)


-

David Dorward< http://blog.dorward.me.uk/> < http://dorward.me.uk/>

首页是〜/ .bashrc的位置



You could write one in JavaScript :)

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is


这篇关于Automagic上一页/下一页链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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