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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.