Stupid Web Tricks: Dynamic content
Takeaway: Dynamic content is useful in many places, like questionnaires. Learn to build dynamic content that bases future questions on past answers.
Click here for our complete list of Stupid Web Tricks.
One of the goofiest things about Web-based questionnaires is that, on most of them, the questions are totally unrelated to one another. One example of this goofiness is medical questionnaires—how can they ask me my gender on question three and then on line twenty-three, ask if I'm pregnant or might be pregnant? What these questionnaires need is a way to base future questions on past results.
The solution that I came up with uses a combination of Cascading Style Sheets, JavaScript, and the HTML DOM. There is a style property called display, which can be used to change the style display property of an HTML element. Set the display property to None and the element disappears, leaving only a memory; set the property to Inline, and it's back.
The example in Listing A illustrates some of the ways that the display property can be used to avoid those embarrassing questions. Elements are displayed, or not, based upon the client’s input.
Click here to see it in action.
Print/View all Posts Comments on this article
SponsoredWhite Papers, Webcasts, and Downloads
- Yankee Group: Exploring the Benefits of 3G Wireless Integrated into Business-Class Routers Sprint
- How File Fragmentation Occurs on Windows XP / Windows Server 2003 Diskeeper
- Defrag Myth Busters - What You Should Know Diskeeper
- Webcast: How to Get the Most Out of Microsoft Windows Deployments with Intelligent iSCSI Storage Dell EqualLogic
- New Release - Diskeeper 2008 with InvisiTasking: It's Smart. It's Transparent. It Will Take Your PC from Zero to Sixty--Automatically! Diskeeper
Article Categories
- Security
- Security Solutions, IT Locksmith
- Networking and Communications
- E-mail Administration NetNote, Cisco Routers and Switches
- CIO and IT Management
- Project Management, CIO Issues, Strategies that Scale
- Desktops, Laptops & OS
- Windows 2000 Professional, Microsoft Word, Microsoft Excel, Microsoft Access, Windows XP,
- Data Management
- Oracle, SQL Server
- Servers
- Windows NT, Linux NetNote, Windows Server 2003
- Career Development
- Geek Trivia
- Software/Web Development
- Web Development Zone, Visual Basic, .NET
