Forum Moderators: open

Message Too Old, No Replies

External .js file

         

juanstiller

9:02 pm on Jan 5, 2006 (gmt 0)

10+ Year Member



Hi to all,

I īve recently suscripted to a online newspaper, that gives me the possibilitie to show news on my website, and they gave me this link to include on my site.

The thing is that i want to insert it on a table and i want to use external js file instead of the hole script.

This is the hole script that guys from newspaper gave me:

<script src='http://www.servicios.example.com/noticiasensusitio/jsp/nss.jsp?id=9784&check=1413045767&ancho=10&color=20&tamano=10&cantidad=20'></script>

on my site im using this code instead:

<script src="scripts/example.js" type="text/javascript"></script>

and i have a folder called scripts where i have a file called example.js wich has the original code that guys from the newspaper gave me.

But its not working, any idea why? Am i doing something wrong?

Thanks.

Juan.

[edited by: tedster at 12:33 am (utc) on Jan. 6, 2006]

milanmk

12:14 am on Jan 6, 2006 (gmt 0)

10+ Year Member



How about adding

document.write('<script src="http://www.servicios.example.com/noticiasensusitio/jsp/nss.jsp?id=9784&check=1413045767&ancho=10&color=20&tamano=10&cantidad=20"><\/script>');

to your example.js file.

I hope it solve your problem.

[edited by: tedster at 12:33 am (utc) on Jan. 6, 2006]

juanstiller

10:02 pm on Jan 6, 2006 (gmt 0)

10+ Year Member



Milanmk, thanks for answering, i just got one more question, how do i call it from the table where i want this script to be executed?

Thanks.

Juan

milanmk

7:13 pm on Jan 8, 2006 (gmt 0)

10+ Year Member



Make a function and place that javascript code into it and call that function in your table where you want that script to be executed.

<script language="javascript">

function news()
{
YOUR NEWS CODE HERE
}

</script>

<table>
<tr>
<td>
<script type="text/javascript">news()</script>
</td>
</tr>
</table>