Consti
asked on
How to Input a extern file into a html document.
Well here we go, one of my "seems to be hard but is easy" question.
I have a part of a html document looking like that:
.
.
.
<table cellpadding=0 cellspacing=0 border=0 width=180>
<tr><td><td></tr>
<tr><td background="pix/short_sect ion_bar_bg .gif" height=14 valign=center>
.: Special :.
</td></tr>
</table>
<table cellpadding=2 border=0 width=180 bgcolor=#827968>
<TBODY>
<tr><td width=180>
<script language="JavaScript">
<!--
i=Math.floor(Math.random() * 4 );
switch(i)
{
case 0:
document.write("<img src='random/image1.jpg'>") ;
break;
case 1:
document.write("<img src='random/image2.jpg'>") ;
break;
case 2:
document.write("<img src='random/image3.jpg'>") ;
break;
case 3:
document.write("<img src='random/image4.jpg'>") ;
break;
case 4:
document.write("<img src='random/image5.jpg'>") ;
break;
case 5:
document.write("<img onmouseover='color(this)' onmouseout='gray(this)' src='random/image6.jpg'>") ;
break;
}//-->
</script>
</center>
</td></tr>
</TBODY>
</table>
.
.
.
AND i want this small script not really IN the html file, i want something like that in the Html File:
.
.
.
<script language="?Html?" src="scripts/special.js">
</script>
.
.
.
When the User starts the *.html file, the script should be loaded like above.
I need this script for my website: www.speedlight.de
Because i dont use any frames and i want easily change a part of the pages (its not easy to understand ;-))
Well, hope you understand!
Thank
You
Consti
I have a part of a html document looking like that:
.
.
.
<table cellpadding=0 cellspacing=0 border=0 width=180>
<tr><td><td></tr>
<tr><td background="pix/short_sect
.: Special :.
</td></tr>
</table>
<table cellpadding=2 border=0 width=180 bgcolor=#827968>
<TBODY>
<tr><td width=180>
<script language="JavaScript">
<!--
i=Math.floor(Math.random()
switch(i)
{
case 0:
document.write("<img src='random/image1.jpg'>")
break;
case 1:
document.write("<img src='random/image2.jpg'>")
break;
case 2:
document.write("<img src='random/image3.jpg'>")
break;
case 3:
document.write("<img src='random/image4.jpg'>")
break;
case 4:
document.write("<img src='random/image5.jpg'>")
break;
case 5:
document.write("<img onmouseover='color(this)' onmouseout='gray(this)' src='random/image6.jpg'>")
break;
}//-->
</script>
</center>
</td></tr>
</TBODY>
</table>
.
.
.
AND i want this small script not really IN the html file, i want something like that in the Html File:
.
.
.
<script language="?Html?" src="scripts/special.js">
</script>
.
.
.
When the User starts the *.html file, the script should be loaded like above.
I need this script for my website: www.speedlight.de
Because i dont use any frames and i want easily change a part of the pages (its not easy to understand ;-))
Well, hope you understand!
Thank
You
Consti
ASKER
And when i just want to input some text?
A non-Javascript thing?
A non-Javascript thing?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I can't read because I don't know German, but it looks great. Glad I could help. Thanks for the A. :^)
Cd&
Cd&
i=Math.floor(Math.random()
switch(i)
{
case 0:
document.write("<img src='random/image1.jpg'>")
break;
case 1:
document.write("<img src='random/image2.jpg'>")
break;
case 2:
document.write("<img src='random/image3.jpg'>")
break;
case 3:
document.write("<img src='random/image4.jpg'>")
break;
case 4:
document.write("<img src='random/image5.jpg'>")
break;
case 5:
document.write("<img onmouseover='color(this)' onmouseout='gray(this)' src='random/image6.jpg'>")
break;
}
Then remove the scripting from the page and just put in:
<script language="JavaScript" src="scripts/special.js">
</script>
The code on the page will look like this:
<table cellpadding=0 cellspacing=0 border=0 width=180>
<tr><td><td></tr>
<tr><td background="pix/short_sect
.: Special :.
</td></tr>
</table>
<table cellpadding=2 border=0 width=180 bgcolor=#827968>
<TBODY>
<tr><td width=180>
<script language="JavaScript" src="scripts/special.js">
</script>
</center>
</td></tr>
</TBODY>
</table>
The code in the .js file will get executed during the load to generate the
other code.
Cd&