Creating text on one page only
-
This feels like a stupid question, but I have been trying to figure out a solution for days now.
I want to put an ad on one page of my blog only. I want the text to show up on only the home page.
I would love to do it through a widget, but they seem to add text only to the sidebar site-wide.
I have recently been playing with a javascript to check the URL and write the content only if it is the main page.
<script type="text/javascript"> if (document.location.href!= "https://www.jeffreyteam.com/blog/index.php") { document.write(); } </script>
Simple enough, right? It does seem to work, but only for bare text. When I start to add any formatting, it gets strange. Some formatting seems to work, but anything involving CSS positioning (absolute mainly) makes the script crap out and display the text on all pages. If I add a top-margin, then it ****s the whole site.
Even stranger, if I have a style such as
<P STYLE="color:#999999; margin-bottom:13px; margin-right:225px; font-size:11px; float:right;">
and I remove the float, then everything seems to work. But I cannot get the position right. If I try some other code, then the text starts to appear on all pages again. Delete the formatting and it goes back to displaying on one page only.
I need to be able to format the text so it does not look like crap. Plus add some links.
Does anyone have any ideas? I can go back to
<FONT COLOR="aaaaaa" SIZE="-1">
again if I have to, but that does not help with the positioning.I know I am missing something small and stupid… but happy to have it pointed out.
Thanks!
- The topic ‘Creating text on one page only’ is closed to new replies.