Jump to content

Hey


atholon

Recommended Posts

I am trying to write a JS file so that I can display one of two forms depending on the selection but I can`t seem to get it to work...I am using prototype as well that is why I have the $$('test'); "test" is a div that contains one of the forms that I want to be displayed and hidden

 

 

this is what I have...It is saying that it was expecting an object...or something

<script language="JavaScript" type="text/javascript">";
     function ToggleOtherText()
    {
    var othertextElement = $$('test');
    if( othertextElement && selectBox );
    othertextElement.style.display = (selectBox.options[selectBox.selectedIndex].value == 'DHF Tutorial') ? 'inline' : 'none';
    }
</script>

 

Can anyone let me know what I am doing wrong?

Link to comment
https://forums.phpfreaks.com/topic/91641-hey/
Share on other sites

i think you mean $('test'); Also, you should pick a more descriptive topic next time as "Hey" doesn't really explain the issue at hand. Something like "Prototype: undefined object" or whatever would help us determine if we know anything about your problem without having to read the post first.

 

Thanks,

Tom

Link to comment
https://forums.phpfreaks.com/topic/91641-hey/#findComment-469339
Share on other sites

Ok, new issue for some reason I cannot get the if statement or switch to work on the object. It doesn`t seem to perform the match. Any ideas?

 

 

    function ToggleCatText()
    {
          var selectBox = document.getElementById('category');
          var display;        
          
          
          if (selectBox.options[selectBox.selectedIndex].value == 'Video')
          {          
           alert('Hamburger');
           }
          
          
          
          switch (selectBox.options[selectBox.selectedIndex].value)
          {
          case 'Video': 
            display = 'Video';
            alert('Video!');
          break;
          case 'Audio':
            display = 'Audio';
          break;
          case 'Graphics':
            display = 'Graphics';
          break;
          default:
            display = 'None';

          break; 
          }
             
          new Ajax.Updater(result, '../tutorials/process/catView.php?view=' + display, {asynchronous:true});
    }

Link to comment
https://forums.phpfreaks.com/topic/91641-hey/#findComment-470162
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.