Reply to Re: Using javascript function from php

Your name:

Reply:


Posted by b on 10/02/50 11:10

It's OK I worked it out.

On Fri, 11 Mar 2005 15:44:55 +1100, <b@rbz.biz> wrote:

> Hi,
>
> I am just learning php, and am currently converting some jsp pages to =
=

> php. I used the follwing code in jsp to toggle between two images
>
> <SCRIPT type=3D"text/javascript" language=3Djavascript>
> function toggle(imagename,src1,src2){
> if(document.images && document.images[imagename])
> {
> image1=3Dnew Image;
> image1.src=3Dsrc1;
> if(document.images[imagename].src !=3D =

> image1.src){document.images[imagename].src =3D image1.src}
> else{document.images[imagename].src=3Dsrc2}
> }
> }
> </SCRIPT>
>
> start code snippet.............
> out.println("<A");
> out.println("onclick=3D\"toggle('" + child + "image','images/" + type =
=

> + ".jpg','images/" + childimg "');return(false);\"");
> out.println("><img src=3D'images/" + type + ".jpg' alt=3D'' name=3D" +=
child =

> + "image></a>");
> out.println("<input type=3Dhidden name=3D" + child + " value=3D'" + ch=
ildimg =

> + "'>");
> end code snippet...............
>
> I have tried many different ways to achieve this in php, but nothing =

> works. This is my latest attempt
>
> start code snippet.............
> print("<A href=3D\"javascript:;\" onclick=3D");
> echo "\"if(document.images && document.images[" . $child . "image])\n"=
;
> echo " {\n";
> echo " image1=3Dnew Image;\n";
> echo " image1.src=3Dimages/$type.jpg;\n";
> echo " if(document.images[" . $child . "image].src !=3D =

> image1.src){document.images[" . $child . "image].src =3D image1.src}\n=
";
> echo " else{document.images[" . $child . =

> "image].src=3Dimages/$childimg}\n";
> echo " }\n";
> echo "};\n";
> echo "return(false);\">\n";
> print("<img src=3D'images/$type.jpg' alt=3D'' name=3D" . $child . =

> "image>\n</a>\n");
> print("<input type=3Dhidden name=3D$child value=3D'$childimg'>\n");
> end code snippet.............
>
> Could someone please let me know how to do this
>
> Cheers
> Barb
>



-- =

Using Opera's revolutionary e-mail client: http://www.opera.com/m2/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация