Condition insertion

M

Martin Honnen

Wim said:
Is it possible to make a file insertion conditional?

I now have the code
'<script type="text/javascript" src="http://www.site.com/showit.js">'

And I wondered if it is possible to make this conditional, something like:
if (mycondition==true) include('http://www.site.com/showit.js');

Don't you know document.write?
<script type="text/javascript">
if (mycondition) {
document.write(
'<script type="text/javascript" src="file.js"><\/script>');
}
</script>
 
T

Thomas 'PointedEars' Lahn

Martin said:
Don't you know document.write?
<script type="text/javascript">
if (mycondition) {
document.write(
'<script type="text/javascript" src="file.js"><\/script>');
}
</script>

Note that this is likely to fail in NN4 due to the NRLB.
(I think we had this discussion before.)


PointedEars
 
T

Thomas 'PointedEars' Lahn

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top