PDA

View Full Version : php and javascript behaviours....


mogmachine
03-07-2004, 05:48 AM
...i am trying to get default Dreamweaver rollover behaviours to work in my php script, ..but even when i nest the function just above the code in the html, ...and escape out all the appropriate slashes, ..still no rollover, ...no errors, and the button appears fine, ..but no rollover, ...does anyone have any ideas, ...or know an easy rollover way other than this, ...i don't like relying on functions written by something else, ....well not when that soemthing else is dreamweaver, ...and it doesn't work.echo "<a target=\"_blank\" href=\"../assets/audio/".$row['catno'].".mp3\" onMouseOver=\"MM_swapImage('play','','../assets/play2.gif',1)\"
onMouseOut=\"MM_swapImgRestore()\"><img src=\"../assets/play.gif\" name=\"play\" width=\"61\" height=\"22\" id=\"play\"></a>";

thats my php line, ..and just in case it helps this is the javascript function
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_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];}
}


the images are set to preload in the body tag, ...which is part of a header function that is alreay loaded in by the time the rollover is required.
The rollovers in the header work fine, ..but the others do not, ..
to see what i mean,....
http://www.mogmachine.com/sd/erm/
...(browse by genre, ..any genre, ..then see the play button, ...that should have the same rollover as the top menu.

gsoft
03-09-2004, 06:40 PM
I see what you mean however im getting an alert when i go over the Play

mogmachine
03-09-2004, 07:23 PM
this is what happens to me, ...i re-wrote the function i javascript myself as a very simplified version that works too, ...i made an alert that works on the mouse over and out, ..but still no imagesswap, ..and the image is there, ..and the reference is correct.
Have also tried hard coding the link in HTML as well as echoing it in php.