WordPress.org

Ready to get started?Download WordPress

Forums

invisible javascript? (4 posts)

  1. spitstatic
    Member
    Posted 8 years ago #

    I know that javascript can be used in a post or page if you call it externally. But I'm still having a problem.

    I made a page here:
    http://spitstatic.net/exchanges/

    I'm calling the following code:
    <script type="text/javascript" src="http://www.villainess.net/fading/exchange.js"></script>

    When I view the resulting page, it does not show up. But upon viewing the source code, it's there. Also, if I go to edit the page, at the bottom of the page it appears with no problem (where you see a preview of the post or page). So I don't understand what is keeping the result from appearing on the published page.

    I don't have anything in my CSS that would hide it.

    Would anyone be willing to tell me what I'm doing wrong, or what I can do to fix this?

  2. jabecker
    Member
    Posted 8 years ago #

    Does it just display a button? I can see it.

  3. Orin
    Member
    Posted 8 years ago #

    If you're calling an external javascript, it's best to place it inside the <head> element. But remember all you're doing is telling the browser to go get it. The code has to be executed as a behavior, meaning you'll be calling an event somewhere.

    Say you want to execute the whole code when a page loads. You'd type <body onload="exchange.js"> For a list of common event handlers, look here. I'm not quite sure what your script does, but there is also a way to execute only one function in any code you have imported.

  4. Lorelle
    Member
    Posted 8 years ago #

    I've tested out using javascript within a post and the answer is here: http://wordpress.org/support/topic/33137

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags