Relegence
asked on
Calling a javascript function with a parameter in a "ascx" control
Hello,
I am writing a 'ASCX' control that contains a text input and 2 images.
I am successfully calling javascript functions from the images, with the textbox's clientID
(onclick="javascript:incre ment('<%= txtUpDown.ClientID %>')")
But I do not know how to call a javascript function from the input, with the input's id.
I tried: onclick="javascript:clearT ext('<%= txtUpDown.ClientID %>')
But it doesn't work.
How can I do that?
Thanks,
Dana
I am writing a 'ASCX' control that contains a text input and 2 images.
I am successfully calling javascript functions from the images, with the textbox's clientID
(onclick="javascript:incre
But I do not know how to call a javascript function from the input, with the input's id.
I tried: onclick="javascript:clearT
But it doesn't work.
How can I do that?
Thanks,
Dana
ascx code
----------
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="updown.ascx.cs" Inherits="updown" %>
<table cellpadding="0" cellspacing="0" border="0" style="position:relative;top:11px;">
<tr>
<td>
<input type="text" id="txtUpDown" runat="server" onclick="javascript:clearText('<%= txtUpDown.ClientID %>')" size="1" maxlength="2" />
<table border="0" cellpadding="0" cellspacing="2" style="position:relative;left:24px;top:-26px;">
<tr height="3px">
<td>
<img src="../images/arrUp.gif" onclick="javascript:increment('<%= txtUpDown.ClientID %>', <%=MaxVal%>)"/>
</td>
</tr>
<tr height="3px">
<td>
<img src="../images/arrDown.gif" onclick="javascript:decrement('<%= txtUpDown.ClientID %>', <%=MinVal%>)"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
remove "javascript:"
but are you doing some event on the textbox. Or when do you want to call this function?
and what is clearText doing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I used <input onclick="clearText(this.id )">
ASKER
Thank you very much.
What I was trying to do was clearing the text in the textbox. Since there are some textboxes, used with some ascx controls, I didn't know how to refer to the textbox I need.
What I was trying to do was clearing the text in the textbox. Since there are some textboxes, used with some ascx controls, I didn't know how to refer to the textbox I need.