Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts

    toggling html function

    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?

  • #2
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    I haven't worked with smarty yet, but can you set an id attribute on <blink> tag:
    Code:
    <blink id="toggle"></blink>
    ...and how do you want it to toggle? via Button?, text or something else.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #3
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    any practical way, a button, or radio button, something of the sort.

  • #4
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    Like this:
    Code:
    <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">
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #5
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    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?

  • #6
    Senior Coder rangana's Avatar
    Join Date
    Feb 2008
    Location
    Cebu City, Philippines
    Posts
    1,752
    Thanks
    65
    Thanked 372 Times in 365 Posts
    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.
    Learn how to javascript at 02geek

    The more you learn, the more you'll realize there's much more to learn
    Ray.ph

  • #7
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •