Skocz do zawartości
t9omek

Wymiana fragmentu strony

Polecane posty

Witam, pobrałem skrypt ze strony http://www.gajdaw.pl/ajax/ajax-php-wymiana-fragmentu-strony/print.html - przykład piąty. Chciałbym ustawić żeby abba była wartością domyślną np wchodzę na stronę i mam abba, w przykładzie pojawia się pusta strona.

 

warstwy.js

function ukryj()
{
    document.getElementById('opcja1').style.display = 'none';
    document.getElementById('opcja2').style.display = 'none';
    document.getElementById('opcja3').style.display = 'none';
    document.getElementById('opcja4').style.display = 'none';
    document.getElementById('opcja5').style.display = 'none';                
}

function wymienTresc(id)
{
    ukryj();
    document.getElementById(id).style.display = 'block';
}

index.html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>Wykonawcy/płyty</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link rel="stylesheet" type="text/css" href="style.css" />
    <script type="text/javascript" src="warstwy.js"></script>    
  </head>
<body>

<div id="pojemnik">
  <ol id="menu">
    <li><a href="#" onclick="wymienTresc('opcja1');">ABBA: Super Trouper</a></li>
    <li><a href="#" onclick="wymienTresc('opcja2');">AC/DC: Flick of the Switch</a></li>


  </ol>
  <div id="content">
    <div id="opcja1">
      <h1>ABBA</h1><h2>Super Trouper</h2><h2>1980</h2><table><tr><th>lp.</th><th>title</th><th>czas</th></tr><tr><td>1.</td><td>Super Trouper</td><td>4:11</td></tr><tr><td>2.</td><td>The Winner Takes It All</td><td>4:56</td></tr><tr><td>3.</td><td>On and on and On</td><td>3:40</td></tr><tr><td>4.</td><td>Andante, Andante</td><td>4:39</td></tr><tr><td>5.</td><td>Me and I</td><td>4:54</td></tr><tr><td>6.</td><td>Happy New Year</td><td>4:24</td></tr><tr><td>7.</td><td>Our Last Summer</td><td>4:18</td></tr><tr><td>8.</td><td>The Piper</td><td>3:26</td></tr><tr><td>9.</td><td>Lay All Your Love on Me</td><td>4:33</td></tr><tr><td>10.</td><td>The Way Old Friends Do</td><td>2:58</td></tr></table>
    </div>
    <div id="opcja2">
	    <li><a href="#" onclick="wymienTresc('opcja3');">Aerosmith: Draw the Line</a></li>
    <li><a href="#" onclick="wymienTresc('opcja4');">Black Sabbath: Eternal Idol</a></li>
    <li><a href="#" onclick="wymienTresc('opcja5');">Bob Dylan: Basement Tapes</a></li>
      <h1>AC/DC</h1><h2>Flick of the Switch</h2><h2>1983</h2><table><tr><th>lp.</th><th>title</th><th>czas</th></tr><tr><td>1.</td><td>Rising Power</td><td>3:42</td></tr><tr><td>2.</td><td>This House Is on Fire</td><td>3:23</td></tr><tr><td>3.</td><td>Flick of the Switch</td><td>3:13</td></tr><tr><td>4.</td><td>Nervous Shakedown</td><td>4:28</td></tr><tr><td>5.</td><td>Landslide</td><td>3:56</td></tr><tr><td>6.</td><td>Guns for Hire</td><td>3:24</td></tr><tr><td>7.</td><td>Deep in the Hole</td><td>3:19</td></tr><tr><td>8.</td><td>Bedlam in Belgium</td><td>3:53</td></tr><tr><td>9.</td><td>Badlands</td><td>3:37</td></tr><tr><td>10.</td><td>Brain Shake</td><td>4:09</td></tr></table>
    </div>
    <div id="opcja3">
      <h1>Aerosmith</h1><h2>Draw the Line</h2><h2>1977</h2><table><tr><th>lp.</th><th>title</th><th>czas</th></tr><tr><td>1.</td><td>Draw the Line</td><td>3:23</td></tr><tr><td>2.</td><td>I Wanna Know Why</td><td>3:09</td></tr><tr><td>3.</td><td>Critical Mass</td><td>4:52</td></tr><tr><td>4.</td><td>Get It Up</td><td>4:02</td></tr><tr><td>5.</td><td>Bright Light Fright</td><td>2:19</td></tr><tr><td>6.</td><td>Kings and Queens</td><td>4:56</td></tr><tr><td>7.</td><td>The Hand That Feeds</td><td>4:22</td></tr><tr><td>8.</td><td>Sight for Sore Eyes</td><td>3:56</td></tr><tr><td>9.</td><td>Milk Cow Blues</td><td>4:14</td></tr></table>
    </div>
    <div id="opcja4">
      <h1>Black Sabbath</h1><h2>Eternal Idol</h2><h2>1987</h2><table><tr><th>lp.</th><th>title</th><th>czas</th></tr><tr><td>1.</td><td>The Shining</td><td>5:59</td></tr><tr><td>2.</td><td>Ancient Warrior</td><td>5:33</td></tr><tr><td>3.</td><td>Hard Life to Love</td><td>5:00</td></tr><tr><td>4.</td><td>Glory Ride</td><td>4:48</td></tr><tr><td>5.</td><td>Born to Lose</td><td>3:44</td></tr><tr><td>6.</td><td>Nightmare</td><td>5:16</td></tr><tr><td>7.</td><td>Scarlet Pimpernel</td><td>2:07</td></tr><tr><td>8.</td><td>Lost Forever</td><td>4:00</td></tr><tr><td>9.</td><td>Eternal Idol</td><td>6:36</td></tr></table>
    </div>
    <div id="opcja5">
      <h1>Bob Dylan</h1><h2>Basement Tapes</h2><h2>1975</h2><table><tr><th>lp.</th><th>title</th><th>czas</th></tr><tr><td>1.</td><td>Odds and Ends</td><td>1:46</td></tr><tr><td>2.</td><td>Orange Juice Blues (Blues for Breakfast)</td><td>3:37</td></tr><tr><td>3.</td><td>Million Dollar Bash</td><td>2:32</td></tr><tr><td>4.</td><td>Yazoo Street Scandal</td><td>3:27</td></tr><tr><td>5.</td><td>Goin' to Acapulco</td><td>5:26</td></tr><tr><td>6.</td><td>Katie's Been Gone</td><td>2:43</td></tr><tr><td>7.</td><td>Lo and Behold</td><td>2:46</td></tr><tr><td>8.</td><td>Bessie Smith</td><td>4:17</td></tr><tr><td>9.</td><td>Clothesline Saga</td><td>2:56</td></tr><tr><td>10.</td><td>Apple Suckling Tree</td><td>2:48</td></tr><tr><td>11.</td><td>Please, Mrs. Henry</td><td>2:32</td></tr><tr><td>12.</td><td>Tears of Rage</td><td>4:11</td></tr><tr><td>13.</td><td>Too Much of Nothing</td><td>3:01</td></tr><tr><td>14.</td><td>Yea Heavy and a Bottle of Bread</td><td>2:13</td></tr><tr><td>15.</td><td>Ain't No More Cane</td><td>3:57</td></tr><tr><td>16.</td><td>Crash on the Levee (Down in the Flood)</td><td>2:03</td></tr><tr><td>17.</td><td>Ruben Remus</td><td>3:13</td></tr><tr><td>18.</td><td>Tiny Montgomery</td><td>2:45</td></tr><tr><td>19.</td><td>You Ain't Going Nowhere</td><td>2:43</td></tr><tr><td>20.</td><td>Don't Ya Tell Henry</td><td>3:12</td></tr><tr><td>21.</td><td>Nothing Was Delivered</td><td>4:22</td></tr><tr><td>22.</td><td>Open the Door, Homer</td><td>2:49</td></tr><tr><td>23.</td><td>Long Distance Operator</td><td>3:39</td></tr><tr><td>24.</td><td>This Wheel's on Fire</td><td>3:49</td></tr></table>
    </div>
  
  
  </div>
</div>

</body>
</html>
Edytowano przez t9omek (zobacz historię edycji)

Udostępnij ten post


Link to postu
Udostępnij na innych stronach

Bądź aktywny! Zaloguj się lub utwórz konto

Tylko zarejestrowani użytkownicy mogą komentować zawartość tej strony

Utwórz konto

Zarejestruj nowe konto, to proste!

Zarejestruj nowe konto

Zaloguj się

Posiadasz własne konto? Użyj go!

Zaloguj się


×