Jump to content


This topic is now archived and is closed to further replies.


convert javascript to php

Recommended Posts

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

Share this post

Link to post
Share on other sites
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?

Share this post

Link to post
Share on other sites
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.

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.