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
https://forums.phpfreaks.com/topic/71586-very-frusturating-complicatedplease-help/
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();

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.