Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/441.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何在调查中开发子页面?_Php_Javascript_Jquery_Ajax - Fatal编程技术网

Php 如何在调查中开发子页面?

Php 如何在调查中开发子页面?,php,javascript,jquery,ajax,Php,Javascript,Jquery,Ajax,假设我想在网上创建一个调查页面,我想让每个页面都包含许多问题,但我有一个问题。 我不想创建大约3或4个分开的页面,然后使用“下一步”按钮打开另一个页面。 关于如何实现这一点,我已经没有什么想法了 <pre> <!doctype html> <html> <head> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.

假设我想在网上创建一个调查页面,我想让每个页面都包含许多问题,但我有一个问题。 我不想创建大约3或4个分开的页面,然后使用“下一步”按钮打开另一个页面。 关于如何实现这一点,我已经没有什么想法了

<pre> <!doctype html>
      <html>
      <head>
       <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js">   </script>
    <script>
$(document).ready(function(){

    jQuery(document).ready(function(){
        jQuery('#hideshow').live('click', function(event) {        
             jQuery('#content').toggle('show');
        });
    })

});
</script>
    </head>
    <body>
    <script> 
    function show() { 
    if(document.getElementById('benefits').style.display=='none') { 
        document.getElementById('benefits').style.display='block'; 
    } 
    return false;
} 
function hide() { 
    if(document.getElementById('benefits').style.display=='block') { 
        document.getElementById('benefits').style.display='none'; 
    } 
    return false;
}   
 </script> 


  <div id="opener"><a href="#1" name="1" onclick="return show();">click here</a></div> 
   <div id="benefits" style="display:none;">some input in here plus the close button 
       <div id="upbutton"><a onclick="return hide();">click here</a></div> 
  </div> 
 </body> 
 </html> <code>

你可以考虑使用MySQL数据库和问题表,这样你就可以动态地将它们加载到页面中。这将允许您创建一个页面模板,并从questions表中动态请求页面id以加载属于该页面的所有问题


如果你无法访问PHP或MySQL,并且想坚持jQuery/JavaScript,你可以考虑建立一个JSON数据库,只需要使用Ajax来加载问题。去吧!您可以尝试使用ajax,其中将调用onclick的next按钮函数,并在其中发出ajax请求。这些ajax响应将包含从数据库中提取的问题。