WordPress.org

Forums

WordPress javascript (5 posts)

  1. richardl
    Member
    Posted 8 years ago #

    I have done google searches on how to use javascript and wordpress but I have not been able to get anything to work.

    Am I missing something?
    All I am trying to do is add some javascript to a single static page. And for my counter. But when I make the edits the code disapears.

  2. vkaryl
    Member
    Posted 8 years ago #

    Have you tried surrounding the js with //<![CDATA[ tags?

  3. richardl
    Member
    Posted 8 years ago #

    Didnt work ..

    <script language="JavaScript" type="text/javascript">
    <![CDATA[

    <CENTER> <IMG src="/cam/01.jpg" width="320" height="240" border="1" name="refresh"> </CENTER>

    var t = 9 // interval in seconds
    image = "/cam/01.jpg" //name of the image
    function Start() {
    tmp = new Date();
    tmp = "?"+tmp.getTime()
    document.images["refresh"].src = image+tmp
    setTimeout("Start()", t*1000)
    }
    Start();

    ]]>

    </script>

  4. moshu
    Member
    Posted 8 years ago #

    Are you adding the JS to the content or to a template?

    See also: http://codex.wordpress.org/Using_Javascript

  5. richardl
    Member
    Posted 8 years ago #

    This code is going in a regular page.
    Not in a template.

    Thanks
    Richard

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags