473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to pass server control id to javascript function

hi
i am trying to make a general function which is accepting control id as argument. mine code is like this. but it's not working.

Javascript function
function check(var obj)
{alert(id of control is:" + obj.id); }

asp.net

txtbox1.attributes.add("onBlur", "chk(this)");
txtbox2.attributes.add("onBlur", "chk(this)");
txtbox3.attributes.add("onBlur", "chk(this)");
i am not getting any anser since long time on this site.posted question also not visible in control panel. thnx
Dec 18 '07 #1
6 15675
baburk
111 100+
Look at this link

http://www.thescripts.com/forum/thread342205.html
Dec 18 '07 #2
hi
thanx for ur reply. i didn't get yet.
Dec 18 '07 #3
Murdz
34
hi
i am trying to make a general function which is accepting control id as argument. mine code is like this. but it's not working.

Javascript function
function check(var obj)
{alert(id of control is:" + obj.id); }

asp.net

txtbox1.attributes.add("onBlur", "chk(this)");
txtbox2.attributes.add("onBlur", "chk(this)");
txtbox3.attributes.add("onBlur", "chk(this)");
i am not getting any anser since long time on this site.posted question also not visible in control panel. thnx
The function you are calling from your onBlur event is "chk"... Whereas your function name is listed as "check"... That is the only problem I can see. Otherwise this will work properly.

If you just want the ID, the full ID is contained in the textbox properties ClientID; eg:

txtbox1.attributes.add("onBlur", String.Format("check('{0}')", txtbox1.ClientID));
Dec 18 '07 #4
thnx.
but dat is not mistake in function. i've perhaps wrote dis here like dis in short form. when i run the page i am getting error. alert message is not being displayed. i would like to know if there is any other way to do it.
Dec 18 '07 #5
Murdz
34
The code is valid as I've tested it myself. Check the HTML and make sure it is adding the correct attributes to the button and calling the right JS function, the JS function is there etc.
Dec 19 '07 #6
The code is valid as I've tested it myself. Check the HTML and make sure it is adding the correct attributes to the button and calling the right JS function, the JS function is there etc.
thanx for reply Murdz.
Jan 4 '08 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Obscurr | last post by:
i've got an array created in php that I want to send over to a javascript function. onclick = "return sjekk(<?echo $names; ?> )" in my "sjekk" function, when I try to print an alert : ...
4
by: Gary Varga | last post by:
Are you getting confused between client and server? Should it be: > >Source Error: > >Line 39: >Line 40: <DIV ID=divOverview >Line 41: STYLE=CustomHeightedStyle()
3
by: Ant | last post by:
I'm building a Web user control that has several public functions. Can I fire them from the client side? for example Javascript and an HTML button
2
by: prav | last post by:
Hello, I found this code and I want to pass this function a value from a dataset. How do I do this? <INPUT onmouseover="func()" type="button" value="Button"> <script...
1
by: Evan Kontos | last post by:
I have the need to test for the value of a client variable from a server control in a VB Web form. How can I do this in VB. Net? Evan Kontos | EKontos@comtekcadd.com 27 Whitehall St. | ...
3
by: John Kotuby | last post by:
Hi all... I am trying to do a simple thing and maybe am missing something elementary. I have created a Javascript function at the top of a page which is meant to enable editing of an HTML input...
4
by: dhavalkvaria | last post by:
I am working in asp and i want to pass recordset cconsist name how can i pass it to javascript function i have written following <a...
11
by: haijdp | last post by:
Hi , the below statement is in a java program,in that xmlforDisplay is the java variable whose value i have to pass to the javascript function as follows, with the below code,I am getting the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.