SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onclick problem -- Netscape and FF

    I have dowloaded a calender control ASP.NET 2.0 and have made slight modification:

    1. provided clear button
    2. Can show or hide the clear button
    3. can lock/unlock the text box where the date selected will display

    When i click the button to pop up the calender or to clear he date in the text box, nothing happens in FF or netscape, IE is working fine.

    i have attached the full project.

    Dir structure
    • Images folder
    • JS folder
    • Styles folder
    • CalenderJSControl.ascx

      • CalenderJSControl.ascx.vb


    • Default.aspx
    • Web.config
    Default.aspx page has the user control CalenderJSControl.ascx.
    Attached Files Attached Files
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...

  2. #2
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    In FF javaconsole is showing the following problem

    calControl1_txt_Date is not defined

    Now in the browser the code shows as follows

    <TABLE id="tbl_control" cellSpacing="0" cellPadding="0" border="0">
    <TR>
    <TD><input name="calControl1$txt_Date" type="text" size="6" id="calControl1_txt_Date" />
    <TD><img id="calControl1_imgCalendar" class="TurnToHand" onclick="javascript:return popUpCalendar(this,calControl1_txt_Date, 'mm/dd/yyyy', '__doPostBack(\'calControl1_txt_Date\')')" src="images/calendar.gif" alt="Show Calender" style="border-width:0px;" /> <img id="calControl1_imgClear" class="TurnToHand" onclick="javascript:return popUpCalendarClear(this,calControl1_txt_Date, '__doPostBack(\'calControl1_txt_Date\')')" src="images/clear.gif" alt="Clear" style="border-width:0px;" /> </TD>
    </TR>
    </TABLE>

    Here if you look at the text box

    name = calControl1$txt_Date
    id = calControl1_txt_Date

    both are different, the text box id in the user control is txt_Date. When the user control is put on the default.aspx page, the user control name is calContril1.

    The onlclick event for the calender open button is done through

    Dim

    scriptStr As String = _
    "javascript:return popUpCalendar(this," & getClientID() & ", 'mm/dd/yyyy', '__doPostBack(\'" & getClientID() & "\')')"
    imgCalendar.Attributes.Add("onclick", scriptStr)

    getClientID function is as follows

    Public Function getClientID() As String
    Return txt_Date.ClientID()
    End Function
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...

  3. #3
    Learning...
    Join Date
    Jan 2003
    Posts
    781
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    changed this

    scriptStr As String = _
    "javascript:return popUpCalendar(this," & getClientID() & ", 'mm/dd/yyyy', '__doPostBack(\'" & getClientID() & "\')')"
    imgCalendar.Attributes.Add("onclick", scriptStr)

    to (in red)

    Dim scriptStr As String = _
    "javascript:return popUpCalendar(this,document.getElementById('" & getClientID() & "'), 'mm/dd/yyyy', '__doPostBack(\'" & getClientID() & "\')')"
    imgCalendar.Attributes.Add("onclick", scriptStr)

    and my problem is fixed.
    The beauty of life is not dependent on how happy you are,
    but on how happy others can be because of you...


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •