Go
New
Find
Notify
Tools
Reply
  
-star Rating Rate It!  Login/Join 
Guru 'Power' Mechanic
Picture of Bruceee
Posted
Sometimes it can be useful to invoke a Javascript function from a click or mouseover. You might use these to produce sounds or display images in a particular manner. Just about anything you can do in a Javascript function you can also do from a SiteSpinner link.

Javascript with a click
Invoke a Javascript function from a SiteSpinner link (on image or text) like this:
Link type: -blank-
Link URL: javascript:MyFunction()
Notes:
  • Change the boldface text to suit your purposes
  • MyFunction() is the name of the Javascript function you are calling and it can include arguments (parameters) inside the round brackets

    Javascript with a mouseover
    Invoke a Javascript function from a mouseover by setting a SiteSpinner link on an object like this:
    Link Type: -blank-
    Link URL: javascript:void('AnythingYouLike')"onmouseover="MyFunction()"
    Notes:
  • The notes for the click above also apply here
  • AnythingYouLike will be displayed on the status bar, so it is reasonable to use a name which represents what it is doing -- e.g. the name of an image
  • These mouseovers don't seem to interact with the regular SiteSpinner mouseovers, so you can generally use both effects together. But to use this effect by itself, you don't need a SiteSpinner SpecialFX, just a link.

    This message has been edited. Last edited by: Bruceee,
  •  
    Posts: 7959 | Location: Wellington, New Zealand | Registered: December 11, 2003Reply With QuoteEdit or Delete MessageReport This Post
    Honorary 'Adroit' Mechanic
    Picture of BruceM
    Posted Hide Post
    you should lose the last set of double quotes in the link statement example above.

    rationle:
    VM is producing code of the form
    <A HREF=" whatever your link statement is "></A>  


    so it provides the first and last double quotes for you.
     
    Posts: 295 | Location: London - UK | Registered: May 11, 2003Reply With QuoteEdit or Delete MessageReport This Post
    Guru 'Power' Mechanic
    Picture of Bruceee
    Posted Hide Post
    You're right -- that variant also works and has the advantage of being slightly simpler. The AnythingYouLike does not seem to need quotes either. So here's the amended line:

    Link URL: javascript:void(AnythingYouLike)"onmouseover="MyFunction()
     
    Posts: 7959 | Location: Wellington, New Zealand | Registered: December 11, 2003Reply With QuoteEdit or Delete MessageReport This Post
    Working Mechanic
    Posted Hide Post
    Hi Bruceee,
    I'm not too sure where to ask this question - and I'm not at all sure it concerns SiteSpinner! - but here goes:
    My site needs to be viewed in FULL SCREEN mode so this page - and 300 others - on my site http://www.LOCHORAMA.COM/81.html prompts users to press F11 (or F10+a+l if they're using a French keyboard). HOWEVER, probably due to the presence of my java applets, pressing F11 fails to open Fullscreen mode - at least that is the case on my keyboard and a lot of other folks. So French people have to press F10 + A + L - and God knows what key sequence English people have to utilize.
    Question: would you happen to know how I could make my "enter Fullscreen mode" button clickable - via a Java script or someother means - by people using keyboards of all nationalities?
    Thanks in advance Bruceee. And keep up the good work. SS is the best software I ever bought!
     
    Posts: 48 | Location: Loches, France | Registered: April 06, 2005Reply With QuoteEdit or Delete MessageReport This Post
    Guru 'Power' Mechanic
    Picture of Bruceee
    Posted Hide Post
     
    Posts: 7959 | Location: Wellington, New Zealand | Registered: December 11, 2003Reply With QuoteEdit or Delete MessageReport This Post
    Working Mechanic
    Posted Hide Post
    Hi Bruceee,

    What kind of use were you thinking of? I know I am being really dim here. I am migrating from a different program so finding my way around Sitespinner, which I am REALLY enjoying.

    Best wishes.

    Ali
     
    Posts: 86 | Location: UK | Registered: March 21, 2007Reply With QuoteEdit or Delete MessageReport This Post
    Guru 'Geezer' Mechanic
    Picture of larryd
    Posted Hide Post
    A small suggestion: change javascript:void(AnythingYouWant) to javascript:void()

    Since the Void function is going to throw away any values you pass it, save some time and pass it nothing. Also, it is better to use the javascript:void() instead of a URL of "#" when you want a null link. The "#" reference is used to signal a bookmark which causes the browser to look for a null bookmark. If you page uses bookmarks, you could get unexpected results.
     
    Posts: 3610 | Registered: December 03, 2006Reply With QuoteEdit or Delete MessageReport This Post
    Working Mechanic
    Posted Hide Post
    Hi

    Now I see. That is so handy. Thanks for taking the trouble to reply.

    Ali
     
    Posts: 86 | Location: UK | Registered: March 21, 2007Reply With QuoteEdit or Delete MessageReport This Post
     Previous Topic | Next Topic powered by eve community  
     


    ™ & © 1998 - 2008, Virtual Mechanics Inc. All rights reserved.