Jump to content

katia

Members
  • Posts

    24
  • Joined

  • Last visited

Posts posted by katia

  1. Yes, just use .height and .width after the picture object.
    <html><head><script>function check(pic){alert("width: "+pic.width+"px");alert("height: "+pic.height+"px");}</script></head><body><img src="http://www.google.co.uk/logos/worldcup06_uk.gif" onclick="check(this)" /></body></html>

    Is that what you need?

    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.
  2. 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.

  3. Why do you have the javascript outwith head and body tags plus would it not make sense to move it down to where your other php gererates the array.
    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 :)
  4. Make sure that $sirpics has the information you need in it.  Do print_r($sirpics) to see the contents of it.

    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 )
  5. <!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; } ?>

  6. One reason might be because you left the comma out from the first part.

    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

  7. ok so you are going to have to print the contents of the php array into a javascript array, see post #11 by justsomeguy.After you have done that you will need to code a javascript to cycle through it's array display each pic.

    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];}

  8. You need to write out the javascript code with PHP.  So you would set up the array first:echo "var info = new Array();\n";and then loop through your array and write out the java script:for ($i = 0; $i < count($array); $i++)  echo "info[{$i}] = {$array[$i]};\n";Then you can put whatever javascript code you need to use the array.

    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.......
  9. I display some images after reading them from a folder, in a while.I sumbmit my form when clicking on an image file. In the new form, I need the file name and the file number in the new from. In my form they are displayed ok ,but since I write these information in a "while" when I submit the file picturenumber will have the last value of $dim, picture name the last value of $fname.Is there any way that I can store these variables so I submit the right values ?

    $opendir = opendir($album);$dim=0;while($fname=readdir($opendir)){   if (is_file($name)) { $dim++;echo "<td width=\"140\" align=middle  >";echo "<input type=image src=$fname name=$fname title=\"$fname\" height=80 alt=\"$fname\"   width=120 border=0 value=submit()>";echo "<input type=\"hidden\" name=\"picturenumber\" value=$dim>";echo "<input type=\"hiiden\" name=\"picturename\" value=$fname>";echo "</td>"; }//if} //while                    closedir($opendir);
  10. I am using this JScript code to write info in a text file. filename is a string that contains the path to my file (by getting the current directory and then concatenating with the path where the file is)function writetofile(filename,info){var ForAppending=8;var fso = new ActiveXObject("Scripting.FileSystemObject");var ts = fso.OpenTextFile(filename, ForAppending, false); ts.WriteLine(info);ts.Close();}This code works when I test my web page ON my computer. The question is will it work on line?

  11. When I submit a form I need to load different web pages, acording to some text values the users writes in 2 text boxes : form.textbox1.value and form.textbox2.value . Is there any way I can do that?//this is the piece of my code where i have to do that<form name="formlog" onsubmit="return test(formlog)" action="THECONCATENATEDSTRING ">

  12. I have to make photo sharing a web page. I can only use client-side JavaScript and HTML (for didactical reasons), all the information about users and the photos are in folders and files and not in a database.Since I'me very new to this I want to know how to create a login page? Does every user have their own web page with their information? Or can I create the pages dynamicaly , at the moment they log in ,depending on the information I have about the users?

×
×
  • Create New...