Click here to Skip to main content
13,410,339 members (35,850 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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
Updated 29-May-12 1:56am
Bojjaiah 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 29-May-12 6:58am
Using ur suggested code also i didn't get the username value,
NikhildPawar 29-May-12 7:07am
where u write ur javascript in function or any event
NikhildPawar 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
Top Experts
Last 24hrsThis month

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