this Ministry

  • About
  • Contact
  • Technology
  • Christianity
    • Ministry
    • Adopted, Accepted, Adored
  • Just Life
    • Home
    • Travel
    • Sports
    • Charlie

Daily archive: October 16, 2008

Use Link Tag to Execute Javascript

October 16, 2008, by esilvas No comments yet

While we are all familiar with the use of buttons (Submit, Join Now, Click Here) for all manner of executing a form, there is also the possibility of using text to accomplish the same thing. Try this:

<a href=”javascript: executeFunction();”>CLICK ME</a>

You can then have javascript in your <HEAD> section that will accomplish alomost anything.

  • Submit a form
  • Update values
  • Show/Hide (toggle) elements

Show/Hide (toggle) an Element

October 16, 2008, by esilvas 1 comment

If you have developed websites for more than a few minutes, you have inevitably been asked to do some cutesy stuff like adding flash, drop-down menus or toggling elements. While all of these may be ligitimate features of a site, they may not be the easiest to implement and perhaps even very challenging.  I have recently been overhauling my employer’s website and needed to show/hide some text when a visitor clicked on a list item <li>TEXT</li>.  While I knew what I wanted to do, I had some problems getting it to work.  Unfortunately, I could not figure our (or remember) the javascript command for viewing the value of an element’s display attribute.  After a quick Google search, I found it.

<script type=”text/javascript”>
<!–
function toggle_visibility(id) {
var e = document.getElementById(id);
if(e.style.display == ‘block’)
e.style.display = ‘none’;
else
e.style.display = ‘block’;

}
//–>
</script>

Now, you will notice that the attribute I was looking for is “display”.  I made the mistake of adding “value” to the end.

I can say it works well with no problems.  I will probably make changes to it, but otherwise it works if you need a quick way to toggle element’s visibility. Thanks to the folks at Movalog for the help.

Follow on Twitter

  • Signs of Google+ API? Who knows, but it would be a boon to a great service. http://t.co/y416uR4I
  • Despite probes failing to uncover evidence, WADA urges @lancearmstrong "evidence" transfer to USADA. #GiveUpAlready http://t.co/1biESdu5
  • RT @kristina_with_k: The good, the bad, and the ugly. Create an Unforgettable Logo Design via @webdesignshock http://t.co/xitqcLEa

How the Internet Works

  • How the Internet Works
    • Email
    • Domain Name Server (DNS)
    • Web Hosting

Sponsors

Meta

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Archives

Spread the Word

Church Marketing Sucks
Copyright © 2011 thisMinistry. All Rights Reserved.