SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Create dynamic pages and buttons on the new page

    Hi All,

    i am newbie to javascript. i have a developed some static pages (around 140) of them which basically is used like a quesstionare or a workflow. If the user answers yes or no then another page opens up bases on the input given by the user.

    Now my people want just a single page instead of all the 140 since it takes a lot of space on the server. presently this is still not hosted on the server. Is it possible to embed all of them into one page by writing different functions? i did try and it gives me the next questions by creating a dynamic page but when the yes and no button do not populate. is it possible?

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,700
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Combining all or most pages into a single page is likely to not save much space, while the tradeoff is that maintaining the code is likely to become more difficult to maintain. This can depend on how you code the dynamic page.

    If you have some examples that demonstrate how the existing page works, it should be possible for us to provide advice on how to proceed.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Frankly i am not aware of how to code dynamic page. What i present here is the code sample of the static page that is created. As already told i am very new to this scripting and any errors please enlighten me the same. similar code is there is all other pages. What we wish to do is instead of creating so many pages is it possible to do it in one?
    <head>
    <link href="default.css" rel="stylesheet" type="text/css" media="screen" />
    <script language="javascript">
    {
    window.name="Q1";
    function yes()
    {
    window.open('1Q1YQ2.html','Q1');
    }
    function no()
    {
    window.open('Q1nQ2.html','Q1');
    }

    }
    </script>

    </head>
    <body >
    <div id="wrapper">
    <!-- start header -->
    <div id="header-wrapper">
    <div id="header">
    <div id="logo">
    <h1><span>MasterCard Work Flow</span></h1>
    </div>
    </div>
    </div>
    <div id="menu-wrapper">
    <div id="menu">
    <ul id="main">
    <li class="current_page_item"><a href="home.html">Homepage</a></li>
    <li><a href="start.html">Start</a></li>
    <li><a href="Q1.html">Questions Home</a></li>
    </ul>
    </div>
    </div>
    <!-- end header -->
    <div id="page">
    <div id="page-bgtop">
    <div id="page-bgbtm">
    <div id="sidebar1" class="sidebar">
    <ul>
    <li>
    <h2><u>Timeline</u></h2>
    <ul>
    </ul>
    </li>
    </ul>
    </div>
    <FORM name="form1" method="POST">
    <div id="content">
    <h1> Q1 :Ask : Did the customer authorise the transaction?</h1><br />
    <input type="button" value="yes" onclick = "yes()"> <input type="button" value="no" onclick = "no()">
    </div>
    </FORM>
    </body>
    </html>

  4. #4
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,700
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    I would suggest using an accordion type of design.

    This is where all of the forms are on the one page, and they are then all hidden except for the first form.

    When each button is pressed, you hide all of the forms and then reveal the next one that should be shown.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  5. #5
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thank you for your reply but i am not aware of the accordion design. can you please eloborate or suggest me a reading material like a site so as to have a better understanding of the same.

  6. #6
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,700
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    If you're considering using jQuery, they have a robust accordion that's easy to code with.
    http://docs.jquery.com/UI/API/1.7.2/Accordion

    If you want to mix your own, there are tutorials out there all about them.
    http://tutorialblog.org/10-javascrip...rdion-scripts/

    However, if you don't want the sliding aspect, or a menu bar for each section, you can just use javascript to hide the old menu and reveal the new one.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  7. #7
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi it really helps ur links... thanks a lot.. just a quick one.. what is the command to hide and reveal menu or sliding bar... if u can let me know it will help me out a lot and save a lot of time

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,700
    Mentioned
    101 Post(s)
    Tagged
    4 Thread(s)
    Are you using a scripting library such as jQuery?
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Member
    Join Date
    Dec 2009
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi
    sorry for my late reply. i am was stuck with some problem. I am using the accordion as u suggested in the last post. Here i dont want the other options to be visible until i called them for.
    Attached Files Attached Files
    Last edited by sunilvedula; Dec 14, 2009 at 00:23. Reason: want to attach an attachment


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •