469,271 Members | 1,501 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,271 developers. It's quick & easy.

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..
Feb 14 '08 #1
7 1231
Hm..

[html]
<script type="text/javascript" src="externalFile.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.
Feb 14 '08 #2
I tried doing this but this also not working with Mozilla...
Feb 14 '08 #3
acoder
16,027 Expert Mod 8TB
What does footerLinks() do? Post the code for that function.
Feb 14 '08 #4
Following is the footerlink function:

Expand|Select|Wrap|Line Numbers
  1. function footerlinks(RootPath)
  2. {
  3.     var strUserId = document.getElementById("hdnUserId").value;
  4.     var askLink = document.getElementById("asklink"); 
  5.     var sbmtLink = document.getElementById("sbmtlink");
  6.     if ( strUserId >= 0 ) {
  7.     askLink.href = RootPath + "/index.aspx";
  8.     sbmtLink.href = RootPath + "/CategoryQuestions.aspx";
  9.     }
  10.     else
  11.     if ( strUserId < 0 ) {
  12.     askLink.href = RootPath + "/login.aspx";
  13.     sbmtLink.href = RootPath + "/Login.aspx?action=sbmtAns";
  14.    }
  15. }
Feb 25 '08 #5
acoder
16,027 Expert Mod 8TB
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:
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" src="footer.js"></script>
  2. <script type="text/javascript">footerlinks();</script>
Alternatively, just call the function from within the file (so there would be no need for the second script tag).
Feb 25 '08 #6
Thanks a lot, it worked fine for me..
Feb 26 '08 #7
acoder
16,027 Expert Mod 8TB
Good! Glad to hear that you got it working.
Feb 26 '08 #8

Post your reply

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

By using this site, you agree to our Privacy Policy and Terms of Use.