单击转到随机URL [英] On Click go to Random Url

查看:92
本文介绍了单击转到随机URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的网站导航中,我不想在点击链接时转到指定的网址,而是希望将用户定向到我的网站中从定义的网页列表中选择的随机页面。有没有一种简单的方法可以使用表达式来实现这一点? 

In my website navigation, rather than going to a specified url upon clicking a link, I would like the user to be directed to a random page in my site selected from a defined list of pages. Is there an easy way to do this using Expressions? 

我见过一些使用javascript的解决方案,其中包含脚本中嵌入的url列表,但是为了便于更新,我希望在txt文件中有一个列表或类似的东西。 

I've seen some solutions that use javascript with a list of urls embedded in the script, but to allow for ease of updating, I would prefer to have a list in a txt file or something like that. 

你能不能请求帮助,这已经破坏了我的头,是我最后的绊脚石之一! !

Could you please help, this has been wrecking my head and is one of my last stumbling blocks!!

 

推荐答案

你将不得不使用具有能够随机化列表然后从该列表中选择,而HTML则不然。 (实际上,它更像是将单个索引值指针随机化为一个数组,但你明白了。)为了你的目的,
意味着javascript。没有非动态技术可以帮助你。

You're going to have to use something that has the ability to randomize a list and then select from that list, and HTML does not. (Actually, it's more like randomizing a single index value pointer into an array, but you get the idea.) For your purposes, that means javascript. No non-dynamic technology will do the job for you.

坦率地说,我没有看到问题所在。 Javascript文件只是带有js扩展名的文本文件,因此修改URL列表在js文件中与在文本文件中没有区别。

Frankly, I don't see the problem. Javascript files are nothing but text files with a js extension, so modifying the list of URLs is no different in a js file than in a text file.

欢呼,

scott

cheers,
scott


这篇关于单击转到随机URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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