Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Options

How to replace the output html content?

2»

Answers

  • Options
    hgtonighthgtonight ∞ · New MVP

    My question is why do you have to run the js right after the body tag?

    If this is an absolute, must-have feature, put it in your custom theme default.master file.

    Search first

    Check out the Documentation! We are always looking for new content and pull requests.

    Click on insightful, awesome, and funny reactions to thank community volunteers for their valuable posts.

  • Options

    let me guess an this function uses document.write ....?

    grep is your friend.

  • Options
    x00x00 MVP
    edited April 2013

    is this third party ad code? Calling an external script?

    grep is your friend.

  • Options
    vrijvlindervrijvlinder Papillon-Sauvage MVP

    @wzttest1 said:
    Hi x00:
    Are you vanilla offical guys?

    we were all officially baptized by vanilla, we are Vanillites :)

    although x00 has a special kind of voodoo coding talents which make him more officially a Vanilla official .

  • Options
    x00x00 MVP
    edited April 2013

    you could do

    $('body').prepend('<script type="text/javascript">mytestcall();</script>');
    

    grep is your friend.

  • Options
    lifeisfoolifeisfoo Zombie plugins finder ✭✭✭
    edited April 2013

    @wzttest1 said:
    Hi:
    It's my work need to do.We need accomplish a feature that generate and insert some block html/js codes after the body tag,for example generate a banner on the top of the site.

    Any help would be appreciative.
    Thanks.

    I think that a top page banner can be added easily without pushing it at the start of the body tag. Suppose you have a web page is structured like this

    <html> <head></head> <body> <div>a div</div> <div>another</div> <div id="my-top-banner">Hi guest! This is a nice top banner!</div> <script>javascript ninja code</script> </body> </html>

    You can have the last div at the top of the page using only some css

    `

    my-top-banner {

    position: absolute;
    left: 0px;
    top: 0px;
    height: 50px;
    

    }
    `

    After you need to make space for it

    body { padding-top: 50px; }

    The div and the javascript can be pushed at any position in the page using methods reported in this discussion.
    I think that this will solve your problem.

    There was an error rendering this rich post.

  • Options
    wzttest1wzttest1 New
    edited April 2013

    @x00 said:
    you could do

    $('body').prepend('mytestcall();');

    Hello guys:
    Thank you very much for your all help.:)
    I think $('body').prepend('<script type="text/javascript">mytestcall();</script>'); would be what I need,I'll try for this.

  • Options

    @x00 said:
    you could do

    $('body').prepend('mytestcall();');

    Hi:
    After this $('body').prepend('<script type="text/javascript">mytestcall();</script>'); has been insert after the body tag,how to make the mytestcall() running on the web page?
    Thanks.

  • Options

    It will run. Debug, check you code as why is no producing the result you want. Use firebug, or chrome inspect.

    Alternatively redactor you code, so you don't have to resort to such methods.

    grep is your friend.

Sign In or Register to comment.