<script type="text/javascript">
<!--//
// on DOM ready
$(document).ready(function(){
$("#current_rev").html("v"+$.jnotify.version);
$("a.example").bind("click", function (e){
// prevent default behavior
e.preventDefault();
var $ex = $($(this).attr("href")), code = $.trim($ex.text());
// execute the sample code
$.globalEval(code);
});
// style switcher
$("button.css_switcher").click(function(){
switchCSS(this.title);
});
});
//-->
</script>
而不是使用点击事件,如<a href="#example-1" class="example">[Run]</a> and <a href="#example-2" class="example">[Run]</a>
调用jQuery的FOM PHP脚本
我怎么能称之为事件,如果条件是真的还是假的?
<?php
if (true){
<a href="#example-1" class="example">[Run]</a>}else{
<a href="#example-2" class="example">[Run]</a>}
?>
jQuery是JavaScript的,它运行在客户端上。 PHP在服务器上运行。想一想。 – tdammers 2011-01-25 08:08:43
我不禁想知道我们这里是否有不完整的代码示例。这个css切换按钮在哪里?点击其中一个链接时会发生什么? – 2011-01-25 08:12:06