Thanks Rob,
I think thats exactly what was/is needed. Its real
simple and easy to modify.
> BTW, this is not PHP,
Never said it was, didnt you notice my off topic (O.T)
in the subject? Theres enough spam on the list and I
didnt want to offend anyone so made sure I put it
there.
Will come back if I face problems, thanks for your
help once again.
Cheers!
Ryan
--- Robert Cummings <[EMAIL PROTECTED]> wrote:
> On Fri, 2006-08-18 at 08:30 -0700, Ryan A wrote:
> > Hello,
> > I am working on a php project that needs a little
> > extra JS/DHTML solution. I am sure some of you
> might
> > have come to use something like this before,
> please
> > recommend a solution (commerial solutions are fine
> /
> > willing to pay)
> >
> > Basically, I will have a page with around 10
> questions
> > for students and then two buttons for [HINT] and
> > [SOLUTION]
> >
> > When either of these buttons/text is clicked the
> > resulting text should be displayed in the
> side/bottom
> > cell, the user should also be able to 'close' this
> > resulting explanation.
> >
> > Note, on each page there will be around 10
> questions,
> > so each of these questions will have a hint &
> solution
> > button/text.
>
> Will you have two buttons for each question? So that
> you get the
> hint/solution on a question by question basis? The
> solution is quite
> simple:
>
> <html>
> <head>
> <script language="javascript"
> type="text/javascript">
>
> var hints = new Array();
> hints[1] = 'Hint for question 1';
> hints[2] = 'Hint for question 2';
> hints[3] = 'Hint for question 3';
> hints[4] = 'Hint for question 4';
> //...
>
> var solutions = new Array();
> solutions[1] = 'Solution for question 1';
> solutions[2] = 'Solution for question 2';
> solutions[3] = 'Solution for question 3';
> solutions[4] = 'Solution for question 4';
> //...
>
> function showHint( id )
> {
> hideSolution();
>
> var h = document.getElementById(
> 'questionHint' );
> h.innerHTML = hints[id];
> h.style.display = '';
> }
>
> function hideHint()
> {
> var h = document.getElementById(
> 'questionHint' );
> h.style.display = 'none';
> }
>
> function showSolution( id )
> {
> hideHint();
>
> var s = document.getElementById(
> 'questionSolution' );
> s.innerHTML = solutions[id];
> s.style.display = '';
> }
>
> function hideSolution()
> {
> var s = document.getElementById(
> 'questionSolution' );
> s.style.display = 'none';
> }
> </script>
> </head>
> <body>
> <p>blah blah blah blah blah blah</p>
>
> <p>
> Question 1 ...
> <input type="submit" value="Get Hint"
> onclick="showHint( 1 ); return
> false;" />
> <input type="submit" value="Get Solution"
> onclick="showSolution( 1 );
> return false;" />
> </p>
> <p>
> Question 2 ...
> <input type="submit" value="Get Hint"
> onclick="showHint( 2 ); return
> false;" />
> <input type="submit" value="Get Solution"
> onclick="showSolution( 2 );
> return false;" />
> </p>
> <p>
> Question 3 ...
> <input type="submit" value="Get Hint"
> onclick="showHint( 3 ); return
> false;" />
> <input type="submit" value="Get Solution"
> onclick="showSolution( 3 );
> return false;" />
> </p>
> <p>
> Question 4 ...
> <input type="submit" value="Get Hint"
> onclick="showHint( 4 ); return
> false;" />
> <input type="submit" value="Get Solution"
> onclick="showSolution( 4 );
> return false;" />
> </p>
> <p>...</p>
>
> <p id="questionHint" style="display: none;">
> </p>
>
> <p id="questionSolution" style="display: none;">
> </p>
>
> </body>
> </html>
>
>
> I'll leave it to you as an exercise to adapt it
> properly in PHP using
> variables and loops instead of harded coded content
> :) BTW, this is not
> PHP, but I'm feeling benevolent today ;)
>
> Cheers,
> Rob.
> --
>
.------------------------------------------------------------.
> | InterJinn Application Framework -
> http://www.interjinn.com |
>
:------------------------------------------------------------:
> | An application and templating framework for PHP.
> Boasting |
> | a powerful, scalable system for accessing system
> services |
> | such as forms, properties, sessions, and caches.
> InterJinn |
> | also provides an extremely flexible architecture
> for |
> | creating re-usable components quickly and easily.
> |
>
`------------------------------------------------------------'
>
>
------
- The faulty interface lies between the chair and the keyboard.
- Creativity is great, but plagiarism is faster!
- Smile, everyone loves a moron. :-)
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php