Click to See Complete Forum and Search --> : HTML code inside of Javascript


Valleriani
05-05-2007, 12:12 AM
Hello, what I am trying to do is add html coding inside javascript. This coding:

<script type="text/javascript">
thundertext_aff_id = "XXX media";
thundertext_cname = "XXX Media";
thundertext_sid = "";
thundertext_border_color = "000000";
thundertext_bg_color = "000000";
thundertext_adtype = "contextual";
//-->
</script>
<script type="text/javascript" src="http://www.xxxx.com/contextual/thunder_ad.php"></script>

I want it so it's in a Javascript, so I can call it without having too add several lines inside my pages, as well as people not being able to see it becuase my account name is there as well. I've never done javascripting before, but perhaps someone can help me or guide me through it. Any links describing things like what I need here is most helpful!

Thank you!

Valleriani
05-05-2007, 04:13 AM
My bad, I got the first part, but can you put in

<script type="text/javascript" src="http://www.xxxx.com/contextual/thunder_ad.php"></script>

Inside the .JS file?

Basicly a calling of JS within JS.

felgall
05-05-2007, 06:48 PM
<script type="text/javascript">
function addJavascript(jsname) {
var th = document.getElementsByTagName('head')[0];
var s = document.createElement('script');
s.setAttribute('type','text/javascript');
s.setAttribute('src',jsname);
th.appendChild(s);
}

thundertext_aff_id = "XXX media";
thundertext_cname = "XXX Media";
thundertext_sid = "";
thundertext_border_color = "000000";
thundertext_bg_color = "000000";
thundertext_adtype = "contextual";
addJavascript('http://www.xxxx.com/contextual/thunder_ad.php');
</script>