/    Sign up×
Community /Pin to ProfileBookmark

Toggle Calendar on and off

Hello,

I’ve been working on this for hours and thought I’d see if someone could help. I’m trying to make a toggle button that will turn on and off the visibility of a calendar i’m bringing in on iframe. I’ve done it with two buttons here:

[url]http://jbrown.cc/calendar/testcal.html[/url]

But i can’t figure out how to do it with one button. Thanks for any help you can give, and let me know if anyone knows a better way to do this with js or css. Below is the code i’ve done to toggle with two buttons:

[QUOTE]

<HTML>

<SCRIPT>
function hide(el)
{
document.getElementById(el).style.visibility;
if (currentVisibility == ‘hide’) {

currentVisibility = ‘show’

}

else{

currentVisibility = ‘hide’

}
}
</SCRIPT>

</head>
<BODY>

<DIV ID=”calendar” NAME=”calendar”>
<IFRAME ID=”iframe1″ CLASS=”InlineBdr” WIDTH=”300″ HEIGHT=”400″ BORDER=”0″ FRAMEBORDER=”no” SRC=”http://www.jbrown.cc/calendar/popminical.php”></IFRAME>
</DIV>

<INPUT TYPE=”button” VALUE=”hide” onClick=”document.getElementById(‘calendar’).style.visibility = ‘hidden’;”>
<INPUT TYPE=”button” VALUE=”show” onClick=”document.getElementById(‘calendar’).style.visibility = ‘visible’;”>

</BODY>
</HTML>

[/QUOTE]

to post a comment
HTML

8 Comments(s)

Copy linkTweet thisAlerts:
@comptech520Jun 30.2005 — I am using IE 6.0, and I get Java Script errors when I load the calender page
Copy linkTweet thisAlerts:
@xover15authorJun 30.2005 — Thanks for the quick reply Shawn. I'm not sure why you're getting errors, it seems to work fine in both my firefox and IE 6.0. Any ideas are greatly appreciated, i'm completely new to this.

Edit - I'd actually like this button to show the calendar on a rollover if you happen to know how that might be done instead. Maybe with CSS?
Copy linkTweet thisAlerts:
@comptech520Jun 30.2005 — I'm not the Java guy, but I am sure that someone else has an answer to help you out. Good Luck!
Copy linkTweet thisAlerts:
@xover15authorJun 30.2005 — maybe i should try this in the javascript section instead
Copy linkTweet thisAlerts:
@comptech520Jun 30.2005 — Search the web for java script calenders, there is a million of them out there. Also go to http://hotscripts.com they might have something there
Copy linkTweet thisAlerts:
@some_yahooJun 30.2005 — shouldn't it be el.currentVisibility?
Copy linkTweet thisAlerts:
@xover15authorJul 01.2005 — thanks for the links bonrouge, those links are exaclty what i was looking for.
×

Success!

Help @xover15 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.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

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

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