Javascript not working in Mozilla

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kushal49
    New Member
    • Feb 2008
    • 10

    Javascript not working in Mozilla

    Hi,
    I have one function on my aspx page and calling it like

    <script src="javascript :footerlinks()" type="text/javascript"></script>

    its working fine in IE 6 but function is not getting callled in mozilla....

    Anyone please help me out in this...

    Thanks in Advance..
  • tswaters
    New Member
    • Feb 2007
    • 19

    #2
    Hm..

    [html]
    <script type="text/javascript" src="externalFi le.js"></script>
    <script type="text/javascript"> footerLinks(); </script>
    [/html]

    is that what you're trying to do? I don't think I've ever seen a src="javascript :functionCall() " inside a script tag.... I'm surprised IE does anything there.

    Comment

    • kushal49
      New Member
      • Feb 2008
      • 10

      #3
      I tried doing this but this also not working with Mozilla...

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        What does footerLinks() do? Post the code for that function.

        Comment

        • kushal49
          New Member
          • Feb 2008
          • 10

          #5
          Following is the footerlink function:

          [CODE=javascript]function footerlinks(Roo tPath)
          {
          var strUserId = document.getEle mentById("hdnUs erId").value;
          var askLink = document.getEle mentById("askli nk");
          var sbmtLink = document.getEle mentById("sbmtl ink");
          if ( strUserId >= 0 ) {
          askLink.href = RootPath + "/index.aspx";
          sbmtLink.href = RootPath + "/CategoryQuestio ns.aspx";
          }
          else
          if ( strUserId < 0 ) {
          askLink.href = RootPath + "/login.aspx";
          sbmtLink.href = RootPath + "/Login.aspx?acti on=sbmtAns";
          }
          }[/CODE]
          Last edited by acoder; Feb 25 '08, 08:32 AM. Reason: Added code tags

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            Put footerlinks() in an external JavaScript file, say footer.js and then link to that file using the script tag, then call the footerlinks() function:
            [code=html]<script type="text/javascript" src="footer.js" ></script>
            <script type="text/javascript">foo terlinks();</script>[/code]Alternatively, just call the function from within the file (so there would be no need for the second script tag).

            Comment

            • kushal49
              New Member
              • Feb 2008
              • 10

              #7
              Thanks a lot, it worked fine for me..

              Comment

              • acoder
                Recognized Expert MVP
                • Nov 2006
                • 16032

                #8
                Good! Glad to hear that you got it working.

                Comment

                Working...