AlenD
Members-
Posts
12 -
Joined
-
Last visited
Never
Everything posted by AlenD
-
Yeah I was messing with it, pardon for the hang-ups, must be when I'm re-uploading files. I'll try your suggestions now, thanks!
-
Okay sorry for posting like that I was really sleepy. Here is the code again: <script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { //Set Default State of each portfolio piece $(".paging").show(); $(".paging a:first").addClass("active"); //Get size of images, how many there are, then determin the size of the image reel. var imageWidth = $(".window").width(); var imageSum = $(".image_reel img").size(); var imageReelWidth = imageWidth * imageSum; //Adjust the image reel to its new size $(".image_reel").css({'width' : imageReelWidth}); //Paging + Slider Function rotate = function(){ var triggerID = $active.attr("rel") - 1; //Get number of times to slide var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide $(".paging a").removeClass('active'); //Remove all active class $active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function) //Slider Animation $(".image_reel").animate({ left: -image_reelPosition }, 600 ); }; //Rotation + Timing Event rotateSwitch = function(){ play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds $active = $('.paging a.active').next(); if ( $active.length === 0) { //If paging reaches the end... $active = $('.paging a:first'); //go back to first } rotate(); //Trigger the paging and slider function }, 6000); //Timer speed in milliseconds (3 seconds) }; rotateSwitch(); //Run function on launch //On Hover $(".image_reel a").hover(function() { clearInterval(play); //Stop the rotation }, function() { rotateSwitch(); //Resume rotation }); //On Click $(".paging a").click(function() { $active = $(this); //Activate the clicked paging //Reset Timer clearInterval(play); //Stop the rotation rotate(); //Trigger rotation immediately rotateSwitch(); // Resume rotation return false; //Prevent browser jump to link anchor }); }); </script> Here is a sample test server: http://www.skylightinfinity.com/dev/nm/nmrender/index.php I have tested in IE, Firefox, and Chrome, and happens on all of them occasionally. What do you mean by console messages?
-
<script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script type="text/javascript"> $(document).ready(function() { //Set Default State of each portfolio piece $(".paging").show(); $(".paging a:first").addClass("active"); //Get size of images, how many there are, then determin the size of the image reel. var imageWidth = $(".window").width(); var imageSum = $(".image_reel img").size(); var imageReelWidth = imageWidth * imageSum; //Adjust the image reel to its new size $(".image_reel").css({'width' : imageReelWidth}); //Paging + Slider Function rotate = function(){ var triggerID = $active.attr("rel") - 1; //Get number of times to slide var image_reelPosition = triggerID * imageWidth; //Determines the distance the image reel needs to slide $(".paging a").removeClass('active'); //Remove all active class $active.addClass('active'); //Add active class (the $active is declared in the rotateSwitch function) //Slider Animation $(".image_reel").animate({ left: -image_reelPosition }, 600 ); }; //Rotation + Timing Event rotateSwitch = function(){ play = setInterval(function(){ //Set timer - this will repeat itself every 3 seconds $active = $('.paging a.active').next(); if ( $active.length === 0) { //If paging reaches the end... $active = $('.paging a:first'); //go back to first } rotate(); //Trigger the paging and slider function }, 6000); //Timer speed in milliseconds (3 seconds) }; rotateSwitch(); //Run function on launch //On Hover $(".image_reel a").hover(function() { clearInterval(play); //Stop the rotation }, function() { rotateSwitch(); //Resume rotation }); //On Click $(".paging a").click(function() { $active = $(this); //Activate the clicked paging //Reset Timer clearInterval(play); //Stop the rotation rotate(); //Trigger rotation immediately rotateSwitch(); // Resume rotation return false; //Prevent browser jump to link anchor }); }); //Image Hover $(function() { $('img[data-hover]').hover(function() { $(this).attr('tmp', $(this).attr('src')).attr('src', $(this).attr('data-hover')).attr('data-hover', $(this).attr('tmp')).removeAttr('tmp'); }).each(function() { $('<img />').attr('src', $(this).attr('data-hover')); });; }); </script> Heres all of my Javascript, basically good sirs is that it just scrolls images on a time basis. It works perfectly fine, but sometimes when I leave the page and switch back to it the timer is fucked and it scrolls too fast. How do I fix this?
-
Changing variables and reloading sql query with Java Script/Jquery
AlenD replied to AlenD's topic in Javascript Help
Okay, I am prepared to self study and learn, but please direct me to what part I should be looking into please. -
Changing variables and reloading sql query with Java Script/Jquery
AlenD replied to AlenD's topic in Javascript Help
By the way, my code looks like this: Basically I want to change the display of the echos of query 2 when I click query 1. <?php include "backend/settings.php"; mysql_connect ("localhost", $username, $password); <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type="text/javascript" src="scripts/jquery-1.6.2.min.js"></script> <script> $(document).ready(function(){ $("#atdisp").click(function(){ $("").html(?); }); }); </script> </head> <body> <?php $query = "SELECT * FROM activities"; $result = mysql_query($query); $num = mysql_numrows($result); $id = mysql_result($result, 0, "id"); $i = 0; while ($i < $num) { $title = mysql_result($result, $i, "title"); echo '<div id="atdisp" class="atdisp2"><a href="#">'.$title.'</a></div><div class="spacer"></div>'; $i++; } ?> <?php $query2 = "SELECT * FROM activities WHERE id = $id"; $result2 = mysql_query($query2); $title = mysql_result($result2, 0, "title"); $date = mysql_result($result2, 0, "date"); $machinery = mysql_result($result2, 0, "machinery"); $info = mysql_result($result2, 0, "info"); $image = mysql_result($result2, 0, "image"); echo '<div id="cdisp">'; echo '<div id="tdisp">'.$title.'</div><div class="spacer"></div>'; echo '<div id="ddisp">'.$date.'</div><div class="spacer"></div>'; echo '<div id="idisp">'.$info.'</div><div class="spacer"></div>'; $list = explode(",",$machinery); foreach($list as $machinery){ echo '<div id="mdisp"><li>'.$machinery.'</li></div>'; } echo '<div id="pdisp"><img src="images/'.$image.'" /></div>'; echo '</div>'; mysql_close(); ?> </body> </html> -
Hello, I have a div that contains echos from mySQL. I have another div that echos the titles of the contents of the table. I want to change the contents of the div depending on which title I click. I have placed unique IDs for the titles, so I was wondering how I could change the content of the div.
-
Thank you, I was looking for that explode function and have added <li></li> to the foreach echo. Thank you guys, it has worked perfectly. I have learned three new concepts thanks to you two.
-
Hello, I'm wondering if there is a way to display text content in a single cell in mySQL in an ordered list. For instance, I have a cell named foodname, servings, ingredients under the table recipes. inside ingredients I'll put a lot of items.. can I echo them automatically in an ordered list?
-
Hello everyone, this my code and it updates text and an image in a database. I'm just asking for help on what I can do to refine it? Like security for file uploads and what parameters should I add to it? <?php $hostname = "localhost"; $db_user = "root"; $db_password = ""; $database = "ymir"; $db_table = "content"; $db = mysql_connect($hostname, $db_user, $db_password); mysql_select_db($database,$db); ?> <html> <head> <title>File Uploader</title> </head> <body> <?php if (isset($_REQUEST['Submit']) && $_FILES['userfile']['size'] > 0) { $filename = $_FILES['userfile']['name']; $sql = "UPDATE $db_table SET header = '".mysql_real_escape_string(stripslashes($_REQUEST['header']))."' , body = '".mysql_real_escape_string(stripslashes($_REQUEST['body']))."' , pic = '".mysql_real_escape_string(stripslashes($filename))."'"; if($result = mysql_query($sql ,$db)) { echo '<h1>Thank you</h1>Your information has been entered into our database'; echo "<br>File $filename uploaded<br>"; move_uploaded_file($_FILES["userfile"]["tmp_name"], "upload/" . $_FILES["userfile"]["name"]); echo "Stored in: " . "upload/" . $_FILES["userfile"]["name"]; } else { echo "ERROR: ".mysql_error(); } } ?> <h1>Please insert information and image here</h1><hr> <form method="post" enctype="multipart/form-data" action=""> Title:<br> <input type="text" name="header"> <br> Body:<br> <input type="text" name="body"> <br> <input type="hidden" name="MAX_FILE_SIZE" value="700000" /> Image: <input type="file" name="userfile" /> <br><br> <input type="submit" name="Submit" value="Submit"> </form> </body> </html>
-
Thank you sir for directing me to the right path, I have successfully transfered the temporary folder to a designated folder in the web tree, then display it with image tags. But my current problem is the image path has a fixed name, and if I upload a different file with a different file name, the image will not be displayed because indeed the file name is different. What is the way to make the file for the image tag dynamic?
-
Hello sir, I have been reading that documentation, as you can see the example I have given uses the same example given in the POST method page. It has been said that the important things are that the file size shouldn't exceed the limit, and I have to set the form enctype, in which I have put attention to both. Can you please tell me what is wrong so I may pinpoint my mistake and learn from it?
-
I'm beginning with simple codes to understand how things work and work my way up with what I need. My upload form looks like this: <form name="upload about" action="display.php" enctype="multipart/form-data" method="post"> Header: <input type="text" name="header" /> Body: <input type="text" name="body" /> <input type="hidden" name="MAX_FILE_SIZE" value="30000" /> Image: <input type="file" name="pic" /> <input type="submit" /> </form> And my display page is just as simple. <?php echo $_POST["header"]; ?> <?php echo $_POST["body"]; ?> <?php echo $_FILES['pic']['name']; ?> The problem is, whenever I submit the data, everything is fine, except the image does not display and just posts the filename of the image I uploaded. According to my research setting the enctype to multipart/formdata should display the image, but it does not. Can anyone tell me what's wrong?
-
Hello everyone, my name is Alen and I'm new here. I'm currently studying server side scripting and databases, and I'm looking forward to learning and growing with this community.