What's bugging my simple JavaScript toggle script?

1 Answer

Answer :

answer:The “toggle_visibility” function specifies (eng, met), not (var1, var2), so it seems not to matter what order of parameters you send it, it’s going to read (eng, met) always. function toggle_visibility(eng, met) { var e1 = document.getElementById(eng); var e2 = document.getElementById(met); if(e1.style.display == ‘block’) { e1.style.display = ‘none’; e2.style.display = ‘block’; } else { e1.style.display = ‘block’; e2.style.display = ‘none’; }

Related questions

Description : Is there an AppleScript method that can toggle miniaturized state of certain windows?

Last Answer : You could try opening the dictionary of commands (cmd + shift + o). This gives you the syntax of every applicable command for every app you have on your machine.

Description : What's the best editor for PHP/Javascript work?

Last Answer : Vim

Description : How can I become advanced in javascript in 2 months?

Last Answer : Study hard…work hard!!!

Description : How do I simply repeat a line of code 4x in Javascript?

Last Answer : something like a for loop is pretty simple, and gives you a handy counter if needed. for(var i = 0; i < 4; i++) { forward(); }

Description : How can I swap two integers without temporary variables using JavaScript code?

Last Answer : answer:This is a trick using the exclusive or operator ^ that was used when computers were short on memory. a = (a ^ b) /* a^b, b */ b = (a ^ b) /* a^b, a */ a = (a ^ b) /* b, a */ You can also do it using subtraction for numeric ... = a - b /* a - b, b */ b = b -a /* a-b, a */ a = b - a /* b, a */

Description : How to inherit a Javascript class?

Last Answer : answer:There is no such thing as classes or object-oriented programming when it come to Javascript. Are you sure you didn't mean Java? Java is a full programming language, developed by Sun. ... used to do thing like change the background color when you hover your mouse over a certain image.

Description : Why should I use JavaScript Library if it may effect the performance of a web site?

Last Answer : You might want to check out some extremely lightweight Javascript libraries such as xui, zepto, or jQuery Mobile. However, 17KB should not be a huge concern on iOS and Android devices. On phones with ... .example.com or mobile.example.com with minimal CSS, small page size, and no Javascript at all.

Description : How to implement a JavaScript code that doing "Set as my Home Page" in Google Chrome?

Last Answer : So, you’re saying the JavaScript code for doing this works in IE and Firefox, but not Chrome? That’s weird. Let me see if I can find a script for you.

Description : Is JQuery much slower than pure JavaScript ?

Last Answer : answer:You might be correct, there can potentially be more abstraction in JQuery with what you are doing when compared to pure JavaScript. But do note, JavaScript is client side based so it depends on your ... But if you are OK with the delay then keep using JQuery, if not, back to pure JavaScript.

Description : How, in javascript/jquery, can I change what "this" refers to in an event handling function?

Last Answer : By using the call and apply prototype methods of Functions. For example: function example () { console.log(this); } example.call(window); this will be the window variable. example.call( a string'); this will ... 2'); Hope this helps. If you need any more help with this, feel free to just ask.

Description : Javascript help, please?

Last Answer : any ideas, anyone?

Description : Is Javascript the best way to go when doing a ... photography portfolio site?

Last Answer : Those are all very different technologies that don't really compare to each other. Actionscript is for Flash obviously, which I would not recommend for doing an entire web site in. HTML is the foundation of all ... here. Or you could of course just put them on Flickr and let them manage all of it.

Description : Executing JavaScript in a page retrieved using AJAX?

Last Answer : Would assigning the scripts in page B to an “onload” event handler not work? (I’m new to this, but that seems possible. Forgive my kneejerk response.)

Description : How do I get rid of a javascript warning message from my browser?

Last Answer : Javascript gets mad when you try to access pages on a different domain. So your computer is probably running things as localhost and it is making a call and it says fuck no this is a huge ... . Javascript isn't supposed to load stuff outside of the domain that hosts it. This kinda explains it.

Description : Can I wrap native JavaScript methods with my aspects?

Last Answer : If I am understanding this correctly, you want to do something like authenticate someone, if the auth is returned true then invoke window.open. Really all you need to do is create a JS function ... I believe can be done semi-easily using something like Prototype to handle all of the XHR requests

Description : How can I open a text file in javascript?

Last Answer : Do you mean open a file from the file system? That’s not possible using JavaScript within web browsers due to security restrictions (imagine if that warez site you “stumbled onto” could access your file system…ouch!), but it is possible within some environments, like Apple’s Dashboard.

Description : Can you use JavaScript to force-replace a particular image in the browser cache?

Last Answer : answer:I'm not sure about doing it in js but if you make it so that the image/stylesheet/javascript file in question has a unique string after the filename like '/images/header.jpg?somerandomstring', when ... the string. That way, whenever you deploy a new version, it'll have a new cache string.

Description : Mystery Javascript snippet?

Last Answer : it looks like a piece of obfuscated code. Because normally JavaScript even in it's most complex is still humanly readable. If it is not obsfucated, then someone must have some really messed up naming ... but for what little I know, it does not look like it would ever work for any browser.

Last Answer : It Basically One Scripting Language . It 's HTML With Work By . To say Anyway , that's it Almost HTML _ Like . It is Absolutely Free . It is That Someone Use To do Can .

Last Answer : JavaScript One Popular Scripting Language , which The web Page Interactivity, Functionality Increase , form Validation , browser Instruction , time, Date Instructions Etc. At work Used Is.

Description : What's the worst single line of code/script/command you have ever written/seen?

Last Answer : You might enjoy this story.

Description : What kind of script/program/CMS/etc. is needed to make a site like care.com, airbnb.com, schoolofeverything.com, fiverr.com?

Last Answer : All the sites you posted are so different I don’t think you can use a CMS without being heavily modified. I would charge about 20K to even touch it if I was doing it from scratch.

Description : How to fetch files' extension from a variable which contains files & folder list in bash script ?

Last Answer : I know very little about this kind of stuff (very little), but is what you are asking, simply.. what type of file did this information come from? As in, is it a .zip, .exe, .txt, .html, etc… ??

Description : I need C troubleshooting: When i include a library do i have to do something more in order to have its functions work in my script?

Last Answer : Are you getting any other errors, like “math.h” not found? Actually, IIRC, not finding an include is just a warning…

Description : What are some tips for preventing a script kiddie from harming your web site?

Last Answer : 1. Don’t use SQL (saves money, too). 2. Run your site on Linux. 3. Don’t enable any software or languages you aren’t using yourself. 4. Put your server behind a NAT firewall and close down ports you aren’t using yourself.

Description : Name that Script. Can you help me find a JavaScript for this?

Last Answer : Sounds similar to a “Recently Viewed Items” script or module. However, you can also use a shopping cart module to set the items aside for review.

Description : ...............tag is an extension to HTML that can enclose any number of Javascript statements. (A)< SCRIPT> (B)< BODY> (C)< HEAD> (D)

Last Answer : Answer: A

Description : How do I create a simple program that will pull information from a database, insert it into a few formulas, and spit out the answers?

Last Answer : answer:Welcome to Fluther. I have only the vaguest notion of the survey that you're trying to accomplish, but I do understand data. What will serve you very well for this is a ... simple enough exercise, which will only get more complex as your understanding improves and your needs increase.

Description : Looking for a simple way to generate some permutation-like numbers!

Last Answer : answer:If you can take the time to learn it, Pure Data might be just what you are looking for. It is pretty good at managing number sequences and creating output, which appears to be what you are looking for… Good luck! :)

Description : Omfg HOW do I get my brother to stop bugging me?

Last Answer : Freak out on him the next time he does it. Do something really bizarre.

Description : What do you think about the NSA bugging European Union offices in the US and in Brussels?

Last Answer : It should be considered an act of war.

Description : To Parents, when you're kids are bugging you and a babysitter isn't an option what do you ?

Last Answer : answer:I put myself in timeout once when my son was little (about 4-5). I told him that mommy needed a timeout and that I was going in my room for the timeout. Our rules during timeout are that ... minutes to herself and he'll respect that (he still knows he can come get me if something is wrong).

Description : I just noticed this last night and it's really bugging me now. I've got a slight overbite. Is there anything I can do to help it, besides going to the dentist?

Last Answer : If I’m not mistaken, you’d have to visit an orthodontist, who would outfit you with braces and headgear. But it wouldn’t hurt to visit your dentist and ask what s/he would suggest. No problem is too small if it’s really bugging you.

Description : What to do with an ex-boyfriend still keep on bugging you?

Last Answer : I read your post and I laughed. Now,you care about his feelings and that is why you did not block him on Facebook. I think you still have feelings for him and that's why you don't want to block ... trust a two faced individual. If you give in,he will hurt you again.A cheat will always be a cheat.

Description : I’m trying to think of a movie/movie scene and all I can remember is a kid that is saying “our lord in heaven, hallowed be thy name.” And if I remember correctly it was said kind of jokingly and or sarcastic. It came into my head and is bugging me. Thanks?

Last Answer : What are you talking about!

Description : ‘Be bugging’ is known as A. Preventing the defects by inspection B. Fixing the defects by debugging C. Adding known defects by seeding D. A process of fixing the defects by tester

Last Answer : C. Adding known defects by seeding

Description : WYSIWYG maker for making expandable blocks (show/ hide toggle blocks)?

Last Answer : Wow. I have no idea, but should identify WYSIWYG as What You See Is What You Get for those who couldn’t figure it out.

Description : How do I toggle "block format" text in Word 2007?

Last Answer : Highlight the area to be in Block Text, then click the Block Text icon. Highlight the other text, and then click the format you want.

Description : Toggle between work and home network domain under Win7?

Last Answer : answer:I don't think there's an easy way of toggling back and forth. And getting back on the domain would require admin privileges (some companies don't let the workers have that). I have roughly the same ... of the NAS instead of the name. You should be able to connect to a printer the same way.

Description : How do I toggle between screens on MacBook?

Last Answer : Settings > Displays > then check ‘mirror displays’. Also, if you use a smartboard and are a teacher, I think you’re cool.

Description : What is a Toggle filter?

Last Answer : Need answer

Description : What signal causes FF2 to toggle?

Last Answer : Q output of FF 1 going LOW.

Description : A, what logic element enables FF3 to toggle with the clock?

Last Answer : The AND gate

Description : In a positive-edge-triggered JK flip-flop, if J and K both are high then the output will be ............. on the rising edge of the clock. (A) No change (B) Set (C) Reset (D) Toggle

Last Answer : (D) Toggle 

Description : Read the following statements: i. Gate is a combinational logic. ii. JK Flip-flop in toggle mode is not combinational logic. iii. MSJK Flip-flop suffers from race-around. iv. Counters are sequential circuits. Which choice is correct? (A) i, ii (B) i, ii, iv (C) ii, iii, iv (D) i, ii, iii

Last Answer : Read the following statements: i. Gate is a combinational logic. ii. JK Flip-flop in toggle mode is not combinational logic. iii. MSJK Flip-flop suffers from race-around. iv. Counters are sequential circuits. Which choice is ... (A) i, ii (B) i, ii, iv (C) ii, iii, iv (D) i, ii, iii

Description : What's wrong with this simple PHP script?

Last Answer : answer:Do you need a concatenation operator (.) between your string and the variable name ($the_long_url)? But like this: ’”.$var.”’ http://www.gidforums.com/t-965.html

Description : Simple way to add a GUI to batch script, or similar?

Last Answer : I think you might want to use http://www.horstmuc.de/ui.htm. Enjoy.

Description : Idea for a simple MEL script?

Last Answer : Some ideas: select all animation controls return to bind pose randomly generate and place shapes with in a scene create a stretchy ik or squash and stretch control I don’t know what your proficiency is so these vary in difficulty. But they can each be pretty useful.

Description : What's the best book for understanding Unity 2D?

Last Answer : Are you a beginner programmer in general, or just new to Unity? That would make a big difference in how I would respond.

Description : I'm clueless. Why do people make a differentiation between Apps and other programs? What's the difference?

Last Answer : answer:“App” == “Application” == “Program” Same thing.