Jump to content

very frusturating + complicated...PLEASE HELP!


addtrain

Recommended Posts

ok...here's the problem so far...

i am trying to make an input change from disabled to abled, after two images (myImage1 & 2) have been clicked on....this code that someone gave me earleir didn't work for some reason. how do i do this???

HERE IS THE CODE THAT PERSON GAVE ME THAT DOSEN'T WORK:

<script type='text/javascript'>
//this code uses variables to change an input
//to abled, instead of disabled

        var myImage1 = false;
        var myImage2 = false;
function check() {
  	if(img1 && img2)
    	document.getElementById('input1').disabled = false;
document.getElementById('button').disabled = false;
}

//end code
</script><script type="text/javascript">

Link to comment
Share on other sites

because i love oop

 

var images = {
    img1: document.getElementById('image1'),
    img2: document.getElementById('image2'),
    img_click: [false, false],

    actions: function(){
        img1.onclick = function(){
            img_click[0] = true;
            images.disable();        
        };
        img2.onclick = function(){
            img_click[1] = true;
            images.disable();        
        };
    },

    disable: function(){
        if(img_click[0] && img_click[1]){
            document.getElementById('input1').disabled = false;
    document.getElementById('button').disabled = false;
        }
    }
};

window.onload = images.actions();

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.