Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: ASP.NET Browser
In my project I' m using the Javascript code for getting the User name, it will work fine in Internet Explorer, but the txtUsernName is not getting if I use fire fox Browser, is there any separate code for firefox browser...
I serached in Google, but i didn't get the answer,
I hope I vl get the answer from here..
var txtuser= document.getElementById('<%= txtUserName.ClientID %>').value;

Thanks & Regards
Posted 29-May-12 1:39am
Edited 29-May-12 1:56am
Bojjaiah at 29-May-12 7:05am
your code is abviously correct? once again check it.
or post entire code we can check it.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

You can try
var txtUsName = document.getElementById('<%= txtUserName.ClientID %>');
txtUsName.value = "User Name";
this line should be written after your HTML Tags
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

1. I suggest you try separating it like this
var txtBox = document.getElementById('<%= txtUserName.ClientID %>');
txtBox.value = "Any value";
I found this to work sometimes I am not sure why and not sure whether it will in your case but you can try.
Also, I think you should start using jQuery because it has use the implementation according to the users browser so we have to worry less about browser dependency COMPARATIVELY if we sue jQuery.
like in jQuery the methos like
$('#txtBox').val("Any value");
will work on all browsers.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

var txtUsername=document.getElementById('<%= txtUserName.ClientID %>').value
alert(txtUsername);//You get the value what u have written in textbox
honey4bee at 29-May-12 6:58am
Using ur suggested code also i didn't get the username value,
NikhildPawar at 29-May-12 7:07am
where u write ur javascript in function or any event
NikhildPawar at 29-May-12 7:49am
Show me your HTML

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 George Jonsson 215
1 Kornfeld Eliyahu Peter 169
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,342

Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 29 May 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100