本文介绍了用于Qualtrics的Javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我需要一些Javascript的帮助。我希望在Qualtrics上显示两个图像但延迟5秒后。I need help with a little Javascript. I want to display two images on Qualtrics but after a 5 second delay.为了更清楚,Image2应该在显示Image1 5秒后显示。To be more clear, Image2 should display after 5 seconds of Image1 being displayed.Qualtrics.SurveyEngine.addOnload(function(){ /*Place Your Javascript Below This Line*/});推荐答案这是对Qualtrics网站上的计时器的修改:This is a modification of the timer on the Qualtrics site: http://www.qualtrics.com/university/researchsuite/coders-corner/html-and-css#displaytimer一些注释: 我不确定你是否想让第一张图像消失第二个出现,但这是你用这个JavaScript获得的行为。 我离开倒计时只是为了说明之间的关系时间和图像出现和消失。 以防万一并不完全清楚。我使用的图像代码必须由您从自己的Qualtrics图像库中获得的链接替换。因此,img src =https://yourorghere.qualtrics.com/CP ...将被Qualtrics的贵组织网址所取代这是CSS:.pic2 { display: none;} 图片1: 这是html:Image 1:This is the html:Time: <span id="time1">30</span><br><img src="https://yourorghere.qualtrics.com/CP/Graphic.php?IM=IM_bCpAC12YW14vbtq" style="width: 133px; height: 115px;" class='pic1' />添加此javascript替换默认的Qualtrics JavaScript:Add this javascript replacing the default Qualtrics JavaScript:started = false;function countDown1() { if (!started) started = true; else { var value1 = parseInt($('time1').innerHTML); $('time1').innerHTML = value1 - 1; if (value1 == 26) { var styling1 = document.getElementsByClassName('pic1')[0]; styling1.style.display = "none"; } } setTimeout(countDown1, 1000);}Event.observe(window, 'load', countDown1); 图片2: 这是html:Image 2:This is the html:Time: <span id="time2">30</span><br><img src="https://yourorghere.qualtrics.com/CP/Graphic.php?IM=IM_4Vjre9FrrbA828s" style="width: 117px; height: 107px;" class='pic2' />替换默认Qualtrics JavaScript的JavaScript:The JavaScript that replaces the default Qualtrics JavaScript:started = false;function countDown2() { if (!started) started = true; else { var value2 = parseInt($('time2').innerHTML); $('time2').innerHTML = value2 - 1; if (value2 == 25) { var styling2 = document.getElementsByClassName('pic2')[0]; styling2.style.display = "block"; } } setTimeout(countDown2, 1000);}Event.observe(window, 'load', countDown2); 这篇关于用于Qualtrics的Javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 06-20 19:38