Show / Hide Div With Default?
Jul 16, 2009I have this script which show and hides divs, but I want a certain div to be open at start, how can I do that?code...
View 7 RepliesI have this script which show and hides divs, but I want a certain div to be open at start, how can I do that?code...
View 7 RepliesI'm trying to make one div default open, and that is working ok, but when I hit the link for the the other div to open, the first div is not closing... It closes when I hit the link for the first div...
var currentShowingDiv = document.getElementById('idShowHide1');
function doHideShow3(divName){
var objDiv = document.getElementById(divName); [code]...
So just to clarify what I want is to have one div open as default (idShowHide1) and when the user hits the link for the second div (idShowHide2) the first div close and the other open... As it is now the first div does not close...
The code below allows a user to specify which <div> should show on page2.html depending on which link is clicked from page1.html.
Page1.html
<code>
<html>
<head>
<title>page 1</title>
</head>
<body>
<a href="page2.html?div1">show div 1</a><br>
<br>
<a href="page2.html?div2">show div 2</a>
</body>
</html>
</code>
Page2.html
<code>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>page 2</title>
<style type="text/css">
.show
{
visibility:visible;
}
.dontshow
{
visibility: hidden;
}
</style>
<script type="text/javascript">
function wp(){
var fn1=window.location.href
var fn2=fn1.split("?")
if (fn2.length>1){
var fn3=fn2[fn2.length-1]
x=document.getElementById(fn3);
x.className="show";
}
}
</script>
</head>
<body onload="wp()">
<div id="div1" class="dontshow">Div 1</div>
<div id="div2" class="dontshow">Div 2</div>
</body>
</html>
</code>
What I would like to do is have page2.html <div1> as the default and show up. Problem is, if I click the link to show <div2> from page1.html, both <div>'s show up. How can I hide <div1>?
Assuming that a checkbox is initially unchecked, the following code works because the additional text is hidden, and when the checkbox is checked, the function if performed to show() it. However, what needs to be done if the checkbox may or may not be checked initially?
.additional{ display:none; }
$('#add').change(function(){
if($('#add').is(':checked')){[code]....
I'm not allowed to post a link yet since I'm a newbie. But the page is here: tinyurl dot com /m8ajyp
This page (and others on the site) use javascript to show/hide some divs in order to have a tab-like interface.
Is there any way to link to this page with the "Past Events" div showing as the default? Right now you can see that "Coming Events" shows on page load. And that's the way we want it most of the time.
But there are places in the site where I'd like to link specifically to this page with the "Past Events" div showing on page load.code...
I am trying to hide/show table when hide/show button is pressed
Problem: The code works fine when I remove 'slow' from line 10. But with 'slow' in line 10 content of toggleButton doesnt change from Hide to Show when pressed.
Code:
I use this snippet to remember the state of a toggle. But i want the default state to be hidden. How can i accomplish this? I added "display:none;" to .toggle_container but this isn't working.
$
(
".toggle_container"
).
[Code].....
I'm using this jquery plugin I recently found, and I'm having some trouble with it. Actually I got it to work quite nicely, the thing is that (as you may notice in that same demo) it works using the Title attribute so when you hover for a couple of seconds over a menu button, that awful default tooltip appears. I did some research but I couldn't find any simple way to hide those.
View 1 Replies View RelatedAnyway, I am using some code that someone else wrote so I claim no credit here for the code.It works great and I've managed to persuade to work in Wordpress but I have one thing I would like to change.Basically the text I am trying to toggle is "shown" on page load - I would like it to be "hidden" until the user clicks on the link to make it appear.Here's the code:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-
[code]....
My code below shows 2 radio buttons, when you click on one, it shows the content from a div, I would like to show the content of the checked radio button by default, at teh moment, they don't show any content until they are clicked!code...
View 2 Replies View RelatedI am trying to workout how to show the default value of a text box when you click off it. I have already got the code for the onclick but still working with the offclick.
View 1 Replies View RelatedI have got the following jCarousel code at http://sorgalla.com/projects/jcarousel/ and it shows just 3 thumbnails.
Does anyone know how to change this so it shows 5 thumbnails please?
I'm using Dynamic ajax content to load .php files into a div section, and everything is going fine, but the only problem is I don't know how to have the index page to load a certain file when the page loads. As for jquery code, this is all I have regarding my problem, and I'm not even sure I've used it right:
$(document).ready(function() {
$.get("content/home.php", function(returnedData) {
$("index").php(returnedData);
});});
Can someone tell me the code to display dropdown box showing a default value as selected which can vary as per the user�s condition using script..i,e by enclosing in document.write..
Now i need to print a for loop counter variable's value as the default selected option if a condition satisfies as shown below..code...
what can be the reasons for the same code which works perfectly in notepad to not show its result in a jsp application done using eclipse??anything to do with settings?
I am not able to display the current date as default in dd/mm/yyyy format in drop down menu..only dd and yyyy apears but month isnt apearing as default..
can u suggest alternative logic and its code to implement the same??
I am having problems, basically I have a set of nested lists I need to show and hide
Code:
<ul id="smenu3"><ul id="smenu4">
<li>stuff here..</li>
<li>stuff here..</li>
<li>stuff here..</li>
</ul><ul id="smenu5">
[Code]...
I always want "smenu3" to show with "smenu4" and "smenu5" collapsed... When the user clicks the link, it calls a javascript function to show "smenu4" like so...
[Code]...
How do I show the default icon for pdf, doc, etc... else show the image? Show the default icon for pdf, doc, etc... else show image.
Default icon:
'<img alt="" src="images/icons/' + sIcon + '.gif" width="16" height="16" border="0"></a>' +
The image:
'<img alt="" src="' + fileUrl.replace( /'/g, '\'') + '" height="36" border="0"></a>' +
Attempted javascript onError but only certain browsers support that or it's my code.
'<img alt="" src="' + fileUrl.replace( /'/g, '\'') + '" height="36" border="0" onerror="this.src=images/icons/' + sIcon + '.gif"></a>' +
I am looking for a way to put all CSS values on my selected elements back to its default. I was wondering if anyone has maybe done this before and if not has any idea's to get me started.
The idea is that when I use for example:
The elements within .setDefault will return to its default font/color/height/width etc... so basically all posible values.
I am trying to hide some form elements in a form by default and show/hide
depending on which radio button is clicked. This is what I have but it is
not working: Code:
I'd like to have a show/hide widget on my web site, kind of like "show
details" / "hide details" in Google Groups. Is there a tutorial
explaining how to make them? Google's is a bit complex and it's easy to
get something wrong. If the browser does not support the required
features, I want it to generate a completely static page with the
"details" shown automatically.
Check this code:
<a>text</a>
<div id="pkg">pkg</div>
<div id="table_pkg">table_pkg</div>
I'd like to show table_pkg and hide pkg when I click on <a>text</a>. How can I do?
I am using some simple javascript to show and a hide a div
Code:
function showHide(d) {
if (document.getElementById(d).style.display == "none")
{
document.getElementById(d).style.display = "block";
[Code]...
i have 5 sections in seperate divs and i am trying to collapse them using anchor onclicks and some js to toggle the display style. I am a little unsure of how to make this piece of code work a little more elegantly(lack of js symantic knowledge). Code:
View 3 Replies View Relatedgives me a type mismatch when I try to hide the div using the function hideTip2? Code:
View 3 Replies View RelatedI have 5 links and 5 divs. When the page loads I've set the visibility of first div to visible and all the rest are hidden. When the user clicks on second link I want to hide all the other divs and show only second. Similarly when the user clicks third link I want to show third div only. You get the idea. Here is what I have so far. Nothing happens when I click the second link.
[Code]...
Basically, I need a link that gives the user an option to show the rest of an article, and then a link UNDER the rest of the article to hide a post again. The link needs to work uniquely with each link. Every method I've used so far has worked for one post, and on the next post, when the link is clicked, it just shows the rest of the first post.
View 8 Replies View Related