/    Sign up×
Community /Pin to ProfileBookmark

enable/disable one javascript code

Hello,
I have this javascript code on my website:

<script src=”{VIVVO_TEMPLATE_DIR}box/answers.js” type=”text/javascript”> </script>

I am wondering is there a check box I can make, so if someone checks the box than the above code is enabled otherwise its disabled and doesn’t do anything. I dont want a submit button but checking it automatically makes it enabled/disabled. I dont know how to do that and any help would be appreciated.

to post a comment
JavaScript

6 Comments(s)

Copy linkTweet thisAlerts:
@tushar707authorMay 15.2008 — or maybe something that that javascript code is only active if the check box is checked or something like that. dont even know if its possible.
Copy linkTweet thisAlerts:
@tushar707authorMay 16.2008 — is this possible at all?
Copy linkTweet thisAlerts:
@KorMay 16.2008 — javascript functions are inactive anyway, unless an event (following the user's action) fires the function(s). What is the content of that js file of yours? What doest it suppose to do?
Copy linkTweet thisAlerts:
@tushar707authorMay 16.2008 — well as soon as I put this code: <script src="{VIVVO_TEMPLATE_DIR}box/answers.js" type="text/javascript"> </script>

it is automatically active. When people double click on a word, it gives them a popup defintion of the word. I want a checkbox to enable and disable this feature. The javascript file is too big but here is the link: http://site.answers.com/main/js/web_answertip.js?ANSW.nafid=8
Copy linkTweet thisAlerts:
@KorMay 16.2008 — Oh, no... It is impossible to follow that code; it is unwrapped. It's hard to say, unless we know if there is an event which call a function and which is that function.
Copy linkTweet thisAlerts:
@tushar707authorMay 16.2008 — so is there no way i can make a check box so if its checked, this code is enabled

<script src="{VIVVO_TEMPLATE_DIR}box/answers.js" type="text/javascript"> </script>

otherwise its disabled? Like a hide or something? because if can do that, then it would solve all my problems.
×

Success!

Help @tushar707 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 6.13,
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: @meenaratha,
tipped: article
amount: 1000 SATS,

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

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