#1
  1. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    16
    Rep Power
    0

    drop-down menu and javascript


    I've got some javascript (embedded in PHP) that generates a text box after an item from a drop-down menu is selected. It works in IE yet not in Netscape. Here's the (messy) code:

    <script language="javascript">
    <!--
    function toggleother(){
    if(document.form1.elements['mycombobox'].value=="myvalue"){
    MM_changeProp('changeoptions','','innerHTML', '<input type="text" name="myname" value="">','SPAN');
    }else{
    MM_changeProp('changeoptions','','innerHTML','','SPAN');
    }
    }

    function MM_findObj(n, d) { //v4.0
    var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
    if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
    for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
    if(!x && document.getElementById) x=document.getElementById(n); return x;
    }

    function MM_changeProp(objName,x,theProp,theValue) { //v3.0
    var obj = MM_findObj(objName);
    if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
    }
    //-->
    </script>


    Any suggestions?

    Thanks for any help

    theKid
  2. #2
  3. phpkid ~~~~~~ :o)
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Nov 2000
    Location
    NJ, USA
    Posts
    2,534
    Rep Power
    17
    does this javascript works in html page in netscape ??

    if not, ur problem has nothing to do with PHP.
    post up ur problem at javascript forum.

    jd
    _____________________________
    d.k.jariwala (JD)
    ~ simple thought, simple act ~
    I blog @ http://jdk.phpkid.org
  4. #3
  5. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Joliette, Québec, Canada
    Posts
    6
    Rep Power
    0
    Hi theKid,

    Don't want to annoy you with this but this forum is for PHP. You might want to try posting this to the HTML & JavaScript forum.

    PHP in this instance has nothing to do with your problem.

    I will try an answer anyway but I'm really not sure.

    First you don't show how you call those functions and what's around those calls.

    I see that you are using layers that may be the problem. Netscape and IE don't see those in the same way.

    Nestcape uses the <LAYER> tag and IE uses the <DIV> tag.

    Anyway I'm not very good passed that.

    I hope you have better luck in the other Forum.
  6. #4
  7. No Profile Picture
    Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2001
    Posts
    16
    Rep Power
    0

    apologies


    Thanks for the input and sorry about the posting to the inappropriate group. I don't normally do that, as it annoys the hell out of me when someone posts to the incorrect group. Excuse: it was nearing 5pm and caffeine levels had dropped dangerously low...

    Regards

    theKid

IMN logo majestic logo threadwatch logo seochat tools logo