我有一個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