Posted: Tue Apr 13, 2010 12:45 am Post subject: Javascript
Joined: 09 Apr 2010 Posts: 1
How do I use innerHTML to validate a javascript form? I've created a simple form in Javascript. There are text fields, a password field, and radio buttons. However, I am totally lost on how to validate them using innerHTML. Anyone have any suggestions, hints, or starter code to help me out?
_______________________
affiliateelite ~ affiliateelite.com ~ adgooroo ~ adgooroo.com
Last edited by ileezaa on Thu Apr 15, 2010 10:39 pm; edited 1 time in total
Joined: 10 Dec 2007 Posts: 143 Location: New Zealand
Hi ileezaa.
Can you explain bit more about what you trying to do?
The following code is an example of how you deal with innerHTML by Javascript:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html>
<head>
<script language="javascript">
function DisplayInnerHTML()
{
var SampleInnerHTML = "";
var ButtonLabel = "Display InnerHTML";
if( !document.getElementById('innerHTMLForm') )
{
// If button is clicked, validate form using InnerHTML
SampleInnerHTML = "<form name='innerHTMLForm' id='innerHTMLForm'>";
SampleInnerHTML += "<div>User Name: <input type='text' name='user_name' id='user_name'/></div>";
SampleInnerHTML += "<div>Password : <input type='password' name='user_password' id='user_password'/></div>";
SampleInnerHTML += "</form>";
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum