Forums

Does any know how to implement Java Script for a Page or Post (8 posts)

  1. sands2
    Member
    Posted 3 years ago #

    Does any know how to implement Java Script for a Page or Post?

    Or perhaps can point me to a forum that does?

    I note every Java question goes unanswered here, so perhaps some member is aware of a WP forum that could answer this one.

    Thank you.

  2. Hiranthi
    Member
    Posted 3 years ago #

    Could you be more specific in where you would like to add it?

    Would you like to add it to a Page/Post in the admin-section (so you can use it there for a specific plugin or something like it), do you want to add it to every page (which would mean you'd have to edit your theme-files) or do you want to be able to have the javascript added to one page/post and not the other (which would mean you should use the custom-fields, my favourite plugin for that is more-fields).

  3. sands2
    Member
    Posted 3 years ago #

    Hi

    I use a copy to clipboard Java script that uses a flash player.

    You know the kind: "Click the button to copy the text to your Clipboard".

    I just don't know where to drop the java script and the needed flash player.

    I don't even know here the posts reside! Which directory holds them?

    Thank you.

  4. Otto
    Tech Ninja
    Posted 3 years ago #

    If it's just a script, switch to the HTML editor and just paste it into your post.

  5. sands2
    Member
    Posted 3 years ago #

    THank you Otto.

    And Which Directory Holds the Posts and Pages?

    I need to put a Flash PLayer in the same directory as the Java.

  6. Otto
    Tech Ninja
    Posted 3 years ago #

    They aren't in any directory. Your post content is held in the database. You'll need to put the flash code somewhere on the site and then reference it by URL.

  7. sands2
    Member
    Posted 3 years ago #

    Otto,

    Where in this Javas Script should I put the html code pointing to the whwr I have the flash player?

    <script type="text/javascript"><!--
    function copy(text2copy) {
    if (window.clipboardData) {
    window.clipboardData.setData("Text",text2copy);
    } else {
    var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
    var divholder = document.createElement('div');
    divholder.id = flashcopier;
    document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<span class="mceItemEmbed" src="_clipboard.swf" mce_src="_clipboard.swf" FlashVars="clipboard='+escape(text2copy)+'" width="0" height="0" type="application/x-shockwave-flash"></span>';
    document.getElementById(flashcopier).innerHTML = divinfo;
    }
    }
    // --></script>

  8. Otto
    Tech Ninja
    Posted 3 years ago #

    See where it says src="_clipboard.swf" mce_src="_clipboard.swf"? That's the link to your swf file (which I assume is named _clipboard.swf). You need to make those two the full URL path to your file instead.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags