2010-04-28 6 views
1

Comment rendre simple de travail (seulement si je retire/commente prototype) exemple pour expliquer jQuery.noConflict() avec prototype?Comment faire un exemple simple pour expliquer jQuery.noConflict() avec prototype?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>NO Conflict</title> 
<link rel="stylesheet" href="hhttp://meyerweb.com/eric/tools/css/reset/reset.css" type="text/css" media="screen, projection" /><link /> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
<script type="text/javascript"> 
//your javascript code 
</script> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script> 
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.3/scriptaculous.js"></script> 
<!--[if lt IE 7]> 
<script src="http://ie7-js.googlecode.com/svn/version/2.1(beta3)/IE7.js"></script> 
<![endif]--> 
</head> 
<body> 
    <!--Example of conflict--> 
</body> 
</html> 

http://jsbin.com/imuze3/2

Répondre

1
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
    "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
    <title>NO Conflict</title> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script> 
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script> 
    <script type="text/javascript"> 
    // Try decommenting the noConflict instruction to use prototype's $ 
    //$.noConflict(); 
    alert($('abc') == null); 
    </script> 
</head> 
<body> 
    <div id="abc"></div> 
</body> 
</html> 
Questions connexes