我有一个PHP页面,它可以工作,它也有一些顶部的JavaScript,我在HEAD标记之间。我的PHP使用“header(”location:/“);”代码将用户重定向到随机点的index.php。我已经缩小了我的不能修改标题信息错误到这一片JavaScript,如果我把它拿出来它工作正常,当我把它放回失败。引起的JavaScript无法修改标题信息PHP中的错误
我知道错误是由html之前输出的东西引起的,但我不知道如何读取或理解JavaScript。有人能指出我可以或应该改变什么吗?
<script type="text/javascript">
$(document).ready(function(){
//jCarousel Plugin
$('#carousel').jcarousel({
vertical: true,
scroll: 1,
auto: 2,
wrap: 'last',
initCallback: mycarousel_initCallback
});
//Front page Carousel - Initial Setup
$('div#slideshow-carousel a img').css({'opacity': '0.5'});
$('div#slideshow-carousel a img:first').css({'opacity': '1.0'});
$('div#slideshow-carousel li a:first').append('<span class="arrow"></span>')
//Combine jCarousel with Image Display
$('div#slideshow-carousel li a').hover(
function(){
if (!$(this).has('span').length){
$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
$(this).stop(true, true).children('img').css({'opacity': '1.0'});
}
},
function(){
$('div#slideshow-carousel li a img').stop(true, true).css({'opacity': '0.5'});
$('div#slideshow-carousel li a').each(function(){
if ($(this).has('span').length) $(this).children('img').css({'opacity': '1.0'});
});
}
).click(function(){
$('span.arrow').remove();
$(this).append('<span class="arrow"></span>');
$('div#slideshow-main li').removeClass('active');
$('div#slideshow-main li.' + $(this).attr('rel')).addClass('active');
return false;
});
});
//Carousel Tweaking
function mycarousel_initCallback(carousel){
// Pause autoscrolling if the user moves with the cursor over the clip.
carousel.clip.hover(function(){
carousel.stopAuto();
}, function(){
carousel.startAuto();
});
}
</script>
我没有看到这个JavaScript里面的任何PHP代码。这是你的php文件中的完全相同的代码,还是在做了php页面的“view-source”后复制了上面的代码? – 2011-01-20 07:28:16