views:

129

answers:

6

Hey Guys,

my file beginning looks like this:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>My title</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<script src="js/update.js" type="text/javascript"></script>

<!-- sifr -->
<link href="sifr207/sIFR-screen.css" rel="stylesheet" type="text/css"  media="screen" />

<script src="sifr207/sifr.js" type="text/javascript"></script>
<script type="text/javascript">  
$(document).ready(function()  
  {  
       if(typeof sIFR == "function")
       {
           sIFR.replaceElement("sifr", named({sFlashSrc: "sIFR-2.0.7/corporateacon-reg.swf", sColor: "#FF0000" , sWmode: "transparent"}));
       };
   });
</script>
<!--  -->
</head>

I really do not understand why the '$(document).ready(function()' is not found, because I implement sifr.js BEFORE that call.

Any suggestions? I would appriciate it, really!

shoutz, supervision

+1  A: 

Because sIFR doesn't implement a $ function. You probably mean to use Prototype.js, jQuery, or some other library that uses that badly named variable.

David Dorward
+3  A: 

you do not have jQuery.js included in your file!

Since SIFR is a jQuery plugin, you have to load the base library before sifr.js.

Try adding <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" type="text/javascript></script> at the beginning of your script.

naivists
+1-1: Right answer, but sIFR is not a jQuery plugin...http://wiki.novemberborn.net/sifr/What+is+sIFR
gnarf
oh, didn't know that. I just made a quick google lookup to find the jQuery plugin home (http://jquery.thewikies.com/sifr/) and thought that it must be "some kind of a plugin")
naivists
A: 

$(document).ready(callback) is a method provided by the jQuery library to run callback when the document parsing has completed. It looks like you don't have a script referencing jQuery in your file, so this method is not available.

Andy E
+2  A: 

Seems like you didn't include any reference to JQuery before that call, that's why '$' is undefined. Try to add this before:

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.js" type="text/javascript"></script>
mamoo
A: 

Okay, thanks for the advice, I was following this guide to implement sifr:

http://webdesigns-rosenheim.de/58-0-Der+schnellste+Weg+zu+sIFR.html

They wrap the if-clause in this (jquery) function, and I think it is not needed for implementing sifr, so must have been wrong what they wrote there...

shoutz, supervision

supervision
Hello there, and welcome to stackoverflow :). This is not really an answer to your question. It should be posted as a comment on the answer you are referring to. Also, if one of these answers solved the problem for you, you should "accept" it by clicking the checkmark under the number.
gnarf
A: 

Simply add jQuery to your head before sifr is loaded.

Kevin