简体   繁体   English

如何在“输入”页面上自动打开模式弹出窗口

[英]How to auto open modal popup on Enter page

Can someone me to open the modal popup when a vistor requests the page for the very first time, a cokie hides it thereafter. 当访问者第一次请求页面时,有人可以让我打开模式弹出窗口吗,可奇会随后将其隐藏。 I need to do a survey. 我需要做一个调查。 They answer one question and are redirected so a close button or submit button is not needed. 他们回答了一个问题并被重定向,因此不需要关闭按钮或提交按钮。 Im using php. 我正在使用PHP。

Thanks for the help. 谢谢您的帮助。 Bruce 布鲁斯

Are you allowed to use jQuery? 您可以使用jQuery吗? I would user jQuery + jQuery-UI (http://jqueryui.com/demos/dialog/) 我会使用jQuery + jQuery-UI(http://jqueryui.com/demos/dialog/)

What you have to do is just define a Div element with the markup of the popup, and then invoke the popup method used by jQuery UI in the document ready event. 您所要做的只是用弹出窗口的标记定义一个Div元素,然后在文档准备事件中调用jQuery UI使用的弹出方法。

eg 例如

$(document).ready(function() {$( "#dialog" ).dialog();});

and

<div id="dialog"> Here goes your survey form</div>

Also it is a good idea to load jQuery and jQuery-UI from a CDN, like google's, use these addresses: 从CDN(例如Google)的CDN加载jQuery和jQuery-UI也是一个好主意,请使用以下地址:

https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js
https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js

Hope this helps 希望这可以帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM