im trying to do a single html page with multiple checkboxes to hide/show text when checked/unchecked. I'm really bad at html but so far I have got this: The problem I have is I dont know how to add more checkboxes.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>101st</title>
The thing is that first I need to detect if the div id is "sidebar" if its "sidebar" then it will pickup all the text inside h2 tag and will search for a1 or a2 in the text.If a1 is found then it will pickup the id html2 and make this div only visible.So in this case it will pickup id html2 and make it visible while other ids like html1 and html3 will be hidden.
I've got a table that I want to be able to show/hide rows based on what check box is checked. By default, I don't want anything displayed, then if you check a or some of the check boxes you'll see the data.Here is what I have, which has some effect in FF but does not work at all in IE.This is my script (which is part mine, part web-found)
I'd like to ask a user to choose from one of two radio buttons. The first radio button will show three checkboxes. The second radio button does nothing.How do I do this?
I am using jquery with the cookie plugin and I have multiple image buttons that can hide/show multiple elements. My question is how can I add a cookie to this code to remember whether each separate element is opened or closed?
The code, $(document).ready(function() { // choose text for the show/hide link - can contain HTML (e.g. an image) var showText='<div class="expanddown"></div>'; var hideText='<div class="expandup"></div>'; // initialise the visibility check var is_visible = false; // append show/hide links to the element directly preceding the element with a class of "toggle" $('.toggle').prev().append('<a href="#" class="togglelink">'+hideText+'</a>'); // capture clicks on the toggle links $('a.togglelink').click(function() { // switch visibility is_visible = !is_visible; // change the link depending on whether the element is shown or hidden $(this).html( (!is_visible) ? hideText : showText); // toggle the display - uncomment the next line for a basic "accordion" style //$('.toggle').hide();$('a.toggleLink').html(showText); $(this).parent().next('.toggle').slideToggle('fast'); // return false so any link destination is not followed return false; }); }); HTML, <a class="togglelink" href="#"></a> <div class="toggle"> Content </div>
Let me start by saying I'm a noob to JavaScript. What I'm trying to do for my website is have a select menu that shows the number of div's that's selected. I found a JS that I could do that with, but it only toggles, not change specifically what's selected. So if you click the wrong one, it doesn't work right.
I have a page that has 26 divides one for each letter A-Z.
I have the script written so that when you click on the link for one letter it shows that divide and hides the rest. However, I think there has got to be an easier way to do this because the code is so long! It works great but takes forever to write! reduce the size of this code?
Javascript: (Short and simple code) function showstuff(divID){ document.getElementById(divID).style.visibility="visible"; document.getElementById(divID).style.display="block"; window.location.hash="names";
[Code]....
So I have 26 functions being called for each click! There must be a simpler way to do this. Perhaps I can write a function that calls all 25 hidestuff() functions and then I can add the one showstuf().
On the homepage of my site, I would like to have some nav links that toggle between a few divs that are below in the content The divs in the content should display one at a time. For example, if you click nav1, the user would see div1. If nav2 is then clicked, div1 would hide and div2 would display.
I have some code that will do this, but for some reason it is hiding any divs that are within the toggled div. I'm very basic with JS and could use some help here. Here is my code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script> <script type="text/javascript"> function toggleID(IDS) { var area = document.getElementById('secondContent'); var sel = area.getElementsByTagName('div');
So I am trying to hide content and show it when selected with a select box. The first select box works fine no problems.
However I added a second one with two options, and it will not work at all. If I use the same name it messes up, and if I make a new name, it does nothing at all.
ShowNext function is the new one I added that doesn't work.
<script type="text/javascript"> function ShowReg(op) { document.getElementById('public').style.display='none'; document.getElementById('alliance').style.display='none';
It works really well but I have other div I would also like to show/hide. Is it possible to have a variable in the function that I could pass the name of the div to show/hide.
I have a ul list that I am using for a navigation menu and I would like to be able to click on items in the list to show different div's. I assume this is possible, so could someone please give me an indication of how to do it as I have been trying for a few days now and no joy.
Im trying to toggle a block of info on a forum that gets displayed multiple times. The below works for just one ID but I'll have more then one.
Code: function toggle() { var ele = document.getElementById("toggleUserinfo"); var text = document.getElementById("displayUserinfo"); if(ele.style.display == "block") {
My goal is to be able to have a page with multiple hidden DIVs. On click of a link, a single DIV (box) should appear. Now, either on second click of that link, it should close OR on click of another link the first DIV should close and the second should open. At any one time, only one DIV (box) should be visible with the option to close DIVs by clicking a second time on the open link. I have only been able to get 2/3 the way there. I am able to click on a link and open it, click a second link which closes the first and opens the second, but I don't know how to close the last open link so that no DIVs are shown, as when the page originally loaded.
Here is my example code: <html> <head> <title>Hide DIV Test Run</title> <script language="javascript"> function show(selected) { var openDiv = document.getElementsByTagName("div"); for(var x=0; x<openDiv.length; x++) { name = openDiv[x].getAttribute("name"); if (name == 'openDiv') { if (openDiv[x].id == selected) { openDiv[x].style.display = 'block'; } else { openDiv[x].style.display = 'none'; }}}} </script> <style> body { width:50%; } #openDiv1 { display:none; border:solid 2px black; width:200px; } #openDiv2 { display:none; border:solid 2px black; width:200px; } </style> </head> <body> <div id="body"> <p>This is <a href="#" id="link1" onclick="show('openDiv1')">some</a> test text. Sentence #1. <div name="openDiv" ID="openDiv1">This is the hidden text.</div> <p>This is even <a href="#" id="link2" onclick="show('openDiv2')">more</a> text. Sentence #2 <div name="openDiv" ID="openDiv2">This is more hidden text.</div> </div> </body> </html>
Complete JS first timer here, hope you all can understand my difficulties and stupidities without getting too frustrated. Trying to make a portfolio website as a Christmas gift. Anyway, I'm trying to build a menu that:
1. Expands/Retracts when clicking on other 'headers' in the Menu. 2. Allows for more than one object to be listed in each 'header'.
(Something similar to this [URl]... I've tried to hatch together several online solutions but I really have no idea what I'm doing, as you can see:
I am using the following code to show / hide form elements within a div based upon the drop down choice. How this code can be amended to use multiple drop downs within one form?
HTML Code: <html><head> <title>Show and Hide</title> <script> // Function that Shows an HTML element function showDiv(divID){ var div = document.getElementById(divID); div.style.display = ""; //display div }
// Function that Hides an HTML element function hideDiv(divID){ var div = document.getElementById(divID); div.style.display = "none"; // hide } .....
I have include a demo that should make it clearer, as to what I want to achieve. Ideally, each box will show a unique overlayed message as the user's mouse enters the box and hide once the mouse leaves.
I have a UL group with multiple LI items, and each LI has a DL with a DT and DD inside. What I am trying to do is show EACH LI's DT, but not the DD. The DD will only show once the DT has been clicked (except for the first, which should be visible on page load.here is the structure code ... I am struggling to make this work using jQuery show/hide functionailty.
<!-- LIST --> <ul class="examples"> <!-- ITEM #1 -->
It works well! But my script actually clones elements of the form so a user could be selecting adult or child for a number of tickets - ticket1,ticket2,ticket3....
How can I adapt that script so that it will show/hide for each ticket
I have a little issue with trying to hide / show multiple divs on my page. I am using a class name for the divs but the name is generated by a field have set in my database. So for example <div class="General">Ttitle 1</div> <div class="General">Ttitle 2</div> <div class="General">Ttitle 3</div> <!-- and my link is --> <a href="#" class="toggle" title="General">Toggle 1</a>
And then say I have <div class="Questions">Ttitle 1</div> <div class=" Questions ">Ttitle 2</div> <div class=" Questions ">Ttitle 3</div> <!-- and my link is --><a href="#" class="toggle" title=" Questions ">Toggle 2</a>
What would be the easiest way or the best way to code out the jquery to hide / show all the divs with the same name as the links title i can do code jquery to toggle 1 div but not sure how to code it so that it will hide / show all the divs with the same class name.
Is there a way I can simplify my code below? I want to be able to have just one iteration of the code and have it automatically switch out the IDs without have to add a new bit of JavaScript with each new div that is added. Here's my Javascript:
$(document).ready(function() { // toggles the personnel window on clicking the image/header $('div.title'+'#one').click(function() {
I am getting to know jquery a little, and I am trying hide and show a div when a link is clicked.I have a page setup that has a flash video in a div on the main page. Then when a link is clicked, a lightbox window opens and plays another video. I am trying to get the video on the main page to hide while the lightbox video is playing. Then when a user closes the lightbox window, the div with the main video on the page is shown and starts playing again.So far I can get this to work with one link. But I cannot get the main video div to hide when a second link is clicked.
I have a jquery script for showing and hiding the content inside, between two divs,controlled with radiobuttons. I like to use the same jquery script for another group of divs and radiobuttons so I'm trying to create a loop are so inside jQuery.
<!----------------- my script ----------------------> showhide.js jQuery(function() {
im trying to create an array with mutiple div ids. send this off to the function and the function switches the classes to show or hide depending on state.
I am using the following code to show / hide form elements within a div based upon the drop down choice. Does anyone know how this code can be amended to use multiple drop downs within one form?
<html> <head> <title>Show and Hide</title> <script>