Is there a way to accept form input and have the output dumped/printed back to the web page with HTML or JavaScript/AJAX and without PHP/Perl/server-side scripts?
|
|
Off the top of my head, you could do something like...
and then a bit of JavaScript (I'm using jQuery, but I'm sure you can do this with normal JS). This will fire when the form is submitted, creates vars from the values and then output them to the screen (after the bottom of the form)
}); Of course, there are a few things to bear in mind
|
|||
|
|
Displaying form results with HTML and CSS onlyIt's possible to display form results using only HTML and CSS with clever use of the Click for a live demo. (Type in the box in the 'Result' window and click "Submit".)
How it worksYou might be able to understand it from the commented CSS code above, but, in case you want a full explanation, read on. First, the form's submit button has an invisible link above it that we style with CSS:
When the user clicks the "Submit" button, they're actually clicking the invisible link above it; the user never hits the Submit button and the form itself is never submitted. What happens instead is that, when the link over the submit button is clicked, the url changes from And so, when the link is clicked and the user is redirected to #page, we show the 'You typed:' text, hide the submit button, and change the input box styling to show them what they typed. All of this is done using the The CSS rule that looks like Next, the line that looks like Finally, the line that looks like This could be extended with multiple inputs if required, but I've used one to keep it simple. Note that browser support for the CSS |
|||
|