Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Row Building in Mozilla

 
Ayyappan Selvaraj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im using Javascript to build rows(with input box and combo box) in my JSP. But I find that it doesnt work pretty well with Mozilla browser.
Can anyone help me?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64971
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My crystal ball is on the fritz. How about posting some code?
 
Ayyappan Selvaraj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my sample code. This I use in JSP. I need JAVA code that will build the multiline without using javascript

<html>
<head>
<script language="javascript">
function divBuild()
{

var count = document.check.rowCount.value;

divID = 'build' + count;
obj = document.getElementById(divID);
count = count + 1;
//obj.innerHTML+="<div id='remBuild"+count+"'><td>Build"+count+"</td><td> <a href='javascript:remove("+count+")'>remove</a></td></tr><tr><td colspan='2'><div id='build"+count+"'></div>"
obj.innerHTML+="<div id='remBuild"+count+"'>Build"+count+"<input type='text' name='txt1"+count+"'></div><div id='build"+count+"'></div>";
document.check.rowCount.value = count;
}
</script>
</head>
<body>
<form name="check" method ="post">
<input type="hidden" name="rowCount" value="0">
<table>
<tr><td>Build1</td><td><input type="text" name="txt1"></td></tr>
<tr><td colspan="2"><div id="build0"></div></td></tr>
<tr><td colspan="2"><a href="javascript ivBuild();">Build!</a></td></tr>
</table>
</body>
</form>
</html>
 
Ayyappan Selvaraj
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code that I gave previously doesnt allow me to sumbit the form in Mozilla and no error is thrown
Can u please help me out.
 
Eric Pascarello
author
Rancher
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your code is making bad HTML format since you have divs tested inside of the table tag. Big no no.

Do a search on google for: JavaScript insertRow insertCell

That will show you the correct way to add new rows to a table.

Eric
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic