|
-
Aug 27th, 2002, 09:01 AM
#1
Thread Starter
Frenzied Member
JS and names in HTML
How do I refer to a text field created like this?
Code:
<script language="JavaScript"><!--
for (i=1;i<11;i++){
document.write(' <td><input type=text name=t' + i + 'value=100></td>');
}
//--></script>
I have tried to use this
var testing = formName.test.t2.value;
does it not create 10 text fields with the names T1, T2 ... T10? Because that is how I want it to be.
-
Aug 27th, 2002, 09:31 AM
#2
Fanatic Member
Try this...
Code:
<script language="JavaScript"><!--
for (i=1;i<11;i++){
document.write(' <td><input type="text" name="t'+i +'" value="100"></td>');
}
//--></script>
-
Aug 27th, 2002, 10:42 AM
#3
Black Cat
Further elaborating:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Script-Type" content="text/javascript">
<title>Untitled</title>
</head>
<body>
<script language="JavaScript"><!--
for (i=1;i<11;i++){
document.write(' <td><input type="text" name="t'+i +'" value="100"></td>');
}
//--></script>
<div onclick="alert(document.getElementsByName('t1').item(0).value);">CLICK HERE</div>
</body>
</html>
Josh
Get these: Mozilla Opera OpenBSD
I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.
-
Aug 29th, 2002, 03:55 AM
#4
Thread Starter
Frenzied Member
Hi punkie_uk and JoshT!
I have a problem which I think is easy for one of you two freaks to answer. The post is http://www.vbforums.com/showthread.p...readid=194722.
I'm looking forward for a reply
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|