Click here to Skip to main content
Rate this: bad
good
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
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.
Rate this: bad
good
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
  Permalink  
Rate this: bad
good
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.
  Permalink  
Rate this: bad
good
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
  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 OriginalGriff 304
1 Maciej Los 285
2 Sergey Alexandrovich Kryukov 230
3 Shweta N Mishra 186
4 Aajmot Sk 153
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.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