Click here to Skip to main content
11,496,146 members (1,506 online)
The site is currently in read-only mode for maintenance. Posting of new items will be available again shortly.
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
Honey.
Posted 29-May-12 1:39am
Edited 29-May-12 1:56am
v2
Comments
Bojjaiah at 29-May-12 7:05am
   
your code is abviously correct? once again check it.
or post entire code we can check it.
You can try

 
var txtUsName = document.getElementById('<%= txtUserName.ClientID %>');
txtUsName.value = "User Name";
 

this line should be written after your HTML Tags
  Permalink  
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.
  Permalink  
var txtUsername=document.getElementById('<%= txtUserName.ClientID %>').value

alert(txtUsername);//You get the value what u have written in textbox
  Permalink  
Comments
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 Dnyaneshwar@Pune 692
1 RyanDev 230
2 CHill60 208
3 Sascha Lefèvre 195
4 Sergey Alexandrovich Kryukov 124
0 Sergey Alexandrovich Kryukov 10,401
1 OriginalGriff 8,910
2 Sascha Lefèvre 3,899
3 Maciej Los 3,422
4 Richard Deeming 2,600


Advertise | Privacy | Mobile
Web01 | 2.8.150520.1 | Last Updated 29 May 2012
Copyright © CodeProject, 1999-2015
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