Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post

    Post Working in FF but not IE......

    Good day,
    I have a problem with the form below. The dropdown box work in FF but not in IE, can some one help me.

    Here is the error that it give to me ;
    document.background is null or not an object
    or
    document.noimage is null or not an object

    and here is the for :
    PHP Code:

    <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" name="add">
    <table border="0" align="center" cellspacing="1" cellpading="0" width=800 valign="top">
    <tr><td bgcolor="#663300" align="left" class="black"><b class="white">Cr&eacute;er un nouveau message ....</b></td></tr>
    <tr><td bgcolor="#cccc99" width="600" valign="top" rowspan="2"><table border="0" align="left" cellspacing="1" cellpading="0" width=600 valign="top">
    <tr><td width="600" valign="top" align="left" class="black">
    <center>Titre : <input type="text" name="titre" size="70"></center><br>
    Message :<br>
    <textarea name="commentaire" rows="10" cols="60"></textarea><br>
    <br>

    <input type="hidden" name="affiche" value="<?php echo $aujourdhui?>">
    </td>




       <td width="200" valign="top" align="center">
    <script language="JavaScript" type="text/javascript" >
    function changePic(fe){
    var opt_key = fe.selectedIndex;
    var fileName = fe.options[opt_key].value;
    document.noimage.src=fileName;
    return true;
    }
    </script>
    <select name="image" onchange="changePic(this);">
    <?php
    function PGL_ConfigList($dir)
    {
        
    $pattern="\.(jpg|jpeg|png|gif|bmp)$";
        
    $files = array();
        if(
    $open opendir($dir))
        {        
            while(
    false !== ($file readdir($open)))
            {
                if(
    eregi($pattern$file) && !is_dir($file))
                {
                    
    $files[] = $file;
                }        
            }
        }
        
    closedir($open);

        return(
    $files);
    }
    $dir "../upload/";
    $list PGL_ConfigList($dir);
    foreach(
    $list AS $file)
    {
        echo 
    "<option value=\"../upload/$file\">$file</option>";
    }
    echo 
    "</select>";
    ?>
    <br>
    <img src="http://www.voyageurs.peuplies.info/Maude/Equateur_2007/upload/peuplies logo select.jpg" width="100"  id="noimage" align="center">


    </td>
    </tr>






    <tr><td width="200" valign="top" align="center">
    <script language="JavaScript" type="text/javascript" >
    function changePic2(fe){
    var opt_key2 = fe.selectedIndex;
    var fileName2 = fe.options[opt_key2].value;
    document.background.src=fileName2;
    return true;
    }
    </script>
    <select name="background" onchange="changePic2(this);">
    <?php
    function PGL_ConfigList2($dir)
    {
        
    $pattern2="\.(jpg|jpeg|png|gif|bmp)$";
        
    $files2 = array();
        if(
    $open opendir($dir))
        {        
            while(
    false !== ($file readdir($open)))
            {
                if(
    eregi($pattern2$file) && !is_dir($file))
                {
                    
    $files2[] = $file;
                }        
            }
        }
        
    closedir($open);

        return(
    $files2);
    }
    $dir2 "../Background/";
    $list2 PGL_ConfigList2($dir2);
    foreach(
    $list2 AS $file2)
    {
        echo 
    "<option value=\"../Background/$file2\">$file2</option>";
    }
    echo 
    "</select>";


    ?>
    <br>
    <img src="http://voyageurs.peuplies.info/Maude/Equateur_2007/upload/peuplies logo select.jpg" width="100"  id="background" align="center">


    </td>
    </tr>






    <tr><td valign="top" align="left" class="black" colspan="2">
    <center><input type="submit" name="submit" value="Pr&eacute;-visualiser & Confirmer"></center>
    </td></tr>
    </table>
    </table>
    </form>

    Cansomebody point me my mistake ?

    Thanks !
    Last edited by Peuplarchie; 06-07-2007 at 05:00 AM. Reason: Resolve

  • #2
    New Coder
    Join Date
    Apr 2007
    Location
    Silicon Valley California
    Posts
    71
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Your error message explains:

    document.noimageis null or not an object
    or
    document.backgroundis null or not an object
    I've never used/seen these objects of the document, are they something you are generating?

    If so, they aren't initialized before you try to use them. Give them a default value and your problem will be fixed.

    If they a standard elements, then IE doesn't support them and you'll need to give them a default value anyway.
    Last edited by cyberlogi; 06-07-2007 at 02:17 AM. Reason: forgot to quote

  • #3
    Regular Coder
    Join Date
    Feb 2005
    Posts
    679
    Thanks
    0
    Thanked 16 Times in 15 Posts
    For IE you will need to add the name attribute to your image HTML

    ..... name="noimage" id="noimage" align="center">

    ..... name="background" id="background" align="center">

  • #4
    Regular Coder
    Join Date
    Feb 2006
    Posts
    262
    Thanks
    23
    Thanked 1 Time in 1 Post
    Wow,what a stupid thing, that, It was to much in my face, for me to see it !
    Thanks!


  •  

    Posting Permissions

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