Re: function win(pat)

From: Date: Thu, 24 Apr 2003 07:37:11 +0000
Subject: Re: function win(pat)
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-145125@lists.php.net to get a copy of this message
sadly, your javascript function is pretty messed up. try this: <form method="get action="fcheck1.php" name="form1"> <input type="text" name="path" value=""> <input type="submit" name="submit"> <script language="javascript"> function win(pat) { document.form1.path.value=pat; } </script> keep your image loop the same, and it should work. hope that helps. let me know if you have any other questions. -jake "Diksha Neel" <diksha_neel@rediffmail.com> wrote in message news:20030424065524.22205.qmail@webmail32.rediffmail.com... > hi everybody, > > hope u all are doing fine. > in my php script i have a javascirpt function as follows: > > <script language="JavaScript"> > function win(pat) > { > <?php echo"<form method=get action=\"fcheck1.php\" name=form1> > <input type=\"text\" name=\"path\" value=\"$path\">; > <input type=\"submit\" name=\"submit\">"; > ?> > } > </script> > > and in the later part of the script,i am putting images of > a directory in a table using a for loop as follows: > > echo"<table><tr>"; > $counter=1; > for($i=2;$i<count($filenames);$i++) > { > $pos=strpos($filenames[$i],"."); > $leng=strlen($filenames[$i]); > $s1=substr($filenames[$i],0,$pos); > $s2=substr($filenames[$i],$pos+1,$leng); > $path="./bgimages/".$filenames[$i]; > echo"<td><a href='#' > onClick='win(\"$path\")'><img > src=$path width=75 > > height=75></a></td>"; > $counter=$counter+1; > if($counter==10) > { > echo"</tr><tr>"; > $counter=1; > } > } > echo"</tr></table>"; > > what i want to do with this script is display the images of > directory > in a table and on click of one image function win(pat) be invoked > so > that the path name of the image is displayed in text box and a > submit button is created. > > when i run the script, i get the all the images in the table > but a message "error on page" is also got and function win(path) > does > not work on clicking any one of the images. > > any help will be greatly appreciated. > thanks a lot, > regards, > diksha. > > > >

« previous php.general (#145125) next »