Get Text From Textbox

Posted by Amresh under JavaScript on 2/19/2011 | Points: 10 | Views : 6085 | Status : [Member] | Replies : 4
I want a javascript code to get text from a text box and save the file with that name.please help




Responses

Posted by: Karthikanbarasan on: 2/19/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

Get the input value using the below code.

function testResults (form) {
var TestVar = form.inputbox.value;
}

To save the file using javascript check the below code...

http://www.webdeveloper.com/forum/showthread.php?t=210061


Thanks
Karthik
www.f5Debug.net

Amresh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Madhu.b.rokkam on: 2/19/2011 [Member] [MVP] Bronze | Points: 25

Up
0
Down
Hi,

You can also use document.getElementById("txtBoxName") or document.all("txtBoxName") to get the value

to save you can use

function SaveToFile(sText)
{
var fso = new ActiveXObject("Scripting.FileSystemObject");
var FileObject = fso.OpenTextFile("C:\\data.txt", 8, true,0);
FileObject.write(sText);
FileObject.close();
delete FileObject;
delete fso;
}

Thanks and Regards
Madhu

Amresh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Godly77 on: 10/19/2011 [Member] Starter | Points: 25

Up
0
Down
Simple way

if you know the id of the textbox then you can take the value by document.getElementById function eg:

alert(document.getElementById("IDOFYOURTEXTBOX").value);



Godly Mathew

Amresh, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: perfectchourasia-9163 on: 11/17/2011 [Member] Starter | Points: 25

Up
0
Down
<script>
fuction sam()
{
var textboxtext =document.getElementById("textbox id ").value;
}
</script>

<asp:button id="" runat=server onclick="return sam()" />

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/

Amresh, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response