Jump to content


Photo

convert javascript to php


  • Please log in to reply
2 replies to this topic

#1 newb

newb
  • Members
  • PipPipPip
  • Advanced Member
  • 454 posts

Posted 23 August 2006 - 12:46 AM

if (document.images) {

  img01 = new Image();
  img01.src = "images/buttons/0home.gif";
  img012 = new Image();
  img012.src = "images/buttons/1home.gif";
  
  img02 = new Image();
  img02.src = "images/buttons/0forum.gif";
  img022 = new Image();
  img022.src = "images/buttons/1forum.gif";
  
  img03 = new Image();
  img03.src = "images/buttons/0roster.gif";
  img032 = new Image();
  img032.src = "images/buttons/1roster.gif";
  
  img04 = new Image();
  img04.src = "images/buttons/0matches.gif";
  img042 = new Image();
  img042.src = "images/buttons/1matches.gif";
  
  img05 = new Image();
  img05.src = "images/buttons/0gallery.gif";
  img052 = new Image();
  img052.src = "images/buttons/1gallery.gif";
  
  img06 = new Image();
  img06.src = "images/buttons/0downloads.gif";
  img062 = new Image();
  img062.src = "images/buttons/1downloads.gif";

  img07 = new Image();
  img07.src = "images/buttons/0media.gif";
  img072 = new Image();
  img072.src = "images/buttons/1media.gif";
  
  img08 = new Image();
  img08.src = "images/buttons/0demos.gif";
  img082 = new Image();
  img082.src = "images/buttons/1demos.gif";

  img09 = new Image();
  img09.src = "images/buttons/0sponsors.gif";
  img092 = new Image();
  img092.src = "images/buttons/1sponsors.gif";
  
  img10 = new Image();
  img10.src = "images/buttons/0linkage.gif";
  img102 = new Image();
  img102.src = "images/buttons/1linkage.gif";
  
}
function OnImage(name) {
	if (document.images) {
		fullname = eval(name + "2");
		document[name].src = fullname.src;
	}
}

function OffImage(name) {
  if (document.images) {
    fullname = eval(name);
	if (fullname.complete) {
      document[name].src = fullname.src;
	}
  }
}

how do i convert that to php

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 23 August 2006 - 12:49 AM

It looks like a standard mouseOver image switch using javascript. It runs on the client machine. It therefore requires a language that can execute on the client machine. php only executes on a server. javascript executes on a client.

What exactly are you trying to do and why?
Legend has it that reading the manual never killed anyone.
My site

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 23 August 2006 - 11:18 AM

Is that used for a menu on your site and when you mouse over the image it changes to something else. If so a good subsitute is CSS and not PHP. With CSS you use the :hover pesudo selector.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users