# Java Gallery mit reload ohne iframe Problem



## georgzed (25. Apr 2009)

Hallo

Ich habe eine Java gallery in einer php Seite, und wenn man auf das nächste Foto klickt ladet sich nur das nächste Foto neu und nicht die Seite mit der Werbung. Deswegen haben wir es so gelöst:


```
function setCaption(text) {
  a="<a href='JavaScript:sledeca(-1);' onclick='javascript:tests.location.reload(),test3.location.reload(),testso.location.reload(),test4.location.reload()()'; >&laquo;</a>";
  b="<a href='JavaScript:sledeca(1);' onclick='javascript:tests.location.reload(),test3.location.reload(),testso.location.reload(),test4.location.reload()';>&raquo;</a>";
  if (onoff) {
    a="";
    b="";
  }
```
und iframe 


```
<iframe src="http://www.xxx.xx/banner/300250/banner.php"
			
       name="tests" width="700" height="360" align="center"
        scrolling="no" marginheight="0" marginwidth="0"frameborder="0">
      Ihr Browser unterst&uuml;tzt keine Inline-Frames!</iframe>
```
die reloads test,test3 sind iframes die sich dann reloaden wenn man auf das nächste foto klickt nur jetzt muss ich die iframes loswerden weil das mein vermarkter nicht als gut empfindet ich hoffe ihr wisst eine lösung

Danke lg


----------



## Marco13 (25. Apr 2009)

Wie war das? "Java und JavaScript verhalten sich zueinander wie ein Wal und eine Walnuss..."  
http://www.java-forum.org/java-faq-beitraege/5566-java-ist-nicht-javascript.html


----------



## georgzed (25. Apr 2009)

Oh ich dummie sorry ok es ist javascript 
i am sorry

Ich hoffe es weiss trotzdem wer eine antwort


----------



## Matt (25. Apr 2009)

öhm ^^

meinst du sowas? BarackSlide

Oder eher sowas?

NoobSlide


----------



## georgzed (25. Apr 2009)

wenn dann eher das zweite nur nicht so zeitgerecht also modern es ist ein ganz altes gallery script ich poste mal den php code in ganzen vieleicht hilft es dann besser



```
<?
  define( 'DIR_ROOT', '../' );
  require( DIR_ROOT . 'include/application_top.php' );
  require( DIR_INCL . 'header.php' );
?>



 <script src="http://ads.adtiger.de/adscript.php?pid=2015" type="text/javascript" language="JavaScript"></script>
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width=1 background="/images/crno_vert.gif"><img src="/images/empty.gif" width="1" height="1" border="0"></td>
    <td width=160 align="left" valign="top"><? require( DIR_INCL . 'searchform.php' ); ?>

          <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <?
        $q = mysql_query( "SELECT bannersImg, bannersW, bannersH, bannersLink, bannersAlt, isFlash FROM banners WHERE bannersKat = 8550 AND is" . $lang . " = '1' ORDER BY bannersSort", $conn );
          while ( $r = mysql_fetch_assoc( $q ) ) {
            if ( $r['isFlash'] == '1' ) {
              ?>
              <tr align="center" valign="top">
                    <td><table border=1 bordercolor="#000000" style="border-collapse:collapse" cellspacing=0 cellpadding=2><tr><td><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="<?=$r['bannersW']; ?>" height="<?=$r['bannersH']; ?>">
                    <param name=movie value="<?=$r['bannersImg']; ?>">
                    <param name=quality value=high>
                    <embed src="<?=$r['bannersImg']; ?>" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="<?=$r['bannersW']; ?>" height="<?=$r['bannersH']; ?>">
                    </embed>
                  </object></td></tr></table>
                                </td>
                      </tr>
              <tr align="center" valign="top">
                        <td><img src="/images/empty.gif" border="0" width="1" height="2"></td>
              </tr>
              <?
            } else {
              ?>
              <tr align="left" valign="top">
                <td><table border=1 bordercolor="#000000" style="border-collapse:collapse" cellspacing=0 cellpadding=2><tr><td><a href="<?=$r['bannersLink']; ?>" target="_blank"><img src="<?=$r['bannersImg']; ?>" width="<?=$r['bannersW']; ?>" height="<?=$r['bannersH']; ?>" border="0" alt="<?=$r['bannersAlt']; ?>"></a></td></tr></table></td>
                      </tr>
              <tr align="center" valign="top">
                        <td><img src="/images/empty.gif" border="0" width="1" height="2"></td>
              </tr>
              <?
            }
          }
          mysql_free_result( $q );
                  ?>
      </table> 
	               
                 <!-- ### banner unten links
	               
 ### Banner unten links -->
  
<iframe src="http://www.xxx.at/banner/120600/banner.php"
			
       name="test4" width="160" height="700" align="center"
        scrolling="no" marginheight="0" marginwidth="0"frameborder="0">
      Ihr Browser unterst&uuml;tzt keine Inline-Frames!</iframe> 
        </td>
    
    <td width=847 align="center" valign="top">
  <?
      $q = mysql_query( "SELECT dateEventF, titleEventF, name FROM events_fotos, general WHERE idEventF = " . $_REQUEST['id'] . " AND placeEventF = id", $conn );
      while ( $r = mysql_fetch_assoc( $q ) ) {
      ?>
      <table width="100%"  border="0" cellspacing="5" cellpadding="0">
        <tr>
          <td width="100%" align="center" class="mdtxt"><b><?=date( 'd.m.Y', strtotime( $r['dateEventF'] ) ) . " : " . $r['name'] . ' : <a href="/fotos/album.php?id=' . $_REQUEST['id'] . '">' . $r['titleEventF']; ?></a></b></td>
        </tr>
        <tr>
          
        </tr>
      </table>
      <?
      }
      mysql_free_result( $q );
      ?>
      <script language="JavaScript" SRC="/js/client_sniff.js"></script>
<script language="JavaScript">
// Browser capabilities detection ---
// - assume only IE4+ and NAV6+ can do image resizing, others redirect to low
if ( (is_ie && !is_ie4up) || (is_opera && !is_opera5up) || (is_nav && !is_nav6up)) {
        document.location = "/gallery/slideshow.php?mode=low&amp;set_albumName=x-prize";
}
</script>

	<!-- ### banner oben von fotos




 ### banner  oben von fotos-->
      <?
      $query = mysql_query( "SELECT photoID, typePicture, placeEventF FROM events_fotos_data, events_fotos WHERE idAlbum =  " . $_REQUEST['id'] . " AND idAlbum = idEventF ORDER BY typePicture, photoID", $conn );
      $b = 0;
      while ( $result = mysql_fetch_assoc( $query ) ) {
        $b++;
        echo '<a id="photo_urls_'.$b.'" href="/upload/events-fotos/'.$result['placeEventF'].'-'.$_REQUEST['id'].'/'.$_REQUEST['id'].'-'.$result['photoID'].'.jpg"></a>';
        echo '<a id="full_photo_urls_'.$b.'" href="/upload/events-fotos/'.$result['placeEventF'].'-'.$_REQUEST['id'].'/'.$_REQUEST['id'].'-'.$result['photoID'].'.jpg"></a>';
      }
      mysql_free_result( $query );
          ?>

</script>
<script language="JavaScript">
var timer;
var current_location = <?=$_REQUEST['sort']; ?>;
var next_location = <?=$_REQUEST['sort']; ?>;
var pics_loaded = 0;
var onoff = 0;
var fullsized = 0;
var direction = 1;
var timeout_value;
var images = new Array;
var photo_urls = new Array;
var full_photo_urls = new Array;
var photo_captions = new Array;
var transitionNames = new Array;
var transitions = new Array;
var current_transition = 0;
var loop = 0;

<? for ( $i=1; $i<=$b; $i++ ) echo 'photo_captions['.$i.'] = "";'; ?>

transitions[0] = "progid:DXImageTransform.Microsoft.Fade(duration=1)";
transitions[1] = "progid:DXImageTransform.Microsoft.Blinds(Duration=1,bands=20)";
transitions[2] = "progid:DXImageTransform.Microsoft.Checkerboard(Duration=1,squaresX=20,squaresY=20)";
transitions[3] = "progid:DXImageTransform.Microsoft.Strips(Duration=1,motion=rightdown)";
transitions[4] = "progid:DXImageTransform.Microsoft.Barn(Duration=1,orientation=vertical)";
transitions[5] = "progid:DXImageTransform.Microsoft.GradientWipe(duration=1)";
transitions[6] = "progid:DXImageTransform.Microsoft.Iris(Duration=1,motion=out)";
transitions[7] = "progid:DXImageTransform.Microsoft.Wheel(Duration=1,spokes=12)";
transitions[8] = "progid:DXImageTransform.Microsoft.Pixelate(maxSquare=10,duration=1)";
transitions[9] = "progid:DXImageTransform.Microsoft.RadialWipe(Duration=1,wipeStyle=clock)";
transitions[10] = "progid:DXImageTransform.Microsoft.RandomBars(Duration=1,orientation=vertical)";
transitions[11] = "progid:DXImageTransform.Microsoft.Slide(Duration=1,slideStyle=push)";
transitions[12] = "progid:DXImageTransform.Microsoft.RandomDissolve(Duration=1,orientation=vertical)";
transitions[13] = "progid:DXImageTransform.Microsoft.Spiral(Duration=1,gridSizeX=40,gridSizeY=40)";
transitions[14] = "progid:DXImageTransform.Microsoft.Stretch(Duration=1,stretchStyle=push)";
transitions[15] = "special case";
var transition_count = 15;
var photo_count = <?=$b; ?>;

// - IE5.5 and up can do the blending transition.
var browserCanBlend = (is_ie5_5up);

function stopOrStart() {
if (onoff) {
stop();
} else {
play();
}
}

function fullOrNormal() {
images = new Array;
pics_loaded=0;
if (fullsized) {
normal();
} else {
full();
}
next_location = current_location;
preload_photo(next_location);
go_to_next_photo();
}

function toggleLoop() {
if (loop) {
loop = 0;
} else {
loop = 1;
}
}

function changeElementText(id, newText) {
element = document.getElementById(id);
element.innerHTML = newText;
}

function stop() {
changeElementText("stopOrStartText", "start slide show");

onoff = 0;
status = "The slide show is stopped, Click [start slide show] to resume.";
clearTimeout(timer);
setCaption(photo_captions[current_location]);

}

function play() {
changeElementText("stopOrStartText", "stop slide show");

onoff = 1;
status = "Slide show is running...";
go_to_next_photo();
}

function full() {
changeElementText("fullOrNormalText", "normal size");
fullsized = 1;
status = "The slide is showing full sized images, Click [normal size] to view resized images.";
}

function normal() {
changeElementText("fullOrNormalText", "full size");

fullsized = 0;
status = "The slide is showing normal sized images, Click [full size] to view full sized images.";
}

function changeDirection() {
if (direction == 1) {
direction = -1;
changeElementText("changeDirText", "forward direction");
} else {
direction = 1;
changeElementText("changeDirText", "reverse direction");
}
preload_next_photo();

}

function change_transition() {
current_transition = document.TopForm.transitionType.selectedIndex;
}

function preload_complete() {
}

function reset_timer() {
clearTimeout(timer);
if (onoff) {
timeout_value = document.TopForm.time.options[document.TopForm.time.selectedIndex].value * 1000;
timer = setTimeout('go_to_next_photo()', timeout_value);
}
}

function wait_for_current_photo() {

/* Show the current photo */
if (!show_current_photo()) {

/*
* The current photo isn't loaded yet.  Set a short timer just to wait
* until the current photo is loaded.
*/
status = "Picture is loading...(" + current_location + " of" + photo_count +
").  " + "Please Wait..." ;
clearTimeout(timer);
timer = setTimeout('wait_for_current_photo()', 500);
return 0;
} else {
status = "Slide show is running..." ;
preload_next_photo();
reset_timer();
}
}

function go_to_next_photo() {
/* Go to the next location */
current_location = next_location;

/* Show the current photo */
if (!show_current_photo()) {
wait_for_current_photo();
return 0;
}

preload_next_photo();
reset_timer();
}

function sledeca(x) {
  y = direction;
  direction = x;
  next_location = (parseInt(current_location) + parseInt(direction));
  if (next_location > photo_count) {
    next_location = 1;
    if (!loop) {
      stop();
    }
  }
  if (next_location == 0) {
    next_location = photo_count;
    if (!loop) {
      stop();
    }
  }
  preload_photo(next_location);
  direction = y;
  go_to_next_photo();
}

function preload_next_photo() {

/* Calculate the new next location */
next_location = (parseInt(current_location) + parseInt(direction));
if (next_location > photo_count) {
next_location = 1;
if (!loop) {
 stop();
}
}
if (next_location == 0) {
    next_location = photo_count;
if (!loop) {
 stop();
}
}

/* Preload the next photo */
preload_photo(next_location);
}

function show_current_photo() {

/*
 * If the current photo is not completely loaded don't display it.
 */
if (!images[current_location] || !images[current_location].complete) {
preload_photo(current_location);
return 0;
}

/* transistion effects */
if (browserCanBlend){
var do_transition;
if (current_transition == (transition_count)) {
 do_transition = Math.floor(Math.random() * transition_count);
} else {
 do_transition = current_transition;
}
document.images.slide.style.filter=transitions[do_transition];
document.images.slide.filters[0].Apply();
}
document.slide.src = images[current_location].src;
setCaption(photo_captions[current_location]);

if (browserCanBlend) {
document.images.slide.filters[0].Play();
}

return 1;
}

function preload_photo(index) {

/* Load the next picture */
if (pics_loaded < photo_count) {

/* not all the pics are loaded.  Is the next one loaded? */
if (!images[index]) {
 images[index] = new Image;
 images[index].onLoad = preload_complete();
 if (fullsized) {
        images[index].src = document.getElementById("full_photo_urls_" + index).href;
 } else {
        images[index].src = document.getElementById("photo_urls_" + index).href;
 }
 pics_loaded++;
}
}
}

function setCaption(text) {
  a="<a href='JavaScript:sledeca(-1);' onclick='javascript:tests.location.reload(),test3.location.reload(),testso.location.reload(),test4.location.reload()()'; >&laquo;</a>";
  b="<a href='JavaScript:sledeca(1);' onclick='javascript:tests.location.reload(),test3.location.reload(),testso.location.reload(),test4.location.reload()';>&raquo;</a>";
  if (onoff) {
    a="";
    b="";
  }
  changeElementText("caption", a + " &nbsp; [" + current_location + " of " + photo_count + "] &nbsp; " + b);
  //  changeElementText("caption", "[" + current_location + " of " + photo_count + "] " + text);
}

</Script>







	               <!-- ### Banner direkt oberhalb von fotos

 ### Banner direkt oberhalb von fotos -->

<table width="100%" border="0" cellspacing="0" cellpadding="0" class="modnavboxmid">
 <form name="TopForm">
  <tr>
        <td align="center" valign="middle">
<? // &nbsp;<a class="admin" href='#' onClick='fullOrNormal(); return false;'>[<span id='fullOrNormalText'>full size</span>]</a>; ?>
&nbsp;<a class="crno" href='#' onClick='stopOrStart(); return false;'>[<span id='stopOrStartText'>start slide show</span>]</a>&nbsp; &nbsp;<a class="crno" href='#' onClick='changeDirection(); return false;'>[<span id='changeDirText'>reverse direction</span>]</a>&nbsp; &nbsp;Delay:&nbsp;<select name="time" size=1  onchange="reset_timer()" style="font-size:9px;">
<option value=1 >1 second</option>
<option value=2 >2 seconds</option>
<option value=3 selected>3 seconds</option>
<option value=4 >4 seconds</option>
<option value=5 >5 seconds</option>
<option value=10 >10 seconds</option>
<option value=15 >15 seconds</option>
<option value=30 >30 seconds</option>
<option value=45 >45 seconds</option>
<option value=60 >60 seconds</option>
</select>
    <script language="Javascript">
    /* show the blend select if appropriate */
    if (browserCanBlend) {
        document.write('&nbsp;Transition:&nbsp;<select name="transitionType" size=1  onchange="change_transition()" style="font-size:9px;"> <option value=0 selected>Blend</option> <option value=1 >Blinds</option> <option value=2 >Checkerboard</option> <option value=3 >Diagonal</option> <option value=4 >Doors</option> <option value=5 >Gradient</option> <option value=6 >Iris</option> <option value=7 >Pinwheel</option> <option value=8 >Pixelate</option> <option value=9 >Radial</option> <option value=10 >Rain</option> <option value=11 >Slide</option> <option value=12 >Snow</option> <option value=13 >Spiral</option> <option value=14 >Stretch</option> <option value=15 >RANDOM!</option> </select> ');
    }


    </script>&nbsp;Loop:&nbsp;<input type="checkbox" name="loopCheck"  onclick='toggleLoop();'>
        </td>
  </tr>
 </form>

<td align="center" valign="middle">


	               <!-- ### Banner unterhalb von start slideshow 

 ### Banner unterhalb von start slideshow -->

              <tr align="center" valign="top">

                        <td><img src="/images/empty.gif" border="0" width="1" height="2"></td>

              </tr>

<table border="0" cellspacing="0" cellpadding="0">
<tr>
        <td><script language="JavaScript">
                firstPhotoURL = document.getElementById("photo_urls_" + <?=$_REQUEST['sort']; ?>).href;
                document.write("<img border=1 bgcolor=black src=\"");
                document.write(firstPhotoURL);
                document.write("\" name=slide>");
        </script></td>
</tr>
</table>

<!-- banner -->







<script language="Javascript">
/* show the caption */
document.write("<div class='bigsm' id='caption'></div>");
/* Load the first picture */
setCaption(photo_captions[<?=$_REQUEST['sort']; ?>]);
preload_photo(<?=$_REQUEST['sort']; ?>);
/* Start the show. */
// play();
</script>

      <center>
<table><td><a href="http://www.xxx.at" target="_blank">
<img align="right" src="http://www.xxx.at/upload/banners/dan_kuechen.gif">
</a><br><p>&nbsp;</p></td></tr>
</table>
<iframe src="http://www.xxx.at/banner/300250/banner.php"
			
       name="tests" width="700" height="360" align="center"
        scrolling="no" marginheight="0" marginwidth="0"frameborder="0">
      Ihr Browser unterst&uuml;tzt keine Inline-Frames!</iframe> 
      








 </a>

</a><br>&nbsp;</td>


    <td width=1 background="/images/crno_vert.gif"><img src="/images/empty.gif" width="1" height="1" border="0"></td>
  </tr>
  
  
</table>



<? require( DIR_ROOT . "include/footer.php" ); ?>
```

danke


----------



## Matt (25. Apr 2009)

Hier mal schnell runtergekritzelt.... ist aber glaub net das was du suchst da die bilder von vorne rein geladen werden

```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
  "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title></title>

<script type="text/javascript">
<!--
// Image-Preloader
var arrImg = new Array();
arrImg[0] = new Image();
arrImg[0].src = "pics/1.jpg";  // Pfad zum Bild
arrImg[0].txt = "Bild  1";              // Gewünschter Text
arrImg[1] = new Image();
arrImg[1].src = "pics/2.jpg";
arrImg[1].txt = "Bild  2";
arrImg[2] = new Image();
arrImg[2].src = "pics/3.jpg";
arrImg[2].txt = "Bild  3";
arrImg[3] = new Image();
arrImg[3].src = "pics/4.jpg";
arrImg[3].txt = "Bild  4";
arrImg[4] = new Image();
arrImg[4].src = "pics/5.jpg";
arrImg[4].txt = "Bild  5";
arrImg[5] = new Image();
arrImg[5].src = "pics/6.jpg";
arrImg[5].txt = "Bild  6";
arrImg[6] = new Image();
arrImg[6].src = "pics/7.jpg";
arrImg[6].txt = "Bild  7";
arrImg[7] = new Image();
arrImg[7].src = "pics/8.jpg";
arrImg[7].txt = "Bild  8";


// swapImage
function swapImage(imgName, intImg){
  document.getElementById(imgName+"_imgID").src = arrImg[intImg].src;
  document.getElementById(imgName+"_outID").innerHTML = arrImg[intImg].txt;

  return false;
}
//-->
</script>

<style type="text/css">
<!--
ul {
margin: 10px 0 0 0;
padding: 0;
}

li {
display: inline;
margin: 0 5px 0 0;
}

img {
border: 0;
}
-->
</style>

</head>
<body algin="center" valign="top">
<ul>
  <li><a href="#" onclick="return swapImage('start', 0);"><img src="pics/1.jpg" alt="load pic01" width="140" height="120"></a></li>
  <li><a href="#" onclick="return swapImage('start', 1);"><img src="pics/2.jpg" alt="load pic02" width="140" height="120"></a></li>
  <li><a href="#" onclick="return swapImage('start', 2);"><img src="pics/3.jpg" alt="load pic03" width="140" height="120"></a></li>
  <li><a href="#" onclick="return swapImage('start', 3);"><img src="pics/4.jpg" alt="load pic04" width="140" height="120"></a></li>
  <li><a href="#" onclick="return swapImage('start', 4);"><img src="pics/5.jpg" alt="load pic01" width="140" height="120"></a></li>
  <li><a href="#" onclick="return swapImage('start', 5);"><img src="pics/6.jpg" alt="load pic02" width="140" height="120"></a></li>
  <li><a href="#" onclick="return swapImage('start', 6);"><img src="pics/7.jpg" alt="load pic03" width="140" height="120"></a></li>
  <li><a href="#" onclick="return swapImage('start', 7);"><img src="pics/8.jpg" alt="load pic04" width="140" height="120"></a></li>
</ul>

<div id="imageBox">
  <img src="pics/1.jpg" alt="" id="start_imgID" width="700" height="600">
  <div id="start_outID">Bild  0</div>
</div>



</body>
</html>
```

wenn ich morgen zeit hab kann ich ja noch ne ähnliche variante mal herbeizaubern mit NoobSlide - das Sample 7 und 8 oder so ^^


----------



## georgzed (26. Apr 2009)

hmm das war nicht das was ich brauche ich brauch zB: ein onclick und dann das er das script in einen div statt in einen iframe reloadet. danke lg


----------

