CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2008
    Posts
    142

    how to stop calling JS method ?

    Hi

    I have a onclick link to calling one Javascript method. after calling that JavaScript method the another Javascript method is also calling by default. so how do i stop the another JavaScript method .

    The folling code i wrote
    Code:
    function newApptCloseWithoutSave() // this method i need to call
      {
            document.getElementById('fcNewApptName').style.display = "none";
      }
    function newApptNameInline( day, start,cell ) // this method is calling unnecessarily
      {
          if ( fcCalRefreshInProgress == 1 )
          return;
        
         // un-hide it    
        obj.style.visibility = 'visible';
        obj.style.display = "block";
    
        // put it above any other divs (hopefully)
        obj.style.zIndex = 99999;
        
        $('fcNewApptNameInput').value = '';
        $('fcNewApptNameInput').focus();
        $('fcNewApptNameInput').select();
      }
    thanks in advance..

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: how to stop calling JS method ?

    There is nothing in the code you posted which would cause the second function to fire.

    Either you have it also in the onclick event, or another section of JavaScript is attaching that to its onclick event.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Jun 2008
    Posts
    142

    Re: how to stop calling JS method ?

    from this code , first JavaScript method is calling . and i am clicking the 'close' link in this code.
    Code:
       <div id="fcNewApptName" onclick=""
          style="visibility: hidden; overflow: none; position: absolute; border: 1px solid black; background-color: white;">
          <table border="0" cellspacing="0" style="padding: 0px;">
          <tbody>
            <tr>
              <td>  
                <table border="0" cellspacing="0" style="padding: 0px;">
                  <tbody>
                    <tr>
                      <td style="padding: 0px;">
                        <input type=text size=32 id=fcNewApptNameInput name=fcNewApptNameInput class=verySmall
                          style="border: 1px solid; padding: 0px; " value=""
                          onkeypress="handleKeyPressExecFunc(event, newApptSaveAndClose,null)"
                          onclick="disableNewApptOnClick=true;">
                      </td style="padding: 0px;">
                      <td class="verySmall" align="right" bgcolor="#ddddee" style="padding: 0px;">
                        <img src="graphics/ozIcon13Close.gif"
                          onclick="newApptCloseWithoutSaving()">
                      </td>
                    </tr>
                  </tbody>
                </table>
              </td>
            </tr>
            <tr>
             <td>
               <a href="#" style="margin-top: 0px; margin-left: 2px;" class=verySmallGrey2NL
                 onclick="newApptSaveAndEdit()">Edit
                 <img src="graphics/arrow_btn.gif" align=absmiddle border=0> </a>&nbsp;&nbsp;
               <a href="#" class=verySmallGrey2NL
                 onclick="newApptSaveAndForceClose()">Save and Close
                 <img src="graphics/arrow_btn.gif" align=absmiddle border=0></a>
                <a href="#" class=verySmallGrey2NL onclick="newApptCloseWithoutSave()">Close</a>    // Here calling 1st JS Method. I am clicking on this link .
             </td>
            </tr>
            <tr>
              <td class=verySmallGrey2NL onclick="disableNewApptOnClick=true;">
                <input id="fcQuickAddRemember" 
                  type="checkbox" <&#37;= quickAddApptRemember ? "checked" : "" %> 
                  onclick="updateQuickAddRemember();">Always Open Edit Page
              </td>
            </tr>
         </tbody>
       </table>
     </div>
    From here the second JS method is calling.
    Code:
    <TR valign=top>
      <TD width=1 height=20 bgcolor=<%=cellbgcolor%>><img src="graphics/z0.gif" id="markV_<%=hour*2+1%>" width=1 height=20 align=abstop></td>
      <TD width=5% class=verySmall bgcolor=<%=cellbgcolor%> align=left><span class=verySmallGreyLight>&nbsp;</span></TD>
      <TD class=verySmall bgcolor=<%=cellbgcolor%> width=<%=bsx%> align=left valign=top id="CELL_NO_0_<%=hour*2+1%>"
             onclick="newApptNameInline( '<%=ozDay.renderDayKey(_ahsPage)%>', '<%=BaseCalTime.formatHour( hour, 30 )%>',this);" scope="col">
            <img src="graphics/z0.gif" width=1 height=1 align=top id="loc_0_<%=hour*2+1%>" >
      </TD>
    </TR>

  4. #4
    Join Date
    Jun 2008
    Posts
    142

    Re: how to stop calling JS method ?

    Actually It is working properly in IE. But not in Mozilla.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured