Hallo liebe WWW-Mitglieder,
ich habe eine Frage zu dem unten aufgeführten JavaScript. Ich möchte dieses Script zweimal in einer HTML aufgeführt haben. Er führt es mir jedoch nur einmal zum Schluss aus. Ich habe herausgefunden, dass es an dem Konditional-Befehl liegt: cross_marqueeup=document.getElementById? document.getElementById(„iemarqueeup“): document.all.iemarqueeup
Ich habe jedoch keinen schimmer, wie ich den Befehl abändern muss, um beide gleichzeitig anzeigen zu lassen.
In JS bin ich nicht sehr versiert und wäre sehr dankbar, wenn ihr mir bei dem Problem helfen könntet. Vielleicht gibt es auch eine andere Lösung für das Problem.
Ich danke euch schon mal im Voraus und viele Grüße
Mr.Marbl
Unbenanntes Dokument
/*
Vertical Pausing Slideshow - freely adapted from:
Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100’s more DHTML scripts, and TOS, visit http://www.dynamicdrive.com
Modified by jscheuer1 for continuous content slideshow. Credit MUST stay intact for use
visit http://www.dynamicdrive.com/forums
*/
//Specify the marquee’s width (in pixels)
var marqueewidth=„140px“
//Specify the marquee’s height
var marqueeheight=„225px“
//Specify the marquee’s marquee speed (larger is faster 1-10)
var marqueespeed=1
//Specify initial pause before scrolling in milliseconds
var initPause=1000
//Specify start with Full(1)or Empty(0) Marquee
var full=1
//Pause marquee onMousever (0=no 1=yes)?
var pauseit=1
//Specify images’ border
imgBorder=0
var photos=new Array();
//Specify images, optional link, optional target:
photos[0]=[‚bild1.jpg‘, ‚http://www.google.com‘, ‚_blank‘] //Image w/link and target
photos[1]=[‚bild2.jpg‘, 'http://www.dynamicdrive.com’] //Image w/link
photos[2]=[‚bild3.jpg‘] //Plain Image
photos[3]=[‚bild4.jpg‘]
photos[4]=[‚bild5.jpg‘]
photos[5]=[‚bild6.jpg‘]
photos[6]=[‚bild7.jpg‘]
photos[7]=[‚bild8.jpg‘]
photos[8]=[‚bild9.jpg‘]
////NO NEED TO EDIT BELOW THIS LINE////////////
var preload=new Array()
for (var i_tem = 0; i_tem < photos.length; i_tem++){
preload[i\_tem]=new Image()
preload[i\_tem].src=photos[i\_tem][0]
}
var actualheight=marqueecontent=’’
var copyspeed=marqueespeed
var pausespeed=(pauseit)? 0 : copyspeed
var iedom=document.all||document.getElementById
var cross_marquee, cross_marquee2, ns_marquee
for (var i_tem = 0; i_tem < photos.length; i_tem++){
if (typeof photos[i\_tem][1]!==‚undefined‘){
marqueecontent+=’<a href="’+photos[i\_tem][1]+’"’
marqueecontent+=typeof photos[i\_tem][2]!==‚undefined‘? ’ target="’+photos[i\_tem][2]+’"’ : ‚‘
marqueecontent+=’>’
}
marqueecontent+=’<img src="’+photos[i\_tem][0]+’" alt=„Image #’+[i\_tem+1]+’“ border="’+imgBorder+’"><br>’
marqueecontent+=typeof photos[i\_tem][1]!==‚undefined‘? ‚</a>‘ : ‚‘
}
if (iedom||document.layers){
with (document){
if (iedom){
write(’<div style=„overflow:hidden;“><div style=„position:relative;width:’+marqueewidth+’;height:’+marqueeheight+’;overflow:hidden“ onMouseover=„copyspeed=pausespeed“ onMouseout=„copyspeed=marqueespeed“>’)
write(’<div id=„iemarquee“ style=„position:absolute;left:0px;bottom:0px;width:100%;“><table align=„center“><tr><td height="’+marqueeheight+’" align=„center“ valign=„middle“>Loading . . .</td></tr></table>’)
write(’</div><div id=„iemarquee2“ style=„position:absolute;left:0px;bottom:0px;width:100%;“>’)
write(’</div></div></div>’)
}
else if (document.layers){
write(’<ilayer width=’+marqueewidth+’ height=’+marqueeheight+’ name=„ns_marquee“>’)
write(’<layer name=„ns_marquee2“ width=’+marqueewidth+’ height=’+marqueeheight+’ left=0 bottom=0 onMouseover=„copyspeed=pausespeed“ onMouseout=„copyspeed=marqueespeed“></layer>’)
write(’</ilayer>’)
}
}
}
function populate(){
if (document.all)
for (var i_tem = 0; i_tem < preload.length; i_tem++) //for (var i_tem = 0; i_tem < preload.length; i_tem++)
if (typeof preload[i\_tem].complete==‚boolean‘&&!preload[i\_tem].complete){
setTimeout(„populate();“, 2000)
return;
}
if (iedom){
cross_marquee=document.getElementById? document.getElementById(„iemarquee“) : document.all.iemarquee
cross_marquee2=document.getElementById? document.getElementById(„iemarquee2“) : document.all.iemarquee2
cross_marquee.style.bottom=(full=10)? ‚0px‘ : parseInt(marqueeheight)+0+„px“
cross_marquee2.innerHTML=cross_marquee.innerHTML=marqueecontent
actualheight=cross_marquee.offsetHeight
cross_marquee2.style.bottom=(parseInt(cross_marquee.style.bottom)+actualheight+0)+„px“ //indicates following #1
}
else if (document.layers){
ns_marquee=document.ns_marquee.document.ns_marquee2
ns_marquee.bottom=parseInt(marqueeheight)+8
ns_marquee.document.write(marqueecontent)
ns_marquee.document.close()
actualheight=ns_marquee.document.height
}
setTimeout(‚lefttime=setInterval(„scrollmarquee()“,20)‘,initPause)
}
window.onload=populate
function scrollmarquee(){
if (iedom){
if (parseInt(cross_marquee.style.bottom)<(actualheight*(-1)))
cross_marquee.style.bottom=(parseInt(cross_marquee2.style.bottom)+actualheight)+„px“
if (parseInt(cross_marquee2.style.bottom)<(actualheight*(-1)))
cross_marquee2.style.bottom=(parseInt(cross_marquee.style.bottom)+actualheight)+„px“
cross_marquee2.style.bottom=parseInt(cross_marquee2.style.bottom)-copyspeed+„px“
cross_marquee.style.bottom=parseInt(cross_marquee.style.bottom)-copyspeed+„px“
}
else if (document.layers){
if (ns_marquee.bottom>(actualheight*(-1)+8))
ns_marquee.bottom-=copyspeed
else
ns_marquee.bottom=parseInt(marqueeheight)+8
}
}
Raum für den Inhalt von id „iemarquee“
Raum für den Inhalt von id „iemarquee2“
/*
Vertical Pausing Slideshow - freely adapted from:
Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
For full source code, 100’s more DHTML scripts, and TOS, visit http://www.dynamicdrive.com
Modified by jscheuer1 for continuous content slideshow. Credit MUST stay intact for use
visit http://www.dynamicdrive.com/forums
*/
var photosup=new Array();
//Specify images, optional link, optional target:
photosup[0]=[‚bild1.jpg‘, ‚http://www.google.com‘, ‚_blank‘] //Image w/link and target
photosup[1]=[‚bild1.jpg‘, 'http://www.dynamicdrive.com’] //Image w/link
photosup[2]=[‚bild3.jpg‘] //Plain Image
photosup[3]=[‚bild1.jpg‘]
photosup[4]=[‚bild1.jpg‘]
photosup[5]=[‚bild6.jpg‘]
photosup[6]=[‚bild1.jpg‘]
photosup[7]=[‚bild1.jpg‘]
photosup[8]=[‚bild9.jpg‘]
////NO NEED TO EDIT BELOW THIS LINE////////////
var preloadup=new Array()
for (var i_tem = 0; i_tem < photosup.length; i_tem++){
preloadup[i\_tem]=new Image()
preloadup[i\_tem].src=photosup[i\_tem][0]
}
var actualheight=marqueecontent=’’
var copyspeed=marqueespeed
var pausespeed=(pauseit)? 0 : copyspeed
var iedomup=document.all||document.getElementById
var cross_marqueeup, cross_marqueeup2, ns_marqueeup
for (var i_tem = 0; i_tem < photosup.length; i_tem++){
if (typeof photosup[i\_tem][1]!==‚undefined‘){
marqueecontent+=’<a href="’+photosup[i\_tem][1]+’"’
marqueecontent+=typeof photosup[i\_tem][2]!==‚undefined‘? ’ target="’+photosup[i\_tem][2]+’"’ : ‚‘
marqueecontent+=’>’
}
marqueecontent+=’<img src="’+photosup[i\_tem][0]+’" alt=„Image #’+[i\_tem+1]+’“ border="’+imgBorder+’"><br>’
marqueecontent+=typeof photosup[i\_tem][1]!==‚undefined‘? ‚</a>‘ : ‚‘
}
if (iedomup||document.layers){
with (document){
if (iedomup){
write(’<div style=„overflow:hidden;“><div style=„position:relative;width:’+marqueewidth+’;height:’+marqueeheight+’;overflow:hidden“ onMouseover=„copyspeed=pausespeed“ onMouseout=„copyspeed=marqueespeed“>’)
write(’<div id=„iemarqueeup“ style=„position:absolute;left:0px;bottom:0px;width:100%;“><table align=„center“><tr><td height="’+marqueeheight+’" align=„center“ valign=„middle“>Loading . . .</td></tr></table>’)
write(’</div><div id=„iemarqueeup2“ style=„position:absolute;left:0px;bottom:0px;width:100%;“>’)
write(’</div></div></div>’)
}
else if (document.layers){
write(’<ilayer width=’+marqueewidth+’ height=’+marqueeheight+’ name=„ns_marqueeup“>test2d1’)
write(’<layer name=„ns_marqueeup2“ width=’+marqueewidth+’ height=’+marqueeheight+’ left=0 bottom=0 onMouseover=„copyspeed=pausespeed“ onMouseout=„copyspeed=marqueespeed“></layer>’)
write(’</ilayer>’)
}
}
}
function populateup(){
if (document.all)
for (var i_tem = 0; i_tem < preloadup.length; i_tem++)
if (typeof preloadup[i\_tem].complete==‚boolean‘&&!preloadup[i\_tem].complete){
setTimeout(„populateup();“, 2000)
return;
}
if (iedomup){
cross_marqueeup=document.getElementById? document.getElementById(„iemarqueeup“): document.all.iemarqueeup
cross_marqueeup2=document.getElementById? document.getElementById(„iemarqueeup2“) : document.all.iemarqueeup2
cross_marqueeup.style.bottom=(full=10)? ‚0px‘ : parseInt(marqueeheight)+0+„px“
cross_marqueeup2.innerHTML=cross_marqueeup.innerHTML=marqueecontent
actualheight=cross_marqueeup.offsetHeight
cross_marqueeup2.style.bottom=(parseInt(cross_marqueeup.style.bottom)+actualheight+0)+„px“ //indicates following #1
}
else if (document.layers){
ns_marqueeup=document.ns_marqueeup.document.ns_marqueeup2
ns_marqueeup.bottom=parseInt(marqueeheight)+8
ns_marqueeup.document.write(marqueecontent)
ns_marqueeup.document.close()
actualheight=ns_marqueeup.document.height
}
setTimeout(‚lefttime=setInterval(„scrollmarqueeup()“,20)‘,initPause)
}
window.onload=populateup
function scrollmarqueeup(){
if (iedomup){
if (parseInt(cross_marqueeup.style.bottom)<(actualheight*(-1)))
cross_marqueeup.style.bottom=(parseInt(cross_marqueeup2.style.bottom)+actualheight)+„px“
if (parseInt(cross_marqueeup2.style.bottom)<(actualheight*(-1)))
cross_marqueeup2.style.bottom=(parseInt(cross_marqueeup.style.bottom)+actualheight)+„px“
cross_marqueeup2.style.bottom=parseInt(cross_marqueeup2.style.bottom)-copyspeed+„px“
cross_marqueeup.style.bottom=parseInt(cross_marqueeup.style.bottom)-copyspeed+„px“
}
else if (document.layers){
if (ns_marqueeup.bottom>(actualheight*(-1)+8))
ns_marqueeup.bottom-=copyspeed
else
ns_marqueeup.bottom=parseInt(marqueeheight)+8
}
}