@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
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.
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.
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.
Answers
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.
let me guess an this function uses
document.write
....?grep is your friend.
is this third party ad code? Calling an external script?
grep is your friend.
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 .
❌ ✊ ♥. ¸. ••. ¸♥¸. ••. ¸♥ ✊ ❌
you could do
grep is your friend.
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 {
}
`
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.
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.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.
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.