473,324 Members | 2,193 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

when I click the number..

Hi,
I have a tricky problem..

I printed out several numbers. For example,

for ($i=0:$i<$k;$i++)
printf("%s",$number[$i]);
Then, numbers are printed out. e.g.,
1
2
3
4
5
6

When I click the number I want to receive the number in other text box
which is in out of for-loop.
So I put add buttons in each row.

<input type="text", name="Vehicle">

for ($i=0:$i<$k;$i++)
<input type="text" , name="veh" , value=" <?php echo $number[$i]; ?>">
<input type="button" name="button1" value="add" onclick="return
checkMultiple()"/>

<script language="javascript" type="text/javascript">
function checkMultiple(){
var form1 = document.forms["t2_form"];
var text1 = form1.elements["veh"];
var button1 = form1.elements["button1"];
var list1 = form1.elements["Vehicle"];
if(text1.value == "") return;
list1.value = text1.value;
text1.focus();
}
</script>

however, as you guess, since all text boses names are "veh" and add
buttons are "button1"
So, it doesn't work.
How can I do seperately?????
Or can I do this job without using "input text box"?
Thx.!!

Dec 1 '06 #1
3 1048
I solved it. I used radiobutton.

kirke wrote:
Hi,
I have a tricky problem..

I printed out several numbers. For example,

for ($i=0:$i<$k;$i++)
printf("%s",$number[$i]);
Then, numbers are printed out. e.g.,
1
2
3
4
5
6

When I click the number I want to receive the number in other text box
which is in out of for-loop.
So I put add buttons in each row.

<input type="text", name="Vehicle">

for ($i=0:$i<$k;$i++)
<input type="text" , name="veh" , value=" <?php echo $number[$i]; ?>">
<input type="button" name="button1" value="add" onclick="return
checkMultiple()"/>

<script language="javascript" type="text/javascript">
function checkMultiple(){
var form1 = document.forms["t2_form"];
var text1 = form1.elements["veh"];
var button1 = form1.elements["button1"];
var list1 = form1.elements["Vehicle"];
if(text1.value == "") return;
list1.value = text1.value;
text1.focus();
}
</script>

however, as you guess, since all text boses names are "veh" and add
buttons are "button1"
So, it doesn't work.
How can I do seperately?????
Or can I do this job without using "input text box"?
Thx.!!
Dec 1 '06 #2
ASM
kirke a écrit :
When I click the number I want to receive the number in other text box
which is in out of for-loop.
So I put add buttons in each row.
row of what ?

Try this :

<input type="text", name="Vehicle">

<?
for ($i=0;$i<$k;$i++)
{
echo $number[$i]; ?:
<input type="radio" name="button1" value="<?= $i ?>"
onclick="return checkMultiple()"/>
<?
}
?>
<script type="text/javascript">
function checkMultiple(){
var form1 = document.forms["t2_form"];
var list1 = form1.elements["Vehicle"];
var button1 = form1.elements["button1"];
for(var i=0; i<button1.length; i++)
if(button1[i].checked)
{
if(button1[i].value == "") return;
list1.value = button1[i].value;
text1.focus();
}
}
</script>
Or also :

<input type="text", name="Vehicle">
<select name="choice"
onchange="var k = this.options.selectedIndex;
this.form['Vehicule'].value = this.options[k].value;">
<?
for ($i=0;$i<$k;$i++)
print("<option value=\"$i\">$number[$i]</option>
");
?>
</select>


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 2 '06 #3
ASM
kirke a écrit :
I solved it. I used radiobutton.
Bravo !

--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
Dec 2 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: john woo | last post by:
Hi I'm not good at JS, but want to get more about it. I want to use a JSP (the java code just used to get date, the rest are html and javascript), to display a table. the requirement is the...
0
by: KGrein | last post by:
Hi. I have a form that contains a combo box with customer number & customer name in it. The form is called F_DeleteUSCust and the combo box is named CB_getUScust It picks up the information for...
25
by: moondaddy | last post by:
I have an application where users need to upload images and in my web.config file I have a setting like this: <httpRuntime maxRequestLength="512" /> Which restricts image larger than 500k from...
13
by: Joner | last post by:
Hello, I'm having trouble with a little programme of mine where I connect to an access database. It seems to connect fine, and disconnect fine, but then after it won't reconnect, I get the error...
1
by: samuelberthelot | last post by:
Hi, This is driving me crazy. In the following code, with e==68 (ASCII code for 'D'), the button is given the focus and the click is trigered :) However, if I change to e==13 (ASCII code for...
17
by: Eric | last post by:
I'm new to JavaScript and I wrote this code to play with. Oddly, if I enter text in a box and then press the button, I only get the onChange event for the text box and not the button's onclick...
3
by: bfiser | last post by:
Good morning everyone. I have an issue with a page I developed using ASP. On my page I have active (or is it dynamic) hyperlinks to photos of employees based on their employee number. When I...
6
by: Murray Hopkins | last post by:
Hi. THE QUESTION: How do I get a reference to my Object when processing an event handler bound to an html element ? CONTEXT: Sorry if it is a bit long. I am developing a JS calendar tool....
1
anfetienne
by: anfetienne | last post by:
i have this code below that i made....it loads vars from txt file splits it then puts it into an array....once in an array it the brings the pics in from the array to create thumbnails and a larger...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.