...

View Full Version : toggling html function



Zangeel
06-10-2008, 06:38 AM
i have a community script its written in php, but i want to know if this is possible in js. theres a module (its in smarty) and i use blink tags on it <blink></blink> when it shows a message. is it possible for users to toggle this on and off to their specifications?

ive seen stuff like in scriptaculous where you can toggle windows open and closed, so is this something that can be done?

rangana
06-10-2008, 07:30 AM
I haven't worked with smarty yet, but can you set an id attribute on <blink> tag:


<blink id="toggle"></blink>


...and how do you want it to toggle? via Button?, text or something else.

Zangeel
06-10-2008, 07:34 AM
any practical way, a button, or radio button, something of the sort.

rangana
06-10-2008, 07:51 AM
Like this:


<script type="text/javascript">
window.onload=function()
{
var toggle=document.getElementById('toggle');
document.getElementById('trig').onclick=function()
{
toggle.style.display=(toggle.style.display!='none')?'none':'';
}
}
</script>
<input type="button" value="Toggle" id="trig">

Zangeel
06-10-2008, 10:59 AM
thats kinda working, but.. when you toggle the blink off the text just dissapears.
and is there a way maybe working with cookies, to make it stay the way its toggled so the user doesnt have to keep pressing the button?

rangana
06-10-2008, 11:07 AM
I'm confused. When the button is pressed, the element having the id of toggle hides if it is visible, and shows if its hidden. It does stays hidden/visible not unless the button is pressed.

...or you don't want it to be visible again when its already hidden? or something else.

Zangeel
06-11-2008, 04:00 AM
This is what i need,

Users need an option to show new messages with blinking function or toggle it off, and just get static links.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum