2012-10-20 5 views

Répondre

0

Mettez ce code dans un fichier JavaScript (.js), puis dans votre fichier de formulaire Web, ajoutez une balise qui référence le fichier .js:

<script language="JavaScript" src="scripts.js"></script> 

Une deuxième possibilité est de mettre ce code dans la balise de script dans votre fichier formulaire web:

<script> 
var rotation = function(){ 
    $("#image").rotate({ 
     angle:0, 
     animateTo:360, 
     callback: rotation, 
     easing: function (x,t,b,c,d){  // t: current time, b: begInnIng value, c: change In value, d: duration 
      return c*(t/d)+b; 
     } 
    }); 
} 
$(document).ready(function(){ 
    rotation();​ 
}); 
</script> 

de c ourse, vous devez vous assurer de référencer d'abord jQuery et toutes les autres bibliothèques javascript dont vous avez besoin AVANT d'inclure votre fichier js, ou AVANT le tag de script inline.

Hope this helps

EDIT: Voici un travail verison de mon côté:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 

<html> 
<img src="https://www.google.com/images/srpr/logo3w.png" id="image">​ 
    <script type="text/javascript" 
    src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"> 
</script> 
<script type="text/javascript" src="http://jqueryrotate.googlecode.com/svn/trunk/jQueryRotate.js"></script> 
<script type="text/javascript"> 
    function rotation() { 
     $("#image").rotate({ 
      angle: 0, 
      animateTo: 360, 
      callback: rotation, 
      easing: function(x, t, b, c, d) { // t: current time, b: begInnIng value, c: change In value, d: duration 
       return c * (t/d) + b; 
      } 
     }); 
    }; 
    $(document).ready(function() { 
     rotation(); 
    }) 
</script> 
</html> 
+0

Intéressant ... En supposant aucun fichier supplémentaire - j'ai essayé coller dans une forme et tout ce que je vois est une image Google , pas de rotation. Je ne suis pas un développeur web, donc juste curieux si [j'ai fait quelque chose de mal] (http://pastebin.com/0zwUnpmH). – Neolisk

+0

vous avez oublié l'ouverture

Questions connexes