Re: Using javascript function from php

From: Date: Fri, 11 Mar 2005 17:50:22 +0000
Subject: Re: Using javascript function from php
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-210525@lists.php.net to get a copy of this message
> 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 Instead of driving yourself nuts with echo and quote and backslash and semi-colon quote semi-colon, just do like this: <?php //PHP code here ?> <!-- Look ma! No PHP --> > <SCRIPT type="text/javascript" language=javascript> > function toggle(imagename,src1,src2){ > if(document.images && document.images[imagename]) > { > image1=new Image; > image1.src=src1; > if(document.images[imagename].src != > image1.src){document.images[imagename].src = image1.src} > else{document.images[imagename].src=src2} > } > } > </SCRIPT> <?php //more PHP here ?> The hair you save, may be your own. -- Like Music? http://l-i-e.com/artists.htm

« previous php.general (#210525) next »