Results 1 to 2 of 2
  1. #1
    Join Date
    Dec 2006
    Location
    Kent, UK
    Posts
    627
    Tokens
    138
    Habbo
    Romanity

    Latest Awards:

    Default Javscript Problems

    I hate using java, but ive kinda been forced into using it for this... Right at the moment, it populates a select field with all the images in a directory..... however when the form is submitted to the database, it doesnt save as "name_of_image.gif" it will save as "Name"... so how do I change this, heres the part of the script I believe affect this...

    PHP Code:
    <?
    Header
    ("content-type: application/x-javascript");
    $pathstring=pathinfo($_SERVER['PHP_SELF']);
    $locationstring="http://" $_SERVER['HTTP_HOST'].$pathstring['dirname'] . "/";
    function 
    returnimages($dirname=".") {
    $pattern="(\.jpg$)|(\.png$)|(\.jpeg$)|(\.gif$)";
    $files = array();
    $curimage=0;
    if(
    $handle opendir($dirname)) {
    while(
    false !== ($file readdir($handle))){
    if(
    eregi($pattern$file)){
    echo 
    'picsarray[' $curimage .']="' $file '";';
    $curimage++;
    }
    }
    closedir($handle);
    }
    return(
    $files);
    }
    echo 
    'var locationstring="' $locationstring '";';
    echo 
    'var picsarray=new Array();';
    returnimages()
    ?>
    Code:
    
    function populateSelect(selectobj){
    for (var i=0; i<picsarray.length; i++)
    selectobj.options[selectobj.options.length]=new Option(picsarray[i], picsarray[i])
    if (selectobj.options.length>1){
    selectobj.selectedIndex=0
    showpicture(document.getElementById("picsform").picslist)
    }
    }
    
    Sangreal / Romanity ~ Habbo UK & USA
    [OurHabbo.Net Owner]
    Lewis. (Formerly xRoyal15)

  2. #2
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    I've read it a few times and I still dont get what you mean... Also java and javascript are completely different languages.
    Hi, names James. I am a web developer.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •