Jump to content

Caitlin-havener

Members
  • Posts

    282
  • Joined

  • Last visited

Everything posted by Caitlin-havener

  1. Hey there! I'm trying to read in a csv and split the data at commas unless the string is encapsulated between double quotes. How would I do this? I know the function, its just the regular expression that confuses me!
  2. Text file attached. Current code, below. Some files were renamed, others disappeared into the twilight zone. <?php$file=fopen("img/emvivacesupplemental2012/filelist.txt","r");$workingDir=getcwd();$directory= "\\img\\emvivacesupplemental2012\\450pxw\\";$newDirectory="\\img\\emvivacesupplemental2012\\gallery\\";$allFiles[][]= array();while (!feof($file)){$fileLine=trim(fgets($file));var_dump(scandir($workingDir.$directory));//echo $workingDir.$directory.$fileLine." is...<br/>"; //var_dump(file_exists($workingDir.$directory.$fileLine)); for($i=1000;$i<=9999;$i++) { //if first four characters if ($i==substr($fileLine,0,4)) { $allFiles[$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($workingDir.$directory.$fileLine, $workingDir.$newDirectory.$i."_gallery_".$key.".jpg"); } } } else if ($i==substr($fileLine,1,4)) { $firstChar=substr($fileLine,0,1); $allFiles[$firstChar.$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($workingDir.$directory.$fileLine, $workingDir.$newDirectory.$firstChar.$i."_gallery_".$key.".jpg"); } } } else if ($i==substr($fileLine,2,4)) { $allFiles[$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($workingDir.$directory.$fileLine, $workingDir.$newDirectory.$i."_gallery_".$key.".jpg"); } } } else if ($i==substr($fileLine,3,4)) { $firstChar=substr($fileLine,2,1); $allFiles[$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($workingDir.$directory.$fileLine, $workingDir.$newDirectory.$firstChar.$i."_gallery_".$key.".jpg"); } } } }}//print_r($allFiles);fclose($file);?> filelist.txt
  3. I've already made the gallery folder... next... lol. Still errors mehh
  4. Kay im still getting this error with and without the working directory specified: Warning: rename(C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8518_b.jpg,C:\wamp\www\alluringassets\img\emvivacesupplemental2012\gallery\8518_gallery_0.jpg) [function.rename]: The system cannot find the file specified. (code: 2) in C:\wamp\www\alluringassets\renamegalleryimgs.php on line 20 while (!feof($file)){$fileLine=trim(fgets($file)); for($i=1000;$i<=9999;$i++) { //if first four characters if ($i==substr($fileLine,0,4)) { $allFiles[$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($workingDir.$directory.$fileLine, $workingDir.$newDirectory.$i."_gallery_".$key.".jpg"); } } }
  5. Someone else helped me on facebook. I actually had to use trim function ! Will let you know if I have trouble with this next part shortly
  6. It's yielding all 1's!! Do I still need to change permissions??
  7. Forget those if statements for a moment. This is what I need to figure out. The following code is echoing does not exist for all the files. I need to first have them echoing that they do exist. $file=fopen("img/emvivacesupplemental2012/filelist.txt","r");$workingDir=getcwd(); $directory= "\\img\\emvivacesupplemental2012\\450pxw\\";$newDirectory="/img/emvivacesupplemental2012/gallery/"; $allFiles[][]= array(); while (!feof($file)){$fileLine=$workingDir.$directory.fgets($file);if (file_exists($fileLine)){ echo ($fileLine . "exists <br/>");}else{ echo ($fileLine. "does NOT exist </br>");}}?> Example of response: C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8518_b.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8518_f.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8551_b.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8551_f.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8653_b.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8653_f.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8654_b.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8654_f.jpg does NOT exist C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw\8655_b.jpg does NOT exist Those are the exact paths! I've also tried it without the working directory preceding it. Which would then read "\img\emvivacesupplemental\450pxw\8518_b.jpg does NOT exist!" I've also tried forward slashes instead of backslashes. All echo "does not exist".
  8. I'm working on wamp local server trying to rename some files with the following code: <?php$file=fopen("img/emvivacesupplemental2012/filelist.txt","r");$workingDir=getcwd(); $directory= "\\img\\emvivacesupplemental2012\\450pxw\\";$newDirectory="/img/emvivacesupplemental2012/gallery/"; $allFiles[][]= array(); while (!feof($file)){/*$fileLine=$workingDir.$directory.fgets($file);if (file_exists($fileLine)){ echo ($fileLine . "exists <br/>");}else{ echo ($fileLine. "does NOT exist </br>");}*/ for($i=1000;$i<=9999;$i++) { //if first four characters if ($i==substr($fileLine,0,4)) { $allFiles[$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($directory.$fileLine, $newDirectory.$i."_gallery_".$key.".jpg"); } } } else if ($i==substr($fileLine,1,4)) { $firstChar=substr($fileLine,0,1); $allFiles[$firstChar.$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($directory.$fileLine, $newDirectory.$firstChar.$i."_gallery_".$key.".jpg"); } } } else if ($i==substr($fileLine,2,4)) { $allFiles[$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($directory.$fileLine, $newDirectory.$i."_gallery_".$key.".jpg"); } } } else if ($i==substr($fileLine,3,4)) { $firstChar=substr($fileLine,2,1); $allFiles[$i][]=$fileLine; foreach ($allFiles as $v1) { foreach ($v1 as $key => $v2) { rename($directory.$fileLine, $newDirectory.$firstChar.$i."_gallery_".$key.".jpg"); } } } }}print_r($allFiles);fclose($file);?> I ran file_exists function on each line and nothing I do is yielding a boolean yes. I've tried preceding with the working directory, both forward and backslashes.. the images ARE in the right directory. Copied straight from properties of one of the images : C:\wamp\www\alluringassets\img\emvivacesupplemental2012\450pxw
  9. See: http://sulley.dm.ucf...nt2/viewer.html user enters a search term, then click submit. It should open the php file via the javascript click function which performs a cURL response then returns the JSON object to the javascript to parse. Right now im just trying to get the JSON object printed to the console in the javascript function. Can anyone see the issue? in developer tools the network response shows the JSON object but its not printing to console. 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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>DIG4503 – Caitlin Havener Assignment 2</title><link rel="stylesheet" type="text/css" href="css/reset.css" /><link rel="stylesheet" type="text/css" href="css/styles.css" /><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script type="text/javascript" src="js/a2.js"></script></head><body><div id="wrapper"> <div id="header"> <img src="#" alt=""/> <h1>A Case of the "Mondays"</h1> </div> <div id="content"> <div id="search"> <input type="text" id="searchText" /> <div id="submit"><h2>Submit</h2></div> </div> <div id="thumbs"> </div> <div id="specific"> </div> </div> <div id="footer"> <h1>Designed by Caitlin Havener with Flickr API, cURL, jQuery, XHTML</h1> </div> </div></body></html> javascript: // JavaScript Document$(document).ready(function(){$("#submit").click(function(e){ e.preventDefault(); var txt=$("#searchText").val(); $.ajax( { url:'getThumbs.php', data: 'text=' + txt, type: 'POST', dataType:'json', success:function(data) { //parse console.log('success'); console.log(data); //object is in 'result' //append responseXML (json) to #thumbs //parse the json object and output images with jquery }, failure: function(){ console.log('failure') }});});}); php: <?phpini_set('display_errors', 'on');/*should contain a PHP script that performs a cURL request for datafrom Flickr using the flickr.photos.search REST API and should return an XMLresponse.*/$ch = curl_init();$txt= $_POST['text'];$url = 'http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=ccb29e24bac7fd677e1e1ba0a4ae84fa&text=' . $txt . '&content_type=1&media=photos&per_page=40&format=json';curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_URL, $url);$curl_response = curl_exec($ch);curl_close($ch); //$rsp_obj = unserialize($curl_response);echo($curl_response); /*getThumbs.php should loop through the XML response and output a set of <img />elements that contain thumbnail URLs as the src attribute and the photo_id as the altattribute of each image ONLY for images that were taken on a Monday.*/ ?>
  10. When the user visits viewer.html, they should be prompted to enter a search term. Oncethey have entered the term and hit the submit button, an XHR request for getThumbs.phpshould occur that performs a cURL request of the Flickr API that returns 40 results forphotos that match the search term entered by the user as XML.-­‐ That XML response should be parsed using one of the following methods: OUTPUT 1 – XML to PHPo getThumbs.php should loop through the XML response and output a set of <img />elements that contain thumbnail URLs as the src attribute and the photo_id as the altattribute of each image ONLY for images that were taken on a Monday. OUTPUT 2 – XML from PHPo getThumbs.php should return an XML object to a2.js, and a2.js should loop throughthe XML response and dynamically generate a set of <img /> elements that containthumbnail URLs as the src attribute and the photo_id as the alt attribute of eachimage ONLY for images that were taken on a Monday. Main page (when you click submit loads the php file): <!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>DIG4503 – Caitlin Havener Assignment 2</title><link rel="stylesheet" type="text/css" href="css/reset.css" /><link rel="stylesheet" type="text/css" href="css/styles.css" /><script type="text/javascript" src="js/a2.js"></script><script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script><script type="text/javascript">window.onload = function (){ var submitClicked = document.getElementById("submit"); submitClicked.addEventListener('click', function(e) { e.preventDefault(); var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { console.log("Ive loaded"); document.getElementById("thumbs").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getThumbs.php",true); xmlhttp.send(); }, false);} </script></head><body><div id="wrapper"> <div id="header"> <img src="#" alt=""/> <h1>A Case of the "Mondays"</h1> </div> <div id="content"> <div id="search"> <form name=myForm><input type="text" value="search" /></form> <input type="submit" value="Submit" id="submit"/> </div> <div id="thumbs"> </div> <div id="specific"> </div> </div> <div id="footer"> <h1>Designed by Caitlin Havener with Flickr API, cURL, jQuery, XHTML</h1> </div> </div></body></html> The php file that is loaded when submit is clicked: <?php/*should contain a PHP script that performs a cURL request for datafrom Flickr using the flickr.photos.search REST API and should return an XMLresponse.*/print "hey";$ch = curl_init();$url = ' http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=686c634ab46cfad9ea78f85912d7bc0e&text=%24searchText&content_type=1&media=photos&per_page=40&format=rest&api_sig=6c762eab06cf258c37735f5bc90a03fb';curl_setopt($ch, CURLOPT_HEADER, 0);curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);curl_setopt($ch, CURLOPT_URL, $url);$curl_response = curl_exec($ch);curl_close($ch);print "the response: " . $curl_response; /*$params = array('api_key' => '5aa2e3914789e3d69c436425697af6fb','method' => 'flickr.photosets.getPhotos',//'photoset_id' =>'extras' => 'original_format','format'=> 'php_serial');$encoded_params = array();foreach($params as $k => $v){$encoded_params[] = urlencode($k).'=' .urlencode($v);}*/?> The professor's powerpoint had the above code (in php file) that is not commented out. But I saw a tutorial with the commented out code (incomplete). How do I use this darn flickr.photosets.getPhotos and retrieve its xml??
  11. <?phpsession_start();error_reporting(0);?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Caitlin's Acey Ducey</title><link rel="stylesheet" type="text/css" href="style.css" /></head><body><div class="roundedBox"><div class="top"><div class="bottom"><div class="left"><div class="right"><div class="topLeft"><div class="topRight"><div class="bottomLeft"><div class="bottomRight"><div class="boxContent"><div id="content"><form method='post'><?php$nextaction = isset($_POST['dowhat']) ? $_POST['dowhat'] : '';/************ SCORING SYSTEM */if (empty($_SESSION)){$_SESSION['potscore']=200; //$potscore= $_SESSION['potscore'];$_SESSION['blackscore']=900; //$blackscore=$_SESSION['blackscore'];$_SESSION['goldscore']=900; //$goldscore= $_SESSION['goldscore'];//var_dump($_SESSION);}function maxcard_displayfunc(){//var_dump($_SESSION); $highcard=$_SESSION['maxcardsess']; switch ($highcard) { case 1: return $maxcard_display="<img class='card_display' src='images/A.jpg' alt=' ' />"; break; case 2: return $maxcard_display="<img class='card_display' src='images/2.jpg' alt=' ' />"; break; case 3: return $maxcard_display="<img class='card_display' src='images/3.jpg' alt=' ' />"; break; case 4: return $maxcard_display="<img class='card_display' src='images/4.jpg' alt=' ' />"; break; case 5: return $maxcard_display="<img class='card_display' src='images/5.jpg' alt=' ' />"; break; case 6: return $maxcard_display="<img class='card_display' src='images/6.jpg' alt=' ' />"; break; case 7: return $maxcard_display="<img class='card_display' src='images/7.jpg' alt=' ' />"; break; case 8: return $maxcard_display="<img class='card_display' src='images/8.jpg' alt=' ' />"; break; case 9: return $maxcard_display="<img class='card_display' src='images/9.jpg' alt=' ' />"; break; case 10: return $maxcard_display="<img class='card_display' src='images/10.jpg' alt=' ' />"; break; case 14: return $maxcard_display="<img class='card_display' src='images/A.jpg' alt=' ' />"; break; case 11: return $maxcard_display="<img class='card_display' src='images/J.jpg' alt=' ' />"; break; case 12: return $maxcard_display="<img class='card_display' src='images/Q.jpg' alt=' ' />"; break; case 13: return $maxcard_display="<img class='card_display' src='images/K.jpg' alt=' ' />"; break; default: return $maxcard_display=$highcard; }}function mincard_displayfunc(){// var_dump($_SESSION);$lowcard=$_SESSION['mincardsess'];switch ($lowcard) { case 1: return $mincard_display="<img class='card_display' src='images/A.jpg' alt=' ' />"; break; case 2: return $mincard_display="<img class='card_display' src='images/2.jpg' alt=' ' />"; break; case 3: return $mincard_display="<img class='card_display' src='images/3.jpg' alt=' ' />"; break; case 4: return $mincard_display="<img class='card_display' src='images/4.jpg' alt=' ' />"; break; case 5: return $mincard_display="<img class='card_display' src='images/5.jpg' alt=' ' />"; break; case 6: return $mincard_display="<img class='card_display' src='images/6.jpg' alt=' ' />"; break; case 7: return $mincard_display="<img class='card_display' src='images/7.jpg' alt=' ' />"; break; case 8: return $mincard_display="<img class='card_display' src='images/8.jpg' alt=' ' />"; break; case 9: return $mincard_display="<img class='card_display' src='images/9.jpg' alt=' ' />"; break; case 10: return $mincard_display="<img class='card_display' src='images/10.jpg' alt=' ' />"; break; case 11: return $mincard_display="<img class='card_display' src='images/J.jpg' alt=' ' />"; break; case 12: return $mincard_display="<img class='card_display' src='images/Q.jpg' alt=' ' />"; break; case 13: return $mincard_display="<img class='card_display' src='images/K.jpg' alt=' ' />";; break; case 14: return $mincard_display="<img class='card_display' src='images/A.jpg' alt=' ' />"; break; default: return $mincard_display=$lowcard; }}function wincardfunc($wincard){ switch ($wincard) { case 1: return $wincard_display="<img class='card_display' src='images/A.jpg' alt=' ' />"; break; case 2: return $wincard_display="<img class='card_display' src='images/2.jpg' alt=' ' />"; break; case 3: return $wincard_display="<img class='card_display' src='images/3.jpg' alt=' ' />"; break; case 4: return $wincard_display="<img class='card_display' src='images/4.jpg' alt=' ' />"; break; case 5: return $wincard_display="<img class='card_display' src='images/5.jpg' alt=' ' />"; break; case 6: return $wincard_display="<img class='card_display' src='images/6.jpg' alt=' ' />"; break; case 7: return $wincard_display="<img class='card_display' src='images/7.jpg' alt=' ' />"; break; case 8: return $wincard_display="<img class='card_display' src='images/8.jpg' alt=' ' />"; break; case 9: return $wincard_display="<img class='card_display' src='images/9.jpg' alt=' ' />"; break; case 10: return $wincard_display="<img class='card_display' src='images/10.jpg' alt=' ' />"; break; case 11: return $wincard_display="<img class='card_display' src='images/J.jpg' alt=' ' />"; break; case 12: return $wincard_display="<img class='card_display' src='images/Q.jpg' alt=' ' />"; break; case 13: return $wincard_display="<img class='card_display' src='images/K.jpg' alt=' ' />"; break; case 14: return $wincard_display="<img class='card_display' src='images/A.jpg' alt=' ' />"; break; default: return $wincard_display=$wincard; }}function whosturn(){if(!isset($_SESSION['turnsess']) || $_SESSION['turnsess']=="gold"){ return $_SESSION['turnsess']="black";}else{ return $_SESSION['turnsess']="gold";}}print"<h1 id='header'>Acey-Ducey</h1>";maincontent();/*print "<div class='right_side'><h2>Score:</h2><br/><h3 class='pot'>POT</h3><h3 class='pot'>" .$_SESSION['potscore']. "</h3></br><h3 class='black'>Black</h3><h3 class='black'>" .$_SESSION['blackscore']. "</h3></br><h3 class='gold'>Gold</h3><h3 class='gold'>" .$_SESSION['goldscore']. "</h3></br></div>";*/ function maincontent(){global $nextaction;if (!$nextaction || ($nextaction=="PASS") || ($nextaction=="NEXT DRAW") || ($nextaction=="CLEAR/PLAY AGAIN")){ ################### SCREEN 1################# if($nextaction=="CLEAR/PLAY AGAIN"){ $_SESSION['potscore']=200; $_SESSION['blackscore']=900; $_SESSION['goldscore']=900; } $target1=rand(2,14); $target2=rand(2,14); //$wincard=rand(1,14); $maxcard=max($target1,$target2); $mincard=min($target1,$target2); $_SESSION['maxcardsess']=$maxcard; $_SESSION['mincardsess']=$mincard; $maxcard_value=$_SESSION['maxcardsess']; $mincard_value=$_SESSION['mincardsess']; //change the way value is displayed (to look like a card J,K,Q,A) $maxcard_display=maxcard_displayfunc(); $mincard_display=mincard_displayfunc(); //////////////////////////////////////////////////////// // If card is an ace, change value of ace to 1 or 14, // whichever is more favorable to user. //////////////////////////////////////////////////////// if($maxcard_display=="A"){ $othercard=$_SESSION['mincardsess']; if($othercard-1 > 14-$othercard){ $acecard=1; $_SESSION['maxcardsess']=max($othercard,$acecard); $_SESSION['mincardsess']=min($othercard,$acecard); print "</br>Ace will have a value of $acecard, because it favors your bet."; }else{ $acecard=14; $_SESSION['maxcardsess']=max($othercard,$acecard); $_SESSION['mincardsess']=min($othercard,$acecard); print "</br>Ace will have a value of $acecard, because it favors your bet."; } }else if($mincard_display=="A"){ $othercard=$_SESSION['maxcardsess']; if($othercard-1 > 14-$othercard){ $acecard=1; $_SESSION['maxcardsess']=max($othercard,$acecard); $_SESSION['mincardsess']=min($othercard,$acecard); print "</br>Ace will have a value of $acecard, because it favors your bet."; } else{ $acecard=14; $_SESSION['maxcardsess']=max($othercard,$acecard); $_SESSION['mincardsess']=min($othercard,$acecard); print "</br>Ace will have a value of $acecard, because it favors your bet."; }} /// ///////////////////////////////////////////////////// // If cards are too close in value, generate new set //////////////////////////////////////////////////////// if(($maxcard_value-$mincard_value==0) || ($maxcard_value-$mincard_value==1)){ maincontent(); }else{ $turn=whosturn(); print "<div class='right_side'><p>It is <b>$turn</b> team's turn.</p> <br /></div>"; print "<div class='cards'><div class='cardboxes'>high card=<br/>$maxcard_display </div>"; print "<div class='cardboxes'>low card=<br/>$mincard_display</div></div><br /><br />"; print "<div class='input'>Input your bet (with a value of 1 to " .$_SESSION['potscore']. "): <input type='text' name='betvalue'></div>"; print "<div class='buttons'><input type='submit' name='dowhat' value='BET'>"; print "<input type='submit' name='dowhat' value='PASS'>"; print "<input type='submit' name='dowhat' value='CLEAR/PLAY AGAIN'></div>"; print "<div class='right_side'><h2>Score:</h2><br/><h3 class='pot'>POT</h3><h3 class='pot'>" .$_SESSION['potscore']. "</h3></br><h3 class='black'>Black</h3><h3 class='black'>" .$_SESSION['blackscore']. "</h3></br><h3 class='gold'>Gold</h3><h3 class='gold'>" .$_SESSION['goldscore']. "</h3></br></div>"; } }else if ($nextaction=="BET"){ #################### # SCREEN TWO #################### $_SESSION['inputbet']=intval($_POST['betvalue']); $turn=$_SESSION['turnsess']; print "<div class='right_side'><p>It is <b>$turn</b> team's turn.</p> <br /></div>"; $wincard=rand(2,14); $wincard_display=wincardfunc($wincard); $maxcard_display=maxcard_displayfunc(); $mincard_display=mincard_displayfunc(); $maxvalue=$_SESSION['maxcardsess']; $minvalue=$_SESSION['mincardsess']; print "<div class='cards'><div class='cardboxes'>highcard=<br/>$maxcard_display </div>"; print "<div class='cardboxes'>target=<br/>$wincard_display </div>"; print "<div class='cardboxes'>lowcard=<br/>$mincard_display </div></div>"; if (($wincard<$maxvalue) && ($wincard>$minvalue)) { print "<div class='buttons'><br /><br/><p class='bigtext'>You win!</p><br/>"; /**********SCORING SYSTEM*/ $_SESSION["{$turn}score"] += $_SESSION['inputbet']; $_SESSION['potscore'] -= $_SESSION['inputbet']; }else{ print "<div class='buttons'><br /><br/><p class='bigtext'>You lose!</p><br/>"; /**********SCORING SYSTEM*/ $_SESSION["{$turn}score"] -= $_SESSION['inputbet']; $_SESSION['potscore'] += $_SESSION['inputbet']; } print "<input type='submit' name='dowhat' value='NEXT DRAW'></div>";/***********SCORING SYSTEM*/ //run out of money in pot if($_SESSION['potscore']==0){ $_SESSION['potscore']=200; $_SESSION['blackscore'] -= 100; $_SESSION['goldscore'] -= 100; }print "<div class='right_side'><h2>Score:</h2><br/><h3 class='pot'>POT</h3><h3 class='pot'>" .$_SESSION['potscore']. "</h3></br><h3 class='black'>Black</h3><h3 class='black'>" .$_SESSION['blackscore']. "</h3></br><h3 class='gold'>Gold</h3><h3 class='gold'>" .$_SESSION['goldscore']. "</h3></br></div>"; //winner loser }else if($_SESSION['goldscore']==0){ print "<p class='bigtext'>Black team wins!</p>"; }else if($_SESSION['blackscore']==0){ print"<p class='bigtext'>Gold team wins!</p>"; } else{ print "Error 100: nextaction=$nextaction, but I don't know what to do.";}}?><tt>Website and program by Caitlin Havener. <br/>Card graphics from http://sopapeldeparede.com.br.</tt></form></div></div></div></div></div></div></div></div></div></div></div></body></html>
  12. YAYY I got everything to work. Thank you so much! I used my own code though and implemented some of your stuff. Mine of course isn't as pretty but I didn't understand everything in yours and I had been looking at mine for so long so I just stuck to most of it
  13. You guys are so funny! LOL working on it this morning. Need to get it done today! MEHH
  14. Make some websites. For friends... whatever... can only get better by doing it.
  15. var numberQuestions = 8;var numberOfQuestions= new Array();//preload functionfunction init(){var anchor = document.getElementsByTagName('a');//set up flag for how many times a given anchor is clickedfor (i=1; i<=numberQuestions; i++){ anchor[i].addEventListener('click', function(e) { e.preventDefault(); getAnswers(this.name); }, false); //OWEN IM HAVING THE SAME PROBLEM HERE WHERE I WANT TO USE THE ELEMENTS OF AN ARRAY AS INDIVIDUAL COUNTERS FOR EACH QUESTION... will this work? var clickCounter= newArray(); //flag to count how many times a given link is clicked clickCounter[i] = 0;}//httprequest number of questions for each questionvar xhr = new XMLHttpRequest();if (xhr){ xhr.onreadystatechange = function() { displayResponse(xhr); } xhr.open("GET", "answers.txt", true); xhr.send(null);} function displayResponse(xhr){ if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { var allAnswers = xhr.responseText.split('\n'); //loop through the questions for(var i = 1; i <= 8; i++){ //define a variable to map question to answers var question = 'q' + i; var answersPerQuestion = 0; console.log('QUESTION => ' + question); //loop through the answers, and split on the * for(var j = 0; j < allAnswers.length; j++) { var line = allAnswers[j]; var pieces = line.split('*'); //determine if the current line contains an answer for our question if(pieces[0] == question) { //increment our number of answers for this question answersPerQuestion++; }; }; console.log('Number of answers for question #' + i + ' => ' + answersPerQuestion); numberOfQuestions[i] = answersPerQuestion; //put numbers in seperate corresponding question variables //place number in the DOM for name==questionVariable numberIntoAnchor=document.createElement(toString(numberOfQuestions[i])); getAnchors=document.getElementsByName(i)[0]; getAnchors.appendChild(numberIntoAnchor); }; } else if (xhr.status == 404) { console.log("Oops, file not found!"); } }} }window.onload = init; //where to place this?//PAGE NOW HAS LOADED WITH NUMBER OF QUESTIONS LINK NEXT TO EACH QUESTION//WHEN USER CLICKS QUESTION NUMBER FUNCTION IS CALLED W/ ANCHOR NAME AS PARAMETERfunction getAnswers(name){var nameInt = parseInt(name);//comes in as string so parseclickCounter[nameInt]++;if (nameInt % 2 != 0)//IF clickCounter[parseInt(name)] is NOT divisible by two, which means it was clicked once or third time back on{//httprequest split questions into pieces//filter looking for name to match pieces[0]//when they match, output pieces[1] to Ul.name var xhr = new XMLHttpRequest(); if (xhr) { xhr.onreadystatechange = function() { displayResponse(xhr); } xhr.open("GET", fileName, true); xhr.send(null); } function displayResponse(xhr) { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { var allAnswers = xhr.responseText.split('\n'); //loop through the questions for(var i = 1; i <= 8; i++) { //loop through the answers, and split on the * for(var j = 0; j < allAnswers.length; j++) { var line = allAnswers[j]; var pieces = line.split('*'); //determine if the current line contains //an answer for our question if(pieces[0] == question) { //add the answer under the appropriate question in the DOM var output = document.getElementById(nameInt); //is nameInt what we use?? output.innerHTML += "<li>" + pieces[1] + "</li>"; }; }; }; } else if (xhr.status == 404) { console.log("Oops, file not found!"); } } }}else if (nameInt % 2 == 0){ //take the answers to each question off the page} }
  16. pseudocode var numberQuestions = 8;var numberOfQuestions= new Array(); //preload functionfunction init(){var anchor = document.getElementsByTagName('a');//set up flag for how many times a given anchor is clicked for (i=1; i<=numberQuestions; i++){anchor[i].addEventListener('click', function(e) {e.preventDefault();getAnswers(this.name);}, false); //OWEN IM HAVING THE SAME PROBLEM HERE WHERE I WANT TO USE THE ELEMENTS OF AN ARRAY AS INDIVIDUAL COUNTERS FOR EACH QUESTION... will this work?var clickCounter= newArray(); //flag to count how many times a given link is clickedclickCounter[i] = 0;}//httprequest number of questions for each question var xhr = new XMLHttpRequest(); if (xhr) {xhr.onreadystatechange = function() { displayResponse(xhr);}xhr.open("GET", "answers.txt", true);xhr.send(null);} function displayResponse(xhr) {if (xhr.readyState == 4) {if (xhr.status == 200 || xhr.status == 304) { var allAnswers = xhr.responseText.split('\n');var numberQuestions = 8; //loop through the questionsfor(var i = 1; i <= 8; i++){ //define a variable to map question to answers var question = 'q' + i; var answersPerQuestion = 0; console.log('QUESTION => ' + question); //loop through the answers, and split on the * for(var j = 0; j < allAnswers.length; j++) {var line = allAnswers[j];var pieces = line.split('*'); //determine if the current line contains an answer for our questionif(pieces[0] == question){ //increment our number of answers for this question answersPerQuestion++; }; }; console.log('Number of answers for question #' + i + ' => ' + answersPerQuestion); numberOfQuestions[i] = answersPerQuestion; //put numbers in seperate corresponding question variables //place number in the DOM for name==questionVariable numberIntoAnchor=document.createElement(toString(numberOfQuestions[i])); getAnchors=document.getElementsByName(i)[0];getAnchors.appendChild(numberIntoAnchor);}; }else if (xhr.status == 404) {console.log("Oops, file not found!");}}} } window.onload = init; //where to place this? //PAGE NOW HAS LOADED WITH NUMBER OF QUESTIONS LINK NEXT TO EACH QUESTION //WHEN USER CLICKS QUESTION NUMBER FUNCTION IS CALLED W/ ANCHOR NAME AS PARAMETERfunction getAnswers(name){var nameInt = parseInt(name);//comes in as string so parseclickCounter[nameInt]++; if (nameInt % 2 != 0)//IF clickCounter[parseInt(name)] is NOT divisible by two, which means it was clicked once or third time back on { }//httprequest split questions into pieces//filter looking for name to match pieces[0]//when they match, output pieces[1] to Ul.name}
  17. function sendRequest(fileName) { var xhr = new XMLHttpRequest(); if (xhr) { xhr.onreadystatechange = function() { displayResponse(xhr); } xhr.open("GET", fileName, true); xhr.send(null); } } function displayResponse(xhr) { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { //console.log("responseText is: " + xhr.responseText); var allAnswers = xhr.responseText.split('\n'); var numberFlag= []; var numberQuestions = 8; for(var i=0; i<allAnswers.length; i++) { //console.log(i + ": " + allAnswers[i]); var divideAnswer= allAnswers[i].split('*'); //console.log(divideAnswer[0] + " and " + divideAnswer[1]); var responseDiv = document.getElementById('responseDiv'); //responseDiv.innerHTML = ""; //Write answer to appropriate question heading //responseDiv.innerHTML += "<h3>" + divideAnswer[1] + "</h3>"; //if value of link is q1 etc then display those particular answers in particular place //?????AT PARTICULAR TIME for (var j=0; j<=numberQuestions; j++) { if (divideAnswer[0] == "q" + j) { var responseUl= document.getElementById('responseUl' + j); responseUl.innerHTML += "<li>" + divideAnswer[1] + "</li>"; } } //divideAnswer[0] is the question number and divideAnswer[1] is the actual answer //Flag how many of each question there are for (var j=0; j<numberQuestions; j++) { numberFlag[j] = 0; //numberFlag[j] = 0; if (divideAnswer[0]=="q"+ j){ console.log("I match"); numberFlag[j] ++; // this returns a number but above returns NaN???? ---> numberFlag[2]=1; } console.log("There are this many answers for number one:" + numberFlag[j]); } } } else if (xhr.status == 404) { console.log("Oops, file not found!"); } } } window.onload = function() { var anchor = document.getElementsByTagName('a'); anchor[0].addEventListener('click', function(e) { e.preventDefault(); sendRequest(this.href); }, false); } //if this.id= then look for questions that start with "q" + this.id +"*"
  18. function sendRequest(fileName) { var xhr = new XMLHttpRequest(); if (xhr) { xhr.onreadystatechange = function() { displayResponse(xhr); } xhr.open("GET", fileName, true); xhr.send(null); } } function displayResponse(xhr) { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { //console.log("responseText is: " + xhr.responseText); var allAnswers = xhr.responseText.split('\n'); var numberFlag= new Array(); var numberQuestions = 8; for(var i=0; i<allAnswers.length; i++) { //console.log(i + ": " + allAnswers[i]); var divideAnswer= allAnswers[i].split('*'); //console.log(divideAnswer[0] + " and " + divideAnswer[1]); var responseDiv = document.getElementById('responseDiv'); //responseDiv.innerHTML = ""; //there will prob be a 'responsediv' under each question so that there is somewhere for each answer to come up if (divideAnswer[1]) { responseDiv.innerHTML += "<h3>" + divideAnswer[1] + "</h3>"; } //divideAnswer[0] is the question number and divideAnswer[1] is the actual answer //Flag how many of each question there are for (var j=0; j<numberQuestions; j++) { if (divideAnswer[0]=="q"+ j){ console.log("I match"); numberFlag[j] += 1; // this returns a number but above returns NaN???? ---> numberFlag[2]=1; console.log("There are this many answers for number one:" + numberFlag[j]); } } console.log(numberFlag.toString()); } } else if (xhr.status == 404) { console.log("Oops, file not found!"); } } } window.onload = function() { var anchor = document.getElementsByTagName('a'); anchor[0].addEventListener('click', function(e) { e.preventDefault(); sendRequest(this.href); }, false); } //if this.id= then look for questions that start with "q" + this.id +"*" Now for each numberFlag[j] I'm getting NaN
  19. Main html file (this will eventually contain a list of questions): <!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>DIG4503 - Caitlin Havener - Assignment 1</title><script type="text/javascript" src="a1.js"></script></head><body><a href="answers.txt">click here</a><div id="responseDiv"></div></body></html> Javascript file: function sendRequest(fileName) { var xhr = new XMLHttpRequest(); if (xhr) { xhr.onreadystatechange = function() { displayResponse(xhr); } xhr.open("GET", fileName, true); xhr.send(null); } } function displayResponse(xhr) { if (xhr.readyState == 4) { if (xhr.status == 200 || xhr.status == 304) { console.log("responseText is: " + xhr.responseText); var allAnswers = xhr.responseText.split('\n'); var numberFlag= new Array(); for(var i=0; i<allAnswers.length; i++) { console.log(i + ": " + allAnswers[i]); var divideAnswer= allAnswers[i].split('*'); console.log(divideAnswer[0] + " and " + divideAnswer[1]); var responseDiv = document.getElementById('responseDiv'); //responseDiv.innerHTML = ""; //there will prob be a 'responsediv' under each question so that there is somewhere for each answer to come up if (divideAnswer[1]){ responseDiv.innerHTML += "<h3>" + divideAnswer[1] + "</h3>"; } //Flag how many of each question there are console.log("Show me what q and i look like:" + " q" + i); //'i' below should be the length of the questions, not the answers if (divideAnswer[0]=="q"+ i){ console.log("I match"); numberFlag[i] += 1; } console.log("There are this many answers for number one:" + numberFlag[1]); } } else if (xhr.status == 404) { console.log("Oops, file not found!"); } } } window.onload = function() { var anchor = document.getElementsByTagName('a'); anchor[0].addEventListener('click', function(e) { e.preventDefault(); sendRequest(this.href); }, false); } //if this.id= then look for questions that start with "q" + this.id +"*" Answers file (this will eventually have actual answers and not giberish): fillerq1* sldhfsdkfsdkfjsdq2* jsdfkjsdfkljsafq1* kjasdlfj Lame part to be stuck on... if (divideAnswer[0]=="q"+ i){console.log("I match");numberFlag += 1;} I'm trying to make a counter of how many answers there are for each question (some questions will have multiple answers). The above snippet should log "I match" three times and numberFlag[1] should equal 2 and numberFlag[2] should equal 1 but it is saying the value is undefined in console. What is wrong with that snippet or am I putting var numberFlag= newArray(); somewhere wrong lol
  20. Same problems on my android, plus it doesn't scroll horizontally on my android
  21. Hey thank you so much! It seemed to be working on my apache local server but now that I have uploaded it.. the scroller doesn't load on every page, sometimes it doesn't scroll vertically, and finally I don't think the wrapper style is being applied (?) http://sulley.dm.ucf.edu/~ca081919/DIG4104c/project1/project1.html <!DOCTYPE html><html><head><title>Garfield</title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /><link rel="stylesheet" href="mystyle.css" /><link rel="stylesheet" href="themes/comic.min.css" /><script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script><script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script><script type="application/javascript" src="iscroll.js"></script><script type="text/javascript"><!-- SCROLL THE COMIC FRAMES--> $('div.ui-page').live("swipeleft", function(){ var nextpage = $(this).next('div[data-role="page"]'); // swipe using id of next page if exists if (nextpage.length > 0) { $.mobile.changePage(nextpage, 'slide'); } }); $('div.ui-page').live("swiperight", function(){ var prevpage = $(this).prev('div[data-role="page"]'); // swipe using id of next page if exists if (prevpage.length > 0) { $.mobile.changePage(prevpage, {transition:"slide", reverse:true}); } }); <!--Scroll capability in menu--><!-- Comic menu --> function writeMenu(){ //THE FOLLOWING COUPLE FUNCTIONS WROTE BY SOMEONE ON A FORUM WHO WAS HELPING ME OUT WITH BUGS http://w3schools.invisionzone.com/index.php?showtopic=41551&st=20 $(document).ready(function() { var count =0; if($(".scroller").index() !=-1) { $(".scroller").each(function() { $(this).parent("div").attr("id", "wrapper"+count); $(this).parent("class").css({ margin: "-20px", width: "100%", maxWidth: "400px", height: "140px", overflow: "auto", whiteSpace: "nowrap"});// to save time doing this add class instead. count++; }); } }); function populate_iscroll() { var count =0; $(".scroller").each(function() { window['myScroll'+count]= new iScroll('wrapper'+count, { hScroll: true, onBeforeScrollStart: function (e) { e.preventDefault(); e.stopPropagation(); } }); count++; }); } function loaded() { populate_iscroll() } document.addEventListener('touchmove', function (e) { e.preventDefault(); }, true); /* * * * * * * * * * Use this for high compatibility (iDevice + Android) * */ document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false); /* * * * * * * * */ /* * * * * * * * * * Use this for iDevice only * */ //document.addEventListener('DOMContentLoaded', loaded, false); /* * * * * * * * */ /* * * * * * * * * * Use this if nothing else works * */ //window.addEventListener('load', setTimeout(function () { loaded(); }, 200), false); /* * * * * * * * */ document.write("<div>"); document.write("<div class=\"scroller\">"); document.write("<ul>"); document.write("<li><img src=\"img\/frame1_img.jpg\" alt=\"garfield\"\/><a href=\"#frame1\">Sep 2000<\/a><\/li>"); document.write("<li><img src=\"img\/A1.gif\" alt=\"garfield\" \/><a href=\"#A1\">Mar 2001<\/a><\/li>"); document.write("<li><img src=\"img\/B1.gif\" alt=\"garfield\" \/><a href=\"#B1\">Oct 2001<\/a><\/li>"); document.write("<li><img src=\"img\/C1.gif\" alt=\"garfield\" \/><a href=\"#C1\">Dec 2001<\/a><\/li>"); document.write("<li><img src=\"img\/D1.gif\" alt=\"garfield\" \/><a href=\"#D1\">Jan 2002<\/a><\/li>"); document.write("<li><img src=\"img\/E1.gif\" alt=\"garfield\" \/><a href=\"#E1\">Apr 2002<\/a><\/li>"); document.write("<li><img src=\"img\/F1.gif\" alt=\"garfield\" \/><a href=\"#F1\">Dec 2003<\/a><\/li>"); document.write("<li><img src=\"img\/G1.gif\" alt=\"garfield\" \/><a href=\"#G1\">Dec 2004<\/a><\/li>"); document.write("<\/ul>"); document.write("<\/div>"); document.write("<\/div>"); /*var newWrapper = document.createElement('div'); newWrapper.setAttribute('id', 'wrapper'); var newScroller = document.createElement('div'); newScroller.setAttribute('id', 'scroller'); var newList = document.createElement('ul'); var newItem1 = document.createElement('li'); var newLink1 = document.createElement('a'); newLink1.setAttribute('src', 'img/frame1_img.jpg'); newItem1.appendChild(newLink1); newList.appendChild(newItem1); var newItem2 = document.createElement('li'); var newLink2 = document.createElement('a'); newLink2.setAttribute('src', 'img/A1.gif.jpg'); newItem2.appendChild(newLink2); newList.appendChild(newItem2); newScroller.appendChild(newList); newWrapper.appendChild(newScroller);*/} </script> </head><body> <!--******************FIRST COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="frame1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame1_img.jpg" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script> <!--<div id="wrapper"> <div id="scroller"> <ul> <li><a href="#frame1"><img src="img/frame1_img.jpg" alt="garfield"/></a></li> <li><a href="#A1"><img src="img/A1.gif" alt="garfield" /></a></li> <li><a href="#B1"><img src="img/B1.gif" alt="garfield" /></a></li> <li><a href="#C1"><img src="img/C1.gif" alt="garfield" /></a></li> <li><a href="#D1"><img src="img/D1.gif" alt="garfield" /></a></li> <li><a href="#E1"><img src="img/E1.gif" alt="garfield" /></a></li> <li><a href="#F1"><img src="img/F1.gif" alt="garfield" /></a></li> <li><a href="#G1"><img src="img/G1.gif" alt="garfield" /></a></li> </ul> </div> </div>--></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="frame2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame2_img.jpg" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame1" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="frame3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame3_img.jpg" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame2" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame4" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --></div><!-- /page --><!-- Start of fourth frame --><div data-role="page" data-theme="b" id="frame4"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame4_img.jpg" alt="frame4_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame3" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame5" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --></div><!-- /page --><!-- Start of five frame --><div data-role="page" data-theme="b" id="frame5"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame5_img.jpg" alt="frame5_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame4" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame6" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --></div><!-- /page --><!-- Start of six frame --><div data-role="page" data-theme="b" id="frame6"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame6_img.jpg" alt="frame6_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame5" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --></div><!-- /page --><!--******************SECOND COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="A1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#A2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="A2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#A1" data-icon="arrow-l" data-role="button">Back</a> <a href="#A3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="A3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#A2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************THIRD COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="B1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/B1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#B2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="B2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/B2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#B1" data-icon="arrow-l" data-role="button">Back</a> <a href="#B3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="B3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/B3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#B2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************FOURTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="C1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/C1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#C2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="C2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/C2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#C1" data-icon="arrow-l" data-role="button">Back</a> <a href="#C3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="C3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/C3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#C2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************FIFTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="D1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/D1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#D2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="D2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/D2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#D1" data-icon="arrow-l" data-role="button">Back</a> <a href="#D3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="D3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/D3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#D2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************SIXTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="E1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/E1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#E2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="E2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/E2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#E1" data-icon="arrow-l" data-role="button">Back</a> <a href="#E3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="E3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/E3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#E2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************SEVENTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="F1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/F1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#F2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="F2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/F2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#F1" data-icon="arrow-l" data-role="button">Back</a> <a href="#F3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="F3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/F3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#F2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************EIGHTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="G1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/G1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#G2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="G2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#G1" data-icon="arrow-l" data-role="button">Back</a> <a href="#G3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="G3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#G2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --></body></html>
  22. Why couldn't this work function writeMenu(i){ var myScroll[i]; function loaded() { var wrapperIndex= "wrapper" + i; myScroll[i] = new iScroll(wrapperIndex, { hScroll: true, onBeforeScrollStart: function (e) { e.preventDefault(); e.stopPropagation(); } }); } When called... writeMenu(1).... writeMenu(2) etcetera
  23. Theres no way to get around creating 20ish different scroller variables? lol could i do the following maybe... im going to try it later In the function writeMenu set it up with parameter 'i' and every time its called give it a new number writeMenu(1)... im just not sure how i would put var myscroll+i??? lol or 'wrapper'+i ... or can i just make it an array var myScroll?? def not sure about that 'wrapper' part writeMenu(){ var myScroll; function loaded() { myScroll = new iScroll('wrapper', { hScroll: true, onBeforeScrollStart: function (e) { e.preventDefault(); e.stopPropagation(); } }); } So like... writeMenu(i){ var myScroll; function loaded() { myScroll = new iScroll('wrapper' // <------What goes here , { hScroll: true, onBeforeScrollStart: function (e) { e.preventDefault(); e.stopPropagation(); } }); }
  24. Hallelujaaaassss thanksss! that worked.. I only have one major issue now. Then I'm going to get this done and get started on an Ajax project WOOHOO! http://sulley.dm.ucf.edu/~ca081919/DIG4104c/project1/project1.html I've made a function to write the menu so to avoid being repetitive. The scrolling menu is now only working on the first comic... when you click the links for the other ones its just a regular old div with a html scroll bar. I'm hoping I don't have to make seperate id's for EACH wrapper... MEH... please advise Main code <!DOCTYPE html><html><head><title>Garfield</title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /><link rel="stylesheet" href="mystyle.css" /><link rel="stylesheet" href="themes/comic.min.css" /><script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script><script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script><script type="application/javascript" src="iscroll.js"></script><script type="text/javascript"><!-- SCROLL THE COMIC FRAMES--> $('div.ui-page').live("swipeleft", function(){ var nextpage = $(this).next('div[data-role="page"]'); // swipe using id of next page if exists if (nextpage.length > 0) { $.mobile.changePage(nextpage, 'slide'); } }); $('div.ui-page').live("swiperight", function(){ var prevpage = $(this).prev('div[data-role="page"]'); // swipe using id of next page if exists if (prevpage.length > 0) { $.mobile.changePage(prevpage, {transition:"slide", reverse:true}); } }); <!--Scroll capability in menu--><!-- Comic menu --> function writeMenu(){ var myScroll; function loaded() { myScroll = new iScroll('wrapper', { hScroll: true, onBeforeScrollStart: function (e) { e.preventDefault(); e.stopPropagation(); } }); } document.addEventListener('touchmove', function (e) { e.preventDefault(); }, false); /* * * * * * * * * * Use this for high compatibility (iDevice + Android) * */ document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, false); /* * * * * * * * */ /* * * * * * * * * * Use this for iDevice only * */ //document.addEventListener('DOMContentLoaded', loaded, false); /* * * * * * * * */ /* * * * * * * * * * Use this if nothing else works * */ //window.addEventListener('load', setTimeout(function () { loaded(); }, 200), false); /* * * * * * * * */ document.write("<div id=\"wrapper\">"); document.write("<div id=\"scroller\">"); document.write("<ul>"); document.write("<li><img src=\"img\/frame1_img.jpg\" alt=\"garfield\"\/><a href=\"#frame1\">Sep 2000<\/a><\/li>"); document.write("<li><img src=\"img\/A1.gif\" alt=\"garfield\" \/><a href=\"#A1\">Mar 2001<\/a><\/li>"); document.write("<li><img src=\"img\/B1.gif\" alt=\"garfield\" \/><a href=\"#B1\">Oct 2001<\/a><\/li>"); document.write("<li><img src=\"img\/C1.gif\" alt=\"garfield\" \/><a href=\"#C1\">Dec 2001<\/a><\/li>"); document.write("<li><img src=\"img\/D1.gif\" alt=\"garfield\" \/><a href=\"#D1\">Jan 2002<\/a><\/li>"); document.write("<li><img src=\"img\/E1.gif\" alt=\"garfield\" \/><a href=\"#E1\">Apr 2002<\/a><\/li>"); document.write("<li><img src=\"img\/F1.gif\" alt=\"garfield\" \/><a href=\"#F1\">Dec 2003<\/a><\/li>"); document.write("<li><img src=\"img\/G1.gif\" alt=\"garfield\" \/><a href=\"#G1\">Dec 2004<\/a><\/li>"); document.write("<\/ul>"); document.write("<\/div>"); document.write("<\/div>"); /*var newWrapper = document.createElement('div'); newWrapper.setAttribute('id', 'wrapper'); var newScroller = document.createElement('div'); newScroller.setAttribute('id', 'scroller'); var newList = document.createElement('ul'); var newItem1 = document.createElement('li'); var newLink1 = document.createElement('a'); newLink1.setAttribute('src', 'img/frame1_img.jpg'); newItem1.appendChild(newLink1); newList.appendChild(newItem1); var newItem2 = document.createElement('li'); var newLink2 = document.createElement('a'); newLink2.setAttribute('src', 'img/A1.gif.jpg'); newItem2.appendChild(newLink2); newList.appendChild(newItem2); newScroller.appendChild(newList); newWrapper.appendChild(newScroller);*/} </script> </head><body> <!--******************FIRST COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="frame1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame1_img.jpg" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script> <!--<div id="wrapper"> <div id="scroller"> <ul> <li><a href="#frame1"><img src="img/frame1_img.jpg" alt="garfield"/></a></li> <li><a href="#A1"><img src="img/A1.gif" alt="garfield" /></a></li> <li><a href="#B1"><img src="img/B1.gif" alt="garfield" /></a></li> <li><a href="#C1"><img src="img/C1.gif" alt="garfield" /></a></li> <li><a href="#D1"><img src="img/D1.gif" alt="garfield" /></a></li> <li><a href="#E1"><img src="img/E1.gif" alt="garfield" /></a></li> <li><a href="#F1"><img src="img/F1.gif" alt="garfield" /></a></li> <li><a href="#G1"><img src="img/G1.gif" alt="garfield" /></a></li> </ul> </div> </div>--></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="frame2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame2_img.jpg" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame1" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="frame3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame3_img.jpg" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame2" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame4" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --></div><!-- /page --><!-- Start of fourth frame --><div data-role="page" data-theme="b" id="frame4"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame4_img.jpg" alt="frame4_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame3" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame5" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --></div><!-- /page --><!-- Start of five frame --><div data-role="page" data-theme="b" id="frame5"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame5_img.jpg" alt="frame5_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame4" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame6" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --></div><!-- /page --><!-- Start of six frame --><div data-role="page" data-theme="b" id="frame6"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame6_img.jpg" alt="frame6_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame5" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --></div><!-- /page --><!--******************SECOND COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="A1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#A2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="A2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#A1" data-icon="arrow-l" data-role="button">Back</a> <a href="#A3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="A3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#A2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************THIRD COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="B1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/B1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#B2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="B2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/B2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#B1" data-icon="arrow-l" data-role="button">Back</a> <a href="#B3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="B3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/B3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#B2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************FOURTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="C1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/C1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#C2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="C2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/C2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#C1" data-icon="arrow-l" data-role="button">Back</a> <a href="#C3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="C3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/C3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#C2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************FIFTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="D1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/D1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#D2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="D2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/D2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#D1" data-icon="arrow-l" data-role="button">Back</a> <a href="#D3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="D3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/D3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#D2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************SIXTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="E1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/E1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#E2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="E2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/E2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#E1" data-icon="arrow-l" data-role="button">Back</a> <a href="#E3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="E3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/E3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#E2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************SEVENTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="F1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/F1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#F2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="F2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/F2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#F1" data-icon="arrow-l" data-role="button">Back</a> <a href="#F3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="F3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/F3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#F2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!--******************EIGHTH COMIC*************************--><!-- Start of first frame --><div data-role="page" data-theme="b" id="G1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/G1.gif" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#G2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --><script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="G2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A2.gif" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#G1" data-icon="arrow-l" data-role="button">Back</a> <a href="#G3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="G3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/A3.gif" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#G2" data-icon="arrow-l" data-role="button">Back</a> </div></div><!-- /content --> <script type="text/javascript">writeMenu(); </script></div><!-- /page --></body></html>
  25. http://sulley.dm.ucf.edu/~ca081919/DIG4104c/project1/project1.html Main file<!DOCTYPE html><html><head><title>Garfield</title><meta name="viewport" content="width=device-width, initial-scale=1"><link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" /><link rel="stylesheet" href="mystyle.css" /><link rel="stylesheet" href="themes/comic.min.css" /><script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script><script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script><!--Scroll capability in menu--><script type="application/javascript" src="iscroll.js"></script> <script type="text/javascript">var myScroll; function loaded() { myScroll = new iScroll('wrapper', { hScroll: true }); }document.addEventListener('touchmove', function (e) { e.preventDefault(); }, true);/* * * * * * * *** Use this for high compatibility (iDevice + Android)**/document.addEventListener('DOMContentLoaded', function () { setTimeout(loaded, 200); }, true);/** * * * * * * *//* * * * * * * *** Use this for iDevice only**///document.addEventListener('DOMContentLoaded', loaded, true);/** * * * * * * *//* * * * * * * *** Use this if nothing else works**///window.addEventListener('load', setTimeout(function () { loaded(); }, 200), true);/** * * * * * * */ </script> <!-- SCROLL THE COMIC FRAMES--><script type="text/javascript"> $('div.ui-page').live("swipeleft", function(){ var nextpage = $(this).next('div[data-role="page"]'); // swipe using id of next page if exists if (nextpage.length > 0) { $.mobile.changePage(nextpage, 'slide'); } }); $('div.ui-page').live("swiperight", function(){ var prevpage = $(this).prev('div[data-role="page"]'); // swipe using id of next page if exists if (prevpage.length > 0) { $.mobile.changePage(prevpage, {transition:"slide", reverse:true}); } }); </script></head><body><!-- Start of first frame --><div data-role="page" data-theme="b" id="frame1"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame1_img.jpg" alt="frame1_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame2" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> <p>Or swipe left and right</p> </div> <div id="wrapper"> <div id="scroller"> <ul> <li><a href="project1.html"><img src="img/frame1_img.jpg" alt="garfield"/></a></li> <li><a href="A1.html"><img src="img/A1.gif" alt="garfield" /></a></li> <li><a href="B1.html"><img src="img/B1.gif" alt="garfield" /></a></li> <li><a href="C1.html"><img src="img/C1.gif" alt="garfield" /></a></li> <li><a href="D1.html"><img src="img/D1.gif" alt="garfield" /></a></li> <li><a href="E1.html"><img src="img/E1.gif" alt="garfield" /></a></li> <li><a href="F1.html"><img src="img/F1.gif" alt="garfield" /></a></li> <li><a href="G1.html"><img src="img/G1.gif" alt="garfield" /></a></li> </ul> </div> </div></div><!-- /content --></div><!-- /page --><!-- Start of second frame --><div data-role="page" data-theme="b" id="frame2"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame2_img.jpg" alt="frame2_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame1" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame3" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> <p>Or swipe left and right</p> </div></div><!-- /content --></div><!-- /page --><!-- Start of third frame --><div data-role="page" data-theme="b" id="frame3"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame3_img.jpg" alt="frame3_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame2" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame4" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> <p>Or swipe left and right</p> </div></div><!-- /content --></div><!-- /page --><!-- Start of fourth frame --><div data-role="page" data-theme="b" id="frame4"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame4_img.jpg" alt="frame4_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame3" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame5" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> <p>Or swipe left and right</p> </div></div><!-- /content --></div><!-- /page --><!-- Start of five frame --><div data-role="page" data-theme="b" id="frame5"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame5_img.jpg" alt="frame5_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame4" data-icon="arrow-l" data-role="button">Back</a> <a href="#frame6" data-icon="arrow-r" data-iconpos="right" data-role="button">Next</a> <p>Or swipe left and right</p> </div></div><!-- /content --></div><!-- /page --><!-- Start of six frame --><div data-role="page" data-theme="b" id="frame6"><div data-role="content" class="page_content"> <div data-role="header" data-theme="b" class="header"> <h1>Garfield</h1> </div><!-- /header --> <img src="img/frame6_img.jpg" alt="frame6_img"> <div data-role="controlgroup" data-type="horizontal" class="controlgroup"> <a href="#frame5" data-icon="arrow-l" data-role="button">Back</a> <p>Or swipe left and right</p> </div></div><!-- /content --></div><!-- /page --></body></html> mystyle.css .header{ max-width:400px;}div a{ max-width:400px;}img{ width:100%; max-width:400px;}.page_content{ margin-left:auto; margin-right:auto;}.controlgroup a{ width:50%; max-width:200px; font-size:100%;}.controlgroup{ white-space:nowrap; } ul li{ padding:10px; display:inline;}#wrapper{ margin:-10px; width:100%; max-width:400px; height:140px; overflow:auto; white-space:nowrap;}ul li img{ width:100px; height:100px; } #scroller{ width:1000px;}
×
×
  • Create New...