/    Sign up×
Community /Pin to ProfileBookmark

Javascript Not Found

i have this javascript that when i call it it give me an error “change is not defined”. anyone any ideeas please?

i call it from nested ascx like this :

chkReactivate.Attributes.Add(“onClick”, “change(this,'” + lblStartDate.ClientID + “‘,'” + start.ClientID + “‘);alert(‘this’)”);

<script type=”text/javascript”>

function change(obj,lbl,start)
{
if(obj.checked)
{
document.getElementById(start).style.display = ‘inline’;
document.getElementById(lbl).style.display = ‘none’;
}
else
{
document.getElementById(start).style.display = ‘none’;
document.getElementById(lbl).style.display = ‘inline’;
}
}

</script>

by the way. i have a chekbox that when is activeted shows a label and when is deactivated shows other label …. ? pls some help …. didn;t found my problem over the net?

to post a comment
JavaScript

8 Comments(s)

Copy linkTweet thisAlerts:
@ShampieSep 01.2008 — chkReactivate.Attributes.Add("onClick", [COLOR="Red"]"[/COLOR]change(this,'" + lblStartDate.ClientID + "','" + start.ClientID + "');alert('this')[COLOR="red"]"[/COLOR]);

Does the alert popup if you move it infront of the chang() function?
Copy linkTweet thisAlerts:
@tebbaertyauthorSep 01.2008 — well that not happening either.... that why i put an alert there... to se if is working but it doesn't ..... did i typed it wrong or what? ...
Copy linkTweet thisAlerts:
@HoboScriptSep 01.2008 — I think he means put the alert in front of the change function, right now its positioned after it, therefore wouldn't be called if there was an error preceding it. I'm willing to bet it'll work fine, but that doesn't help you problem, all that tells us is your event is being triggered, which we already know is.

This is a weird error, as I can't see the problem immediately. Can you post the rendered source after the .net control displays? View Source-esque?
Copy linkTweet thisAlerts:
@tebbaertyauthorSep 01.2008 — well i can post it if i know what is that ?
Copy linkTweet thisAlerts:
@tebbaertyauthorSep 02.2008 — yes ... if i put the alert in front is working ... but pls ... someone .... why isn't working the change() ?.... i am stuck here ?
Copy linkTweet thisAlerts:
@felgallSep 02.2008 — onclick requires a function to be passed to it, not a text string. When you run a text string nothing happens. JavaScript event handlers do not work the same way as other attributes.
Copy linkTweet thisAlerts:
@tebbaertyauthorSep 02.2008 — it is a funcion because i am using ascx and i add onClick event from code behinde. i am using dnn 4.8.4 and asp 3.5.

i think is because i use nestet controls.

when i used asp 2.0 that script was working but now it doesn't anymore ?..
Copy linkTweet thisAlerts:
@tebbaertyauthorSep 02.2008 — oleeeee .... i DID IT ... the javascirpt is not working because from dnn i activated suport partial rendering for update panel ... and that's why is not loaded the change() function.

so now i've got 2 options

1. leave suport partial rendering an place the script in skin

2.search how tu use javascript and update panel ?.

anyone any ideas about javascript and update panel ? ?
×

Success!

Help @tebbaerty spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...