PDA

View Full Version : Javascript News Scroller Help :-(



kallo1982
09-12-2009, 01:51 PM
Hello everybody .. Any PHP professional .. im still newbie ...

i cant combine my news content slider with image revolver .. how could i combine both codes .. shall i call my functions from different places ?
this is my header code :
-----------------------------------------------


<script type="text/javascript" src="jquery-1.3.1.js"></script>
<script type="text/javascript" src="jquery.easynews.plus.js"></script>
<script>
$(document).ready(function(){
var newsoption1 = {
firstname: "mynews2",
secondname: "showhere1",
thirdname:"news_display1",
fourthname:"news_button1",
playingtitle:"",
nexttitle:"",
prevtitle:"",
newsspeed:'8000'
}
$.init_plus(newsoption1);
var myoffset1=$('#news_button1').offset();
var mytop1=myoffset1.top-1;
$('#news_button1').css({top:mytop1});
});
</script>
<script language="JavaScript" type="text/javascript" src="ahahLib.js"></script>
<script language="JavaScript" type="text/javascript">
function getFuncs()
{
make(1);
MM_preloadImages('images/Buttons/main2.gif','images/Buttons/sj2.gif','images/Buttons/reyada2.gif',
'images/Buttons/islamiat2.gif','images/Buttons/sa7a2.gif','images/Buttons/neswan2.gif','images/Buttons/sadaqa2.gif',
'images/Buttons/sooq2.gif','images/Buttons/a5bar2.gif','images/Buttons/ta7meel2.gif','images/Buttons/sia7a2.gif',
'images/Buttons/montada2.gif','images/Buttons/6ara2ef2.gif','images/Buttons/matba52.gif','images/Buttons/tasweet2.gif',
'images/Buttons/video2.gif','images/Buttons/abraj2.gif','images/Buttons/tasmeem2.gif');
}
</script>
<script language="JavaScript"type="text/javascript">
<!--
function makeactive(tab) {
document.getElementById("tab1").className = "";
document.getElementById("tab2").className = "";
document.getElementById("tab3").className = "";
document.getElementById("tab"+tab).className = "active";
callAHAH('content.php?content= '+tab, 'content',
'getting content for tab '+tab+'. Wait...', 'Error');
}
function make(tab) {
document.getElementById("tabi1").className = "";
document.getElementById("tabi2").className = "";
document.getElementById("tabi3").className = "";
document.getElementById("tabi"+tab).className = "active";
callAHAH('contents.php?contents= '+tab, 'contents',
'getting content for tab '+tab+'. Wait...', 'Error');
}
function making(tab) {
document.getElementById("tabing1").className = "";
document.getElementById("tabing2").className = "";
document.getElementById("tabing3").className = "";
document.getElementById("tabing"+tab).className = "active";
callAHAH('contentss.php?contents= '+tab, 'contentss',
'getting content for tab '+tab+'. Wait...', 'Error');
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

-------------------
when i run this code .. i see (error in page ) if i change alittle i see the slider doesnt work .. or images dont revolve !! any idea please :confused:?

thetestingsite
09-12-2009, 03:06 PM
This isn't PHP; it's Javascript. I moved the thread to the JS forum and added code tags to your post so that it will make the code easier to read.

JShor
09-12-2009, 04:34 PM
What're you calling from PHP anyway? Info? Images? && post your datasource code [where it's grabbing data from]. You need to be a little more specific with your question.

kallo1982
09-12-2009, 11:57 PM
Good evening .. thx for replies .. and im sorry to post in the wrong area ..
now those few lines .. are for my news content slider ..
<script type="text/javascript" src="jquery-1.3.1.js"></script>
<script type="text/javascript" src="jquery.easynews.plus.js"></script>
<script>
$(document).ready(function(){
var newsoption1 = {
firstname: "mynews2",
secondname: "showhere1",
thirdname:"news_display1",
fourthname:"news_button1",
playingtitle:"",
nexttitle:"",
prevtitle:"",
newsspeed:'8000'
}
$.init_plus(newsoption1);
var myoffset1=$('#news_button1').offset();
var mytop1=myoffset1.top-1;
$('#news_button1').css({top:mytop1});
});
</script>

--------------------------------------
here in the middle .. is my three tab menus in the same page .. they work perfectly ..
<script language="JavaScript" type="text/javascript" src="ahahLib.js"></script>
<script language="JavaScript"type="text/javascript">
<!--
function makeactive(tab) {
document.getElementById("tab1").className = "";
document.getElementById("tab2").className = "";
document.getElementById("tab3").className = "";
document.getElementById("tab"+tab).className = "active";
callAHAH('content.php?content= '+tab, 'content',
'getting content for tab '+tab+'. Wait...', 'Error');
}
function make(tab) {
document.getElementById("tabi1").className = "";
document.getElementById("tabi2").className = "";
document.getElementById("tabi3").className = "";
document.getElementById("tabi"+tab).className = "active";
callAHAH('contents.php?contents= '+tab, 'contents',
'getting content for tab '+tab+'. Wait...', 'Error');
}
function making(tab) {
document.getElementById("tabing1").className = "";
document.getElementById("tabing2").className = "";
document.getElementById("tabing3").className = "";
document.getElementById("tabing"+tab).className = "active";
callAHAH('contentss.php?contents= '+tab, 'contentss',
'getting content for tab '+tab+'. Wait...', 'Error');
}
--------------------------------------------------------
those last functions .. are for my revolve images menu ..
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
----------------------------------------------------
now news slider + tab menus are working fine .. but since i try to work image revolving out .. damage happens .. error in page .. and both of images and news content slider stop working !!
since i remove one of them .. the page previews rightly ... any idea how to work all of these components out ?
thanks in advanced ..

kallo1982
09-13-2009, 03:26 PM
No clue ?