Jump to content

katia

Members
  • Posts

    24
  • Joined

  • Last visited

katia's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. katia

    Images in js

    For now, my pc is my server, so should I use: "http://localhost/Img/1.jpg" as my path?
  2. katia

    Images in js

    If the picture is on your server, how does it have to be the picture path? Because if the src is like this: "../Img/1.jpg" , pic.width and pic.heigth will return undefined.
  3. My array contained some elements like: ..Img\album4\321dd.jpg and when I copied it to the javascript array it was all messed up because the "\" . I did put the javascript code in the place where I create the php array, I added some functions for changing the image src value and it works.Thank you guys, I really appreciate your help.
  4. I keep it there because I need the result of the function when I press the "next" button. The button code is above the code where I create the array.I will work on it more tomorrow.Thank you guys for your help
  5. It seems that it doesArray ( [0] => ..\Img\album4\37e4.jpg [1] => ..\Img\album4\630e.jpg [2] => ..\Img\album4\delbanchet1.jpg [3] => ..\Img\album4\delbanchet2.JPG [4] => ..\Img\album4\DSC03627.jpg [5] => ..\Img\album4\S3010390.JPG )
  6. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><title>Slide show</title><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></head><script type="text/javascript"> <!--function parseArray(sirpics){sir = new Array();<?phpfor ($i = 0; $i < count($sirpics); $i++)echo "sir[{$i}] = \"{$sirpics[$i]}\";\n";?>alert(sir[0]);}--></script><body><form name="form1" method="post" action="slideshow.php"> <table width="980" height="1045" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="81" height="128"> </td> <td width="800"><table width="797" height="74" border="1" cellpadding="0" cellspacing="0"> <tr> <td width="259"> </td> <td width="277"><input type="button" name="Button" value="Start"></td> <td width="253"> </td> </tr> <tr> <td><input type="button" name="Submit3" value="back" onClick=""></td> <td><input type="button" name="Submit2" value="Stop"></td> <td><div align="justify"> <? $nrpoza=$nrpoza; $numepoza=$numepoza; $album=$album; $opendir = opendir($album); $dim=0; $sirpics=array(); while($fname=readdir($opendir)) { $poza=$album."\\".$fname; $a=split("\\\\\\\\",$album); $nr=count($a)-1; $pozanou="..\\Img\\".$a[$nr]."\\".$fname; if (is_file($poza)) { $sirpics[$dim]=$pozanou; $dim++; } } echo " <input type=\"button\" name=\"Submit4\" value=\"next\" onClick=\"parseArray($sirpics)\"> "; ?> </div></td> </tr> </table></td> <td width="91"> </td> </tr> <tr> <td height="330"> </td> <? $nrpoza=$nrpoza-1; $poza=$sirpic[$nrpoza]; $proba=str_replace("\\\\","\\",$poza); $t_ht=600; $t_wd=seteazaDimensiuni($proba); echo "<td><img name=\"locpoza\" id=\"locpoza\" src=$sirpic[$nrpoza] height=$t_ht width=$t_wd alt=\"\"></td>"; closedir($opendir); ?> <td> </td> </tr> <tr> <td rowspan="2"> </td> <td><? echo $nrpoza." din ".$dim; ?> </td> <td rowspan="2"> </td> </tr> <tr> <td><a href="#">back to albume</a></td> </tr> </table> </form></body></html><?function seteazaDimensiuni($imagine){$imageinfo = getimagesize("$imagine");$t_ht=600;$o_wd=$imageinfo[0];$o_ht=$imageinfo[1];$t_wd=round($o_wd*$t_ht/$o_ht);return $t_wd; } ?>
  7. After changing this line, I did't get error messages anymore , but when I try to check the result , the alert (ar[0]) returns undefined
  8. But if I change it to:<? echo " <input type=\"button\" name=\"Submit4\" value=\"next\" onClick=\"parseArray( $picarray )\"> "; ?> and in the Java script I have just an alert function parseArray(picarray){alert(picarray[0]);} or function parseArray(picarray)ar=new Array();<?phpfor ($i = 0; $i < count($picarray); $i++)echo "$ar[$i] = $picarray[$i]";?>alert(ar[0]);} I only get errors
  9. I do that and I get an error. Why? <? echo " <input type=\"button\" name=\"Submit4\" value=\"next\" onClick=\"parseArray($picnr $picarray )\"> "; ?> and the java script function parseArray(picnr,picarray){ picnr++;document.getElementById('picture').src=picarray[picnr];}
  10. I'm just trying to read the next value (wich is a picture url )from an array and to dispplay it in an image tag , without having to read the whole picture folder over and over again
  11. So, I got the array "info' , and "nr" that represents a position in the array . When I submit the form I will increment nr .But when the page reloades nr 's value is the right value but array's value is Array.......
  12. katia

    Submit variables

    That worked for me. Thanks
  13. well, i don't want to use ajax too. If I will submit the form, and reload the page, how can I sumbit the array?
×
×
  • Create New...