-1

I have javascript enabled in firefox..But it doesnt appear to work:

<head runat="server">

<title></title>
<script src="Jquery.js" type="text/javascript">
    $(function () { alert('Ready to do your bidding!'); });

    $(document).ready(function () {
        alert('Welcome to StarTrackr! Now no longer under police …');


    });

</script>

No Alert appears

5 Answers 5

5

Try this:

<script src="Jquery.js" type="text/javascript"></script>

<script type="text/javascript">
    $(function () { alert('Ready to do your bidding!'); });
</script>
Sign up to request clarification or add additional context in comments.

Comments

1

You're combining an external script with inline script. You need two script tags.

<script src="Jquery.js"></script>
<script>
  $(function () { alert('Ready to do your bidding!'); });

  $(document).ready(function () {
      alert('Welcome to StarTrackr! Now no longer under police …');


  });

</script>

7 Comments

All script tags should have the type in them.
@jfriend00 - Many many people use the HTML5 Doctype, including Google. Keep up.
Good to know. I didn't know you could set the HTML5 doctype even though the browser (like IE8) supports hardly any of HTML5. What does Google do when presented with IE6 or IE7?
@jfriend00 Pretty sure they dropped IE6 years ago. Along with non-js support.
@jfriend00: IE6 is obslete. do you know that Microsoft stopped supporting XP which the last OS to have IE6? another thing is that type='text/javascript' is also obslete. the new type is type="application/javascript". Read this if you have got time rfc-editor.org/rfc/rfc4329.txt
|
1

You need to separate your link to jquery and your javascript...

<script type="text/javascript" src="jQuery.js"></script>
<script type="text/javascript">
    $(function () { alert('Ready to do your bidding!'); });

    $(document).ready(function () {
        alert('Welcome to StarTrackr! Now no longer under police …');


    });

</script>

Comments

1

You should try this instead:

<head runat="server">
<title></title>
<script src="Jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(function () { alert('Ready to do your bidding!'); });
$(document).ready(function () {
alert('Welcome to StarTrackr! Now no longer under police …');
});
</script>

Also, make sure that your "Jquery.js" link isn't broken either. Try visiting it in your web browser and if it doesn't work that might be the problem.

Comments

-2

You should try

window.alert('Ready to do your bidding!');

and

window.alert('Welcome to StarTrackr! Now no longer under police …');

1 Comment

That's probably not going to work either as the op has wrapped the code within a script block that is looking at an outside location for the script and the script block inside won't be run.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.