Click to See Complete Forum and Search --> : simpleton question
melbelle80
04-21-2008, 03:09 AM
i realize this question may be really stupid, but all the same i need an answer! i am doing a slideshow and need to input the images:
//Specify the slider's images
var rightleftslide=new Array()
var finalslide=''
rightleftslide[0]='<a href="photos.html"><img src="images/1.jpg" border=0></a>'
rightleftslide[1]='<a href="photos.html"><img src="images/2.jpg" border=0></a>'
how exactly do i get the images in html form? do i need to create a seperate page that i will input? i am new to learning code, it is still very foreign which is why i'm asking. thanks!
Drazan
04-21-2008, 03:17 AM
This is partial code.
The array takes all the listed images and links and holds in a variable. This variable is held invisibly until it is called.
This could be javascript or php so there's two different answers depending on the code source.
Basicaly, though you should be looking for possibly document.print or if php an echo or print command that will handle the variable.
so - if you have a link to where you got the script or at least a little more information we'll be able to help you more.
melbelle80
04-21-2008, 11:02 PM
well it's for a slideshow type thing I want to insert and found here:
http://www.dynamicdrive.com/dynamicindex14/leftrightslide.htm
the complete code is below and i'm looking for how to get the images which is highlighted in red (i've gotten it to work using a copied html code from photobucket, but i don't want to do it this way obviously):
<script type="text/javascript">
/***********************************************
* Conveyor belt slideshow script- © Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/
//Specify the slider's width (in pixels)
var sliderwidth="300px"
//Specify the slider's height
var sliderheight="150px"
//Specify the slider's slide speed (larger is faster 1-10)
var slidespeed=3
//configure background color:
slidebgcolor="#EAEAEA"
//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="http://"><img src="dynamicbook1.gif" border=1></a>'
leftrightslide[1]='<a href="http://"><img src="dynamicbook2.gif" border=1></a>'
leftrightslide[2]='<a href="http://"><img src="dynamicbook3.gif" border=1></a>'
leftrightslide[3]='<a href="http://"><img src="dynamicbook4.gif" border=1></a>'
leftrightslide[4]='<a href="http://"><img src="dynamicbook5.gif" border=1></a>'
//Specify gap between each image (use HTML):
var imagegap=" "
//Specify pixels gap between each slideshow rotation (use integer):
var slideshowgap=5
////NO NEED TO EDIT BELOW THIS LINE////////////
var copyspeed=slidespeed
leftrightslide='<nobr>'+leftrightslide.join(imagegap)+'</nobr>'
var iedom=document.all||document.getElementById
if (iedom)
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100px;left:-9000px">'+leftrightslide+'</span>')
var actualwidth=''
var cross_slide, ns_slide
function fillup(){
if (iedom){
cross_slide=document.getElementById? document.getElementById("test2") : document.all.test2
cross_slide2=document.getElementById? document.getElementById("test3") : document.all.test3
cross_slide.innerHTML=cross_slide2.innerHTML=leftr ightslide
actualwidth=document.all? cross_slide.offsetWidth : document.getElementById("temp").offsetWidth
cross_slide2.style.left=actualwidth+slideshowgap+"px"
}
else if (document.layers){
ns_slide=document.ns_slidemenu.document.ns_slideme nu2
ns_slide2=document.ns_slidemenu.document.ns_slidem enu3
ns_slide.document.write(leftrightslide)
ns_slide.document.close()
actualwidth=ns_slide.document.width
ns_slide2.left=actualwidth+slideshowgap
ns_slide2.document.write(leftrightslide)
ns_slide2.document.close()
}
lefttime=setInterval("slideleft()",30)
}
window.onload=fillup
function slideleft(){
if (iedom){
if (parseInt(cross_slide.style.left)>(actualwidth*(-1)+8))
cross_slide.style.left=parseInt(cross_slide.style. left)-copyspeed+"px"
else
cross_slide.style.left=parseInt(cross_slide2.style .left)+actualwidth+slideshowgap+"px"
if (parseInt(cross_slide2.style.left)>(actualwidth*(-1)+8))
cross_slide2.style.left=parseInt(cross_slide2.styl e.left)-copyspeed+"px"
else
cross_slide2.style.left=parseInt(cross_slide.style .left)+actualwidth+slideshowgap+"px"
}
else if (document.layers){
if (ns_slide.left>(actualwidth*(-1)+8))
ns_slide.left-=copyspeed
else
ns_slide.left=ns_slide2.left+actualwidth+slideshow gap
if (ns_slide2.left>(actualwidth*(-1)+8))
ns_slide2.left-=copyspeed
else
ns_slide2.left=ns_slide.left+actualwidth+slideshow gap
}
}
if (iedom||document.layers){
with (document){
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
if (iedom){
write('<div style="position:relative;width:'+sliderwidth+';height:'+s liderheight+';overflow:hidden">')
write('<div style="position:absolute;width:'+sliderwidth+';height:'+s liderheight+';background-color:'+slidebgcolor+'" onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed">')
write('<div id="test2" style="position:absolute;left:0px;top:0px"></div>')
write('<div id="test3" style="position:absolute;left:-1000px;top:0px"></div>')
write('</div></div>')
}
else if (document.layers){
write('<ilayer width='+sliderwidth+' height='+sliderheight+' name="ns_slidemenu" bgColor='+slidebgcolor+'>')
write('<layer name="ns_slidemenu2" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('<layer name="ns_slidemenu3" left=0 top=0 onMouseover="copyspeed=0" onMouseout="copyspeed=slidespeed"></layer>')
write('</ilayer>')
}
document.write('</td></table>')
}
}
</script>
<p align="center"><font face="Arial" size="-2">Free DHTML scripts provided by<br>
<a href="http://dynamicdrive.com">Dynamic Drive</a></font></p>
noantsinmypants
04-22-2008, 02:08 AM
If you are using dreamweaver, you can achieve this much easier.
Drazan
04-22-2008, 03:11 AM
Change the code like so:
//Specify the slider's images
var leftrightslide=new Array()
var finalslide=''
leftrightslide[0]='<a href="http://domain.com/link.html"><img src="http://domain.com/image.jpg" border=1></a>'
leftrightslide[1]='<a href="http://domain.com/link.html"><img src="http://domain.com/image2.jpg" border=1></a>'
leftrightslide[2]='<a href="http://domain.com/link.html"><img src="http://domain.com/image3.jpg" border=1></a>'
leftrightslide[3]='<a href="http://domain.com/link.html"><img src="http://domain.com/image4.jpg" border=1></a>'
leftrightslide[4]='<a href="http://domain.com/link.html"><img src="http://domain.com/image5.jpg" border=1></a>'
You'll need to make your own images and size them accordingly, then upload them to your host. Make sure that the location you put them matches the location of the image URL.
Else I'm not sure what you mean.
php code
<?php
if(is_array($finalrightslide)) {
foreach($finalrightslide as $nLink) {
echo $nLink."\n";
}
}
?>
printed HTML
<a href="http://domain.com/link.html"><img src="http://domain.com/image.jpg" border=1></a>
<a href="http://domain.com/link.html"><img src="http://domain.com/image2.jpg" border=1></a>
<a href="http://domain.com/link.html"><img src="http://domain.com/image3.jpg" border=1></a>
<a href="http://domain.com/link.html"><img src="http://domain.com/image4.jpg" border=1></a>
<a href="http://domain.com/link.html"><img src="http://domain.com/image5.jpg" border=1></a>
This loop will print the the entire string(including the anchor). If you would just like the <img /> tags then that procedure becomes more complex.
In order to access the individual strings within the array you would use this syntax:
php code
<?php echo $finalrightslide[0]; ?>
printed HTML
<a href="http://domain.com/link.html"><img src="http://domain.com/image.jpg" border=1></a>