WordPress.org

Ready to get started?Download WordPress

Forums

Javascript in posts (12 posts)

  1. zygosis
    Member
    Posted 9 years ago #

    Question from javascript and php newbie....
    Why does my javascript work in a plain html page (see http://www.zygosis.co.uk/wp/java.html) but not when I enter the same code in a post?
    Thanks for any help - it's been driving me silly tonight trying to figure it out.
    David

  2. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Because a plain html page just outputs what you input.
    WP sends what you write through filters and such.
    This has been asked before - how to get it to work - but I can't recall an answer. A search should turn stuff up though.

  3. zygosis
    Member
    Posted 9 years ago #

    That URL should of course be http://www.zygosis.co.uk/wp/java.html
    Here's the same script in a post http://www.zygosis.co.uk/wp/index.php?cat=16. clicking on the link does nothing.
    Thanks
    David

  4. zygosis
    Member
    Posted 9 years ago #

    I did try searching on 'Java' and 'Javascript' before posting without throwing up the necessary help. Anyone point to the previous relevant posts?
    Thanks
    David

  5. Mark (podz)
    Support Maven
    Posted 9 years ago #

    Looking at what you want, why not add a 'target="_blank"' to the link ?

  6. zygosis
    Member
    Posted 9 years ago #

    What I'm after is a new window but without the menu/toolbars and with a fixed height and width (the links will be to some images that look cleaner in a simple window that matches the image size).

  7. zygosis
    Member
    Posted 9 years ago #

    Can anyone help? or point me in the direction of relevant resources?
    I'm always keen to learn how as well as be handed a solution on a plate!

  8. zygosis
    Member
    Posted 9 years ago #

    Nope. That don't work either - see http://www.zygosis.co.uk/wp/index.php?cat=16
    This is really disappointing.......
    Thanks though for an elegant suggestion.

  9. Anonymous
    Unregistered
    Posted 9 years ago #

  10. zygosis
    Member
    Posted 9 years ago #

    Attaboy. That's what I wanted.
    Many, many thanks!

  11. zygosis
    Member
    Posted 9 years ago #

    Spoke too soon....Works fine as long as I only want it to happen once per page. If I add others (I want a series of pop-up images from posts on the same page) then every one defaults to the first link entered.
    Can anyone add a further refinement?

  12. zygosis
    Member
    Posted 9 years ago #

    Drat it. Of course the answer is to include javascript in the 'head' section of index.php!
    Sorry to take up airtime - hope my tortured path helps someone else.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.