Jump to content

Recommended Posts

I have a problem where my function doesn't seem to be even parsing.

 

<SCRIPT>
function unknownName() {
	if (document.forms['form']['targetname'].disabled = false) {
		document.forms['form']['targetname'].disabled = true;
	}
	if (document.forms['form']['targetname'].disabled = true) {
		document.forms['form']['targetname'].disabled = false;
	}
}
</SCRIPT>

<INPUT name="unknownname" onclick="return unknownName()" type="checkbox">

 

When I click it, the INPUT that its suppose to disable doesn't disable. I don't even get an error message in my error console which suggests that the function isn't even parsing. Does anyone know what the problem is?

Link to comment
https://forums.phpfreaks.com/topic/258961-function-doesnt-seem-to-parsing/
Share on other sites

Your right about the equal signs man. How didn't I see this! Thanks!

 

"your if statments will cancel each other if the field is disabled. Maybe you need to use else if."

 

I don't understand what you mean. Could you give me an example?

 

Now my error console reports "unknownName is not defined". How is that so?!

If the field was not disabled and you called the function, the first if statment will disable it and the second if statment will check if it's disabled (and it's because the first if statment) and enable it. instead you can if else statment instead of two if statments.

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.