User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 374,546 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,664 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 1850 | Replies: 1
Reply
Join Date: Jan 2007
Posts: 1
Reputation: luzkazar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
luzkazar luzkazar is offline Offline
Newbie Poster

how to access innerhtml element

  #1  
Jan 2nd, 2007
Hi guys...i'm kinda new in this js language...i was wondering can anybody help me with this code....well problem maybe sound a bit silly..well I was wondering how to get the all the value from the txtbox so that,I can validate all the data that have been key in by the user....thanking u all in advance for your time in reviewing my msg...may god bless u all.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
var numLinesAdded = 0;
function generateRow() {
var d=document.getElementById("div");
var addbut=document.getElementById("addsub");
d.innerHTML+="<table width='90%' bgcolor='#E9E9E9' border='0' cellpadding='0' cellspacing='0'><tr class='ContentTableText'><td>Name</td><td><input name='ConNameMs[]' type='text' id='ConNameMs[]' class='ContentTableText' size='38' /></td></tr><tr class='ContentTableText'><td>Address</td><td><input name='ConAdd[]' type='text' id='ConAdd[]' class='ContentTableText' size='38' /></td></tr><tr class='ContentTableText'><td>Age</td><td><input name='ConAge[]' type='text' id='ConAge[]' class='ContentTableText' size='38' /></td></tr></table><br>";
//d.innerHTML+="<input type='text' maxlength='5' name='txt1_" + numLinesAdded + "' onkeypress='focusNext(this)'>";
numLinesAdded++;
if(numLinesAdded=="5"){
addbut.disabled = true;
}
}
function test(){
alert("hi");
var thediv=document.getElementById("div");
var theelementcon=thediv.getElementsByTagName("input");
for(i=0;i<theelementcon.length;i++){
theelementcon[i].innerHTML=document.getElementById("ConNameMs[]").value;
}
}
</script>
</head>
<body>
<div id="div" align="center"></div>
<input type="button" value="Add Contact" id="addsub" onclick="generateRow()" class="ContentTableText"/>
<input type="button" value="Test" id="test" onclick="test()" class="ContentTableText"/>
</body>
</html>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Oct 2006
Location: India
Posts: 1,288
Reputation: vishesh is on a distinguished road 
Rep Power: 4
Solved Threads: 32
vishesh's Avatar
vishesh vishesh is offline Offline
Nearly a Posting Virtuoso

Re: how to access innerhtml element

  #2  
Jan 3rd, 2007
I am not going through all of your code but her's an example which will give you a drift
[html]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
<title></title>
<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/

function getMe(tellMe)
{
if(document.forms[0].helloBoss.value=="")
{
alert("Please Enter the data");
}
}

/*]]>*/
</script>
</head>

<body>
<form name="newboy">
<input type="text" name="helloBoss" />
<input type="submit" onClick="getMe('helloBoss');"/>
</form>
</body>

</html>
[/html]
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 4:09 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC