hi everyone....
i want the coding help in Javascript to "swap the content of two Textbox elements" ..Kindly reply me.....
11 11039
Hi,
Please explain clearly what u want exactly. swap the text in textbox means?
hi everyone....
i want the coding help in Javascript to "swap the content of two Textbox elements" ..Kindly reply me.....
-
<input type=text id=text_id1 value='' />
-
<input type=text id=text_id2 value='' />
-
-
function swap_content(){
-
var tmp = document.getElementById('text_id1').value;
-
document.getElementById('text_id1').value = document.getElementById('text_id2').value;
-
document.getElementById('text_id2').value = tmp;
-
}
-
Debasis Jana
-
<input "type="text" name="text_id1" id="text_id1" value='' access here value from the PHP or other,, eg. echo"$_POST['text_id1']"; "/>
-
<input type="text" name="text_id1" id="text_id2" value='' access here value from the PHP or other eg. echo"$_POST['text_id2']"; ""//>
-
<input type="submit" value="swap" onClick="swap_content("text_id1","text_id2");">
-
-
function swap_content(id1,id2){
-
var tmp = document.getElementById('text_id1').value;
-
document.getElementById('text_id1').value = document.getElementById('text_id2').value;
-
document.getElementById('text_id2').value = tmp;
-
}
-
I think this will be work good .
dkyadav80
I think this will be work good .
There are one or two problems: you've got double quotes within double quotes, and you're passing the ids but not making use of them.
i want to swap the content of two text box by using javascript...I have written code as follows,but its not working....kindly reply me any one as soon as possible.... - <html>
-
<input "type="text" name="text_id1" id="text_id1" value='a' >
-
<input type="text" name="text_id1" id="text_id2" value='b' >
-
<input type="submit" value="swap" onClick=swap_content(text_id1,text_id2)>
-
<script type="javascript/text">
-
function swap_content(id1,id2)
-
{
-
var tmp = document.getElementById(text_id1).value;
-
document.getElementById(text_id1).value = document.getElementById(text_id2).value;
-
document.getElementById(text_id2).value = tmp;
-
}
i want to swap the content of two text box by using javascript...I have written code as follows,but its not working....kindly reply me any one as soon as possible.... - <html>
-
<input "type="text" name="text_id1" id="text_id1" value='a' >
-
<input type="text" name="text_id1" id="text_id2" value='b' >
-
<input type="submit" value="swap" onClick=swap_content(text_id1,text_id2)>
-
<script type="javascript/text">
-
function swap_content(id1,id2)
-
{
-
var tmp = document.getElementById(text_id1).value;
-
document.getElementById(text_id1).value = document.getElementById(text_id2).value;
-
document.getElementById(text_id2).value = tmp;
-
}
[html]<input type="text" name="text_id1" id="text_id1" value="a" >
<input type="text" name="text_id2" id="text_id2" value="b" >
<input type="submit" value="swap" onclick="swap_content('text_id1','text_id2')">
<script type="text/javascript">
function swap_content(id1,id2)
{
var tmp = document.getElementById(id1).value;
document.getElementById(id1).value = document.getElementById(id2).value;
document.getElementById(id2).value = tmp;
}
</script>[/html]
I've underlined the part of the code where you had made some mistakes.
Thank U...I got the output....
[html]<input type="text" name="text_id1" id="text_id1" value="a" >
<input type="text" name="text_id2" id="text_id2" value="b" >
<input type="submit" value="swap" onclick="swap_content('text_id1','text_id2')">
<script type="text/javascript">
function swap_content(id1,id2)
{
var tmp = document.getElementById(id1).value;
document.getElementById(id1).value = document.getElementById(id2).value;
document.getElementById(id2).value = tmp;
}
</script>[/html]
I've underlined the part of the code where you had made some mistake.
question moved to javascript forum.
question moved to javascript forum.
Question already there in JS forum. Both threads just need to be merged.
sreekandan, as a full member now, you should know that we expect your code to be posted in [code] tags (See How to Ask a Question).
This makes it easier for our Experts to read and understand it. Failing to do so creates extra work for the moderators, thus wasting resources, otherwise available to answer the members' questions.
Please use the tags in future.
Also, do not double/triple post your questions. All duplicate threads have been merged.
MODERATOR.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Fabian |
last post by:
This javascript is meant for learning language vocabulary, specifically
colours on this example. However, when I use images in the mtWord array,
it breaks when checking for correct answers. It...
|
by: Cardman |
last post by:
Greetings,
I am trying to solve a problem that has been inflicting my self
created Order Forms for a long time, where the problem is that as I
cannot reproduce this error myself, then it is...
|
by: Trvl Orm |
last post by:
I am working with 2 frames, Left and Right and the main code is in the
left frame, which has been attached.
Can someone please help me with this code. I am new to JavaScript and
can't figure it...
|
by: amykimber |
last post by:
Hi all,
I know I'm doign something really daft, but I can't get this to
work...
I have a form with a bunch of inputs called ship_owner - why the
? Because I'm submitting this page though php...
|
by: William van Zwanenberg |
last post by:
Hi there,
I wonder if you guys can help.
I'm currently experiencing some coding problems what with trying to use PHP
and javascript in tandem.
What I'm ultimately trying to achieve is use...
|
by: alice |
last post by:
I'm doing some text swapping with javascript, got it working fine, but
I would like the line to have line breaks and being a beginner, I
don't even know if this is possible.
So I have a line like...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |