- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
所以你给我的所有东西都很有效,谢谢。添加了你们给我的东西后,我添加了我需要的其余东西,但现在它不起作用了。请帮忙。
<h2 style="font-size:16px !important">Did You Know?</h2>
<p style="float:right;" id="dyk"></p>
<body onload="myFunction()">
<script>
function myFunction()
{
var x=document.getElementById("dyk")
var myTips=new Array();
myTips[1]="bob products have an average rating of 4.8 out of 5 stars. <a href="http://www.bob .com/us/en/home/products/complete#reviewTabs">Take a look!</a>";
myTips[2]="You can get free stuff by posting on the community! Check out our <a href="https://community.bob .com/t5/Community-Announcements/Announcing-the-bob -VIP-Program/m- p/20652#M119">VIP Program!</a>";
myTips[3]="We want to know what you think! Would you like to <a href="http://www.bob .com/En_US/bv.html? utm_source=community&utm_medium=dyk&utm_campaign=dyk">write a review?</a>";
myTips[4]="bob is a member of the <a href="http://www.antispywarecoalition.org/">Anti- Spyware Coalition</a>, a group dedicated to controlling spyware and other potentially unwanted technologies.";
myTips[5]="bob products are all fully compatible with Windows 8.";
myTips[6]="<a href="http://www.bob .com/us/en/home/products/complete? utm_source=community&utm_medium=dyk&utm_campaign=dyk">bob bob Complete</a> offers 25 GB of storage and password management in addition to protection from viruses and other threats.";
myTips[7]="PCWorld called bob mobile protection 'the fastest-rising wireless security star.'";
myTips[8]="<a href="http://www.bob .com/us/en/home/products/trials? utm_source=community&utm_medium=dyk&utm_campaign=dyk">bob bob </a> is always up to date and works quietly in the background and out of your way.";
myTips[9]="Need help setting up bob bob ? Check out our instructional videos on <a href="http://www.youtube.com/playlist?list=bob ">the **bob ** YouTube channel.</a>";
myTips[10]="You can subscribe to a forum by visiting the forum, clicking 'options, and clicking 'subscribe.'";
myTips[11]="You can subscribe to a topic by viewing the topic, clicking 'options, and clicking 'subscribe.'";
myTips[12]="Don't post your keycode in public. Sending it to a bob employee via a private message is ok, but nobody else!";
myTips[13]="You can send a user a private message by clicking on their username and then clicking 'send this user a private message.'";
myTips[14]="You can read the Community Guidelines by clicking <a href="https://community.bob .com/t5/Community-Announcements/bob -Community-Guidelines/m- p/2#M826">here</a>. Please read them!";
myTips[15]="Notification settings are adjustable within your profile settings.";
myTips[16]="bob was founded in 1997 by the late Steven Thomas. His work is carried on today by his sister, Anna, who is a member of <a href="https://community.bob .com/t5/custom/page/page-id/meet-the-community-team">our social media team</a>.";
myTips[17]="You can <a href="http://www.bob .com/us/en/home/products/trials? utm_source=community&utm_medium=dyk&utm_campaign=dyk">try bob for free</a> on your PC and/or Mac. And on mobile devices, we have free offerings for both <a href="https://play.google.com/store/apps/details?id=com.bob .security">Android</a> and <a href="https://itunes.apple.com/us/app/bob -bob -browser/id460986853?mt=8">iOS.</a>";
myTips[18]="Are you an IT person at a business? Try <a href="http://www.bob .com/us/en/business/?sc=701F0000000dwMR&utm_source=community&utm_medium=dyk&utm_campaign=dyk">bob business solutions</a> for free. They are guaranteed to work alongside your current solution.";
myTips[19]="bob intelligence network determines over 200,000 files per day.";
myTips[20]="<a href="http://www.bob .com/customerSupport/trialRegistration.php?trpd=WSAB&loc=USA&sc=701F0000000dRvA&utm_source=community&utm_medium=rail&utm_campaign=trial">bob bob </a> will run on Citrix XenApp servers.";
myTips[21]="Each year, bob ";
myTips[22]="bob is headquartered in bob , CO but has offices all over the world.";
myTips[23]="bob won an <a href="http://www.bob.com/us/en/company/press-room/reviews-awards/?utm_source=community&utm_medium=dyk&utm_campaign=dyk">Edison Award</a> for innovation in business.";
myTips[24]="PC Magazine has awarded bob<a href="http://www.bob.com/us/en/company/press- room/reviews-awards/?utm_source=community&utm_medium=dyk&utm_campaign=dyk">'Editor’s Choice,'</a> 12 times.";
myTips[25]="bob protects over 30 million users.";
myTips[26]="Mac’s aren’t invincible. You can <a href="http://www.bob.com/us/en/home/products/mac?utm_source=community&utm_medium=dyk&utm_campaign=dyk">protect your Mac</a> with bob.";
myTips[27]="bobis <a href="http://www.bob.com/us/en/partners/?utm_source=community&utm_medium=dyk&utm_campaign=dyk">partnered with Facebook</a> to protect its users against malicious URL’s.";
myTips[28]="bobprovides the best support in the industry, bar none. We have a 95% customer satisfaction score.";
myTips[29]="bobhas a team of 10 bloggers on the <a href="http://blog.bob.com/?utm_source=community&utm_medium=dyk&utm_campaign=dyk">bobThreat Blog</a>, and we post a new blog usually at least 5 times per week.";
myTips[30]="bob has over 10,000 Twitter followers. Follow us <a href="http://twitter.com/bob?utm_source=community&utm_medium=dyk&utm_campaign=dyk">@bob</a>! ";
var rand = Math.floor((Math.random()*29)+1);
x.innerHTML = myTips[rand]; }
</script>
此时如果您运行它将不会在页面上提供任何输出。为什么??
最佳答案
试试这个:
x.innerHTML=myTips[Math.floor(Math.random()*3)];
关于javascript - HTML 或 Javascript 中的随机数生成器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17869994/
我编写了一个函数来随机从 [-10,10] 中获取一对。 import System.Random main = do { s State g a randomSt = S
好的,我了解如何在 Scala 中实现随机数生成器以及如何设置生成的随机数的上限,但我对如何更改下限感到困惑。例如: var computerGuess= scala.util.Random
我写了一个函数来从 [-10,10] 中随机得到一对。 import System.Random main = do { s State g a randomSt = St
很难说出这里要问什么。这个问题模棱两可、含糊不清、不完整、过于宽泛或夸夸其谈,无法以目前的形式得到合理的回答。如需帮助澄清此问题以便重新打开,visit the help center . 关闭 1
我正在做一个项目,我需要在其中生成 8 个随机数。由于某种原因,我遇到随机数部分非常耗时的问题。 8 个随机数的意思是我需要一个由数字 0-9 组成的 8 个字符长的字符串。例如 01234567 或
这个问题已经有答案了: Why do I always get the same sequence of random numbers with rand()? (12 个回答) 已关闭 9 年前。
我看到这个问题可能已经在这里得到回答:Random using WELL512 但是,它对用户不太友好,也没有提供如何在“真实世界”的代码片段中使用它的示例。 这是我目前拥有的: #define m
我想知道是否有人可以为我澄清这一行。 Create a function die(x) which rolls a die x times keeping track of how many time
我正在制作一款有 6 名防守球员的足球比赛。我将这段代码设置为随机让他们都向四分卫移动。 我想知道是否有更好的方法来做到这一点。我知道必须有一种方法可以在没有这么多 if 语句的情况下循环它,但我对
在以下位置:http://www.fredosaurus.com/notes-cpp/misc/random.html 它提到如果我们想生成一个1-10范围内的随机数,我们可以这样做: r = (ra
如何在 Linux 和 C++ 中使用随机数? 我找到了一些我想使用的代码,它有一行 srand((unsigned)time(0));//seed 但是 gcc 说 board.cpp:94:24:
这个问题在这里已经有了答案: Generating random whole numbers in JavaScript in a specific range (40 个答案) 关闭 9 年前。
我有以下脚本: Timer=0; function countdown(auctionid){ var auctions; var divs; Timer=Timer+1;
利用oracle的dbms_random包结合rownum来实现,示例如下,随机取499户: select * from ( select * from busi.t_ar_
我需要获取随机数,但它不应该等于之前的数字。这是我的一段代码。但这不起作用。 function getNumber(){ var min = 0; var max = 4; var i;
我对 Haskell 还很陌生。我有一个数据类型: data Sentence= Prop Int | No Sentence | And [Sentence]
已关闭。这个问题是 not reproducible or was caused by typos 。目前不接受答案。 这个问题是由拼写错误或无法再重现的问题引起的。虽然类似的问题可能是 on-top
这个问题已经有答案了: How do I generate random integers within a specific range in Java? (73 个回答) 已关闭 7 年前。
function getRandomArbitrary(min, max) { var r = Math.floor(Math.random() * (max - min + 1) + m
这个问题在这里已经有了答案: 关闭 10 年前。 Possible Duplicate: Generate random number with non-uniform density 我尝试识别/
我是一名优秀的程序员,十分优秀!