¿Como insertar un script correctamente?
Quisiera saber como inserto un script o javascript en mi web llevo algun timpo intentando poner scripts en mi web y al momento de ponerlos no sale nada me podrias decir donde se ponen y si llevan otra cosa extra para que funcionen
1 respuesta
Respuesta de Marcelo Origoni
1
1

El codigo es bien simple
<script type="text/javascript" src="direccion/de/tu/archivo"></script>
o bien
<script type="text/javascript">
Tu Codigo
</script>
Lo ideal es que lo hagas dentro del tag head, pero puedes invocarlo en cualquier lugar del codigo, sin problema alguno.
<script type="text/javascript" src="direccion/de/tu/archivo"></script>
o bien
<script type="text/javascript">
Tu Codigo
</script>
Lo ideal es que lo hagas dentro del tag head, pero puedes invocarlo en cualquier lugar del codigo, sin problema alguno.

hola
el problema es que lo he insertado como me has indicado por que investigue anteriormente pero cuando pongo el script no sale nada en mi pagina web no se porque pasa esto, se supone que esta bien el codigo y lo puse bien no se si me pudieras ayudar
saludos
el problema es que lo he insertado como me has indicado por que investigue anteriormente pero cuando pongo el script no sale nada en mi pagina web no se porque pasa esto, se supone que esta bien el codigo y lo puse bien no se si me pudieras ayudar
saludos

hola
este codigo es funcional para ponerlo en mi web o tiene algo mal por eso no sirve, lo pongo entre HEAD y HEAD pero no anda
CODIGO=
<script language="JavaScript1.2">
/******************************************
* Slideshow Script - HTML.Dynamico 2001
* Mas Scripts y Recursos para tu web en:
* http://www.htmldynamico.cjb.net
******************************************/
var variableslide=new Array()
//variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]
variableslide[0]=['caba.gif', '', '']
variableslide[1]=['caba2.gif', 'http://www.htmldynamico.cjb.net/', 'Texto']
variableslide[2]=['caba3.gif', '', '']
//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth=197 //set to width of LARGEST image in your slideshow
var slideheight=150 //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#F3F3F3'
//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000
////Do not edit pass this line////////////////
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
for (i=0;i<variableslide.length;i++){
var cacheimage=new Image()
cacheimage.src=variableslide[0]
}
var currentslide=0
function rotateimages(){
contentcontainer='<center>'
if (variableslide[currentslide][1]!="")
contentcontainer+='<a href="'+variableslide[currentslide][1]+'">'
contentcontainer+='<img src="'+variableslide[currentslide][0]+'" border="0" vspace="3">'
if (variableslide[currentslide][1]!="")
contentcontainer+='</a>'
contentcontainer+='</center>'
if (variableslide[currentslide][2]!="")
contentcontainer+=variableslide[currentslide][2]
if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotateimages()",slidedelay)
}
if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')
function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotateimages()
}
if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider
</script>
<ilayer id="slidensmain" width=&{slidewidth}; height=&{slideheight}; bgColor=&{slidebgcolor}; visibility=hide><layer id="slidenssub" width=&{slidewidth}; left=0 top=0></layer></ilayer>
SALUDOS
este codigo es funcional para ponerlo en mi web o tiene algo mal por eso no sirve, lo pongo entre HEAD y HEAD pero no anda
CODIGO=
<script language="JavaScript1.2">
/******************************************
* Slideshow Script - HTML.Dynamico 2001
* Mas Scripts y Recursos para tu web en:
* http://www.htmldynamico.cjb.net
******************************************/
var variableslide=new Array()
//variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]
variableslide[0]=['caba.gif', '', '']
variableslide[1]=['caba2.gif', 'http://www.htmldynamico.cjb.net/', 'Texto']
variableslide[2]=['caba3.gif', '', '']
//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth=197 //set to width of LARGEST image in your slideshow
var slideheight=150 //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#F3F3F3'
//configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000
////Do not edit pass this line////////////////
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1
for (i=0;i<variableslide.length;i++){
var cacheimage=new Image()
cacheimage.src=variableslide[0]
}
var currentslide=0
function rotateimages(){
contentcontainer='<center>'
if (variableslide[currentslide][1]!="")
contentcontainer+='<a href="'+variableslide[currentslide][1]+'">'
contentcontainer+='<img src="'+variableslide[currentslide][0]+'" border="0" vspace="3">'
if (variableslide[currentslide][1]!="")
contentcontainer+='</a>'
contentcontainer+='</center>'
if (variableslide[currentslide][2]!="")
contentcontainer+=variableslide[currentslide][2]
if (document.layers){
crossrotateobj.document.write(contentcontainer)
crossrotateobj.document.close()
}
else if (ie||dom)
crossrotateobj.innerHTML=contentcontainer
if (currentslide==variableslide.length-1) currentslide=0
else currentslide++
setTimeout("rotateimages()",slidedelay)
}
if (ie||dom)
document.write('<div id="slidedom" style="width:'+slidewidth+';height:'+slideheight+'; background-color:'+slidebgcolor+'"></div>')
function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub
if (document.layers)
document.slidensmain.visibility="show"
rotateimages()
}
if (ie||dom)
start_slider()
else if (document.layers)
window.onload=start_slider
</script>
<ilayer id="slidensmain" width=&{slidewidth}; height=&{slideheight}; bgColor=&{slidebgcolor}; visibility=hide><layer id="slidenssub" width=&{slidewidth}; left=0 top=0></layer></ilayer>
SALUDOS

¿El navegador no te tira ningun error?
Cambia el
<script language="JavaScript1.2">
por
<script type="tet/javascritp">
Cambia el
<script language="JavaScript1.2">
por
<script type="tet/javascritp">

hola ya le cambie pero no me sigue saliendo nada y el navegar abajito dice "Listo pero con errores en la pagina" no se que andara mal, puedes pasarte por mi web digitalmonsters.netne.net y en VER, Codigo Fuente para que verifiquez donde esta puesto y que no sale nada
saludos
saludos

Por eso uso firefox, por que me dice exactamente donde está el error :P
Intenta este codigo
<script type="text/javascript">
/******************************************
* Slideshow Script - HTML.Dynamico 2001
* Mas Scripts y Recursos para tu web en:
* http://www.htmldynamico.cjb.net
******************************************/
var variableslide=new Array();
//variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]
variableslide[0]=['web_images/halo3odst.jpg', '', ''];
variableslide[1]=['web_images/the-beatles-rock-band-teaser.jpg', 'http://www.htmldynamico.cjb.net/', 'Texto'];
variableslide[2]=['web_images/need_for_speed_shift_logo.jpg', '', ''];
//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth=197; //set to width of LARGEST image in your slideshow
var slideheight=150; //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#F3F3F3';
//Configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000;
////Do not edit pass this line////////////////
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1;
for (i=0;i<variableslide.length;i ){
var cacheimage=new Image();
cacheimage.src=variableslide[0];
}
var currentslide=0;
function rotateimages(){
contentcontainer='<center>';
if (variableslide[currentslide][1]!=""){
contentcontainer ='<a href="' variableslide[currentslide][1] '">';
contentcontainer ='<img src="' variableslide[currentslide][0] '" border="0" vspace="3">';
}
if (variableslide[currentslide][1]!=""){
contentcontainer ='</a>';
contentcontainer ='</center>';
}
if (variableslide[currentslide][2]!=""){
contentcontainer =variableslide[currentslide][2];
}
if (document.layers){
crossrotateobj.document.write(contentcontainer);
crossrotateobj.document.close();
}
else if (ie||dom){
crossrotateobj.innerHTML=contentcontainer;
}
if (currentslide==variableslide.length-1){ currentslide=0;}
else {currentslide ;}
setTimeout("rotateimages()",slidedelay);
}
if (ie||dom){
document.write('<div id="slidedom" style="width:' slidewidth ';height:' slideheight '; background-color:' slidebgcolor '"></div>');
}
function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub;
if (document.layers){
document.slidensmain.visibility="show";
rotateimages();
}
}
if (ie||dom){
start_slider();
}else if (document.layers){
window.onload=start_slider;
}
</script>
Intenta este codigo
<script type="text/javascript">
/******************************************
* Slideshow Script - HTML.Dynamico 2001
* Mas Scripts y Recursos para tu web en:
* http://www.htmldynamico.cjb.net
******************************************/
var variableslide=new Array();
//variableslide[x]=["path to image", "OPTIONAL link for image", "OPTIONAL text description (supports HTML tags)"]
variableslide[0]=['web_images/halo3odst.jpg', '', ''];
variableslide[1]=['web_images/the-beatles-rock-band-teaser.jpg', 'http://www.htmldynamico.cjb.net/', 'Texto'];
variableslide[2]=['web_images/need_for_speed_shift_logo.jpg', '', ''];
//configure the below 3 variables to set the dimension/background color of the slideshow
var slidewidth=197; //set to width of LARGEST image in your slideshow
var slideheight=150; //set to height of LARGEST iamge in your slideshow, plus any text description
var slidebgcolor='#F3F3F3';
//Configure the below variable to determine the delay between image rotations (in miliseconds)
var slidedelay=3000;
////Do not edit pass this line////////////////
var ie=document.all&&navigator.userAgent.indexOf("Opera")==-1;
var dom=document.getElementById&&navigator.userAgent.indexOf("Opera")==-1;
for (i=0;i<variableslide.length;i ){
var cacheimage=new Image();
cacheimage.src=variableslide[0];
}
var currentslide=0;
function rotateimages(){
contentcontainer='<center>';
if (variableslide[currentslide][1]!=""){
contentcontainer ='<a href="' variableslide[currentslide][1] '">';
contentcontainer ='<img src="' variableslide[currentslide][0] '" border="0" vspace="3">';
}
if (variableslide[currentslide][1]!=""){
contentcontainer ='</a>';
contentcontainer ='</center>';
}
if (variableslide[currentslide][2]!=""){
contentcontainer =variableslide[currentslide][2];
}
if (document.layers){
crossrotateobj.document.write(contentcontainer);
crossrotateobj.document.close();
}
else if (ie||dom){
crossrotateobj.innerHTML=contentcontainer;
}
if (currentslide==variableslide.length-1){ currentslide=0;}
else {currentslide ;}
setTimeout("rotateimages()",slidedelay);
}
if (ie||dom){
document.write('<div id="slidedom" style="width:' slidewidth ';height:' slideheight '; background-color:' slidebgcolor '"></div>');
}
function start_slider(){
crossrotateobj=dom? document.getElementById("slidedom") : ie? document.all.slidedom : document.slidensmain.document.slidenssub;
if (document.layers){
document.slidensmain.visibility="show";
rotateimages();
}
}
if (ie||dom){
start_slider();
}else if (document.layers){
window.onload=start_slider;
}
</script>
- Compartir respuesta
- Anónimo
ahora mismo
