WordPress.org

Ready to get started?Download WordPress

Forums

Yahoo User Interface and WordPress, Javascript Array Problem (3 posts)

  1. WhisperPress
    Member
    Posted 3 years ago #

    I'm using a YUI 2 calendar widget within a wordpress installation, and have a problem printing a date array.

    Here are the configuration options of the calendar, to see how the dates are passed as a non-array, for example "11/12/10,04/12/11"
    http://developer.yahoo.com/yui/calendar/#config

    Here is the code I'm using, with an anonymous function:
    http://pastebin.com/qASAsxGh

    When the page loads, it's completely blank except for the date_array which is printed at the top of the page. Does wordpress need some additional work around for this to function?

    I've already done enqueues for several other javascript pieces, however I find it strange that the calendar loads perfectly with the dates highlighted if I pass in "11/12/10,04/12/11", but does not work if I try to use the function DateAnon()

    http://pastebin.com/i6vQv6n4

    I appreciate any and all help!

    WP

  2. WhisperPress
    Member
    Posted 3 years ago #

    I found the answer thanks to blast007 in #YUI on the freenode IRC.

    if you do a document.write after the page is loaded, it will overwrite your entire page

    you probably want to have a placeholder element (say, a div) that you then manipulate the contents of - or maybe you really just want to send that data to a debugger like Firebug

  3. WhisperPress
    Member
    Posted 3 years ago #

    Best Answer:

    Use DOM Manipulation methods instead of document.write

    http://stackoverflow.com/questions/802854/why-is-document-write-considered-a-bad-practice

Topic Closed

This topic has been closed to new replies.

About this Topic