Jump to content

Search the Community

Showing results for tags 'jquery'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...

Date Created

  • Start


Last Updated

  • Start


Filter by number of...


  • Start





Website URL








Donation Link

  1. Hi again PHP Freaks. So I would like to code something similar to the buy menu of Counter-strike: Global offensive in-game module, just in a browser and for a project of mine. I've made the design in photoshop to illustrate better. I just don't know what I should look into to make this kind of menu, I would love if someone could explain me what languages that this would require. (I'm guessing HTML, CSS and jQuery but I am not sure) more specific help like which particular codes would be much appreciated. Here is a picture of what I would like to create. (Also attached) http://i1227.photobucket.com/albums/ee433/rec0ill/CSGOKeyz_zps4195288a.png
  2. Hello Guys... I need help about my validate scripts... $(document).ready(function(){ //Validation jQuery.validator.addMethod('validIPurl', function(value) { var ip = '^([01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]).([01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]).([01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5]).([01]?[0-9]{1,2}|2[0-4][0-9]|25[0-5])$'; var URL = /^(http|https)?:\/\/[a-zA-Z0-9-\.]+\.[a-z]{2,4}/; //HOW TO JOIN AND VALIDATE BOTH VARIABLE IP AND URL???? } }, 'Invalid Address'); //if(/^(http|https|ftp):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/i) $(".myfirstform").validate( { rules: { ip: { validIPurl: true } }, ); }, I use jquery.validate javascripts to validate user input.. I also try to create if..else to join IP and URL but the control statement not working Hope you guys can help for the solution...
  3. Hello, I'm Paul Ryan. I am 23 years old and have around 8 years experience in programming with the following languages: - PHP - MySQLi - HTML - CSS - JavasScript (jQuery, AJAX) I have worked on many project over the years, including the following: - BoxSelect.com - Taccd.com - FTA.ie - BelfastCookerySchool.com - Dittnyebad.no - MassasjeShop.no - Project: Universe (Personal Project) I have worked on many other smaller jobs, updating outdated code, database and code optimizations etc. You can contact me via the following methods: - PHP Freaks Personal Message - Skype: paulryanmc91 - E-mail: paul.ryan.mclaughlin@gmail.com I am available to start work immediately whether the job be big or small, don't hesitate to contact me. Thanks for your time, look forward to hearing from you. Kind Regards, Paul Ryan
  4. When I click on the letter of the alphabet on my form page, it will bring up the results of my query. I got this part working. The next part is to be able to click on any of the populated results and have it autofill my form with organization, first name, last name, email address and phone number. I know that I need to use Ajax and jQuery to accomplish this. Here is my html <!-- Letter Search --> <div class="searchBox span12"> <h3>Choose the First Letter of the Person's Last Name</h3> <ul> <li class="alphabets" id="A"><a href="?by=A">A</a></li> <li class="alphabets" id="B"><a href="?by=B">B</a></li> <li class="alphabets" id="C"><a href="?by=C">C</a></li> <li class="alphabets" id="D"><a href="?by=D">D</a></li> <li class="alphabets" id="E"><a href="?by=E">E</a></li> <li class="alphabets" id="F"><a href="?by=F">F</a></li> <li class="alphabets" id="G"><a href="?by=G">G</a></li> <li class="alphabets" id="H"><a href="?by=H">H</a></li> <li class="alphabets" id="I"><a href="?by=I">I</a></li> <li class="alphabets" id="J"><a href="?by=J">J</a></li> <li class="alphabets" id="K"><a href="?by=K">K</a></li> <li class="alphabets" id="L"><a href="?by=L">L</a></li> <li class="alphabets" id="M"><a href="?by=M">M</a></li> <li class="alphabets" id="N"><a href="?by=N">N</a></li> <li class="alphabets" id="O"><a href="?by=O">O</a></li> <li class="alphabets" id="P"><a href="?by=P">P</a></li> <li class="alphabets" id="Q"><a href="?by=Q">Q</a></li> <li class="alphabets" id="R"><a href="?by=R">R</a></li> <li class="alphabets" id="S"><a href="?by=S">S</a></li> <li class="alphabets" id="T"><a href="?by=T">T</a></li> <li class="alphabets" id="U"><a href="?by=U">U</a></li> <li class="alphabets" id="V"><a href="?by=V">V</a></li> <li class="alphabets" id="W"><a href="?by=W">W</a></li> <li class="alphabets" id="X"><a href="?by=X">X</a></li> <li class="alphabets" id="Y"><a href="?by=Y">Y</a></li> <li class="alphabets" id="Z"><a href="?by=Z">Z</a></li> </ul> <? include('search.php'); ?> </div> <hr style="color:#ccc; margin-bottom:20px;" /> <!-- Main Form --> <div id="mainForm"> <form method="post" id="icsForm" class="searchBox span12"> <div id="col1" class"span6"> <h3>Contact Information</h3> <label>Church / Organization:</label><input type="text" name="organization" id="organization" class="span6 upright" /><br /> <label>First Name:</label><input type="text" name="firstName" id="firstName" class="span6 upright" /> <label>Last Name:</label><input type="text" name="lastName" id="lastName" class="span6 left upright" /> <label>Email Address:</label><input type="text" name="email" id="email" class="span6 left upright" /> <label>Phone Number:</label><input type="text" name="phone" id="phone" class="span6 left upright" /> </div> </div> Here is my php if(preg_match("/^[A-Z | a-z]+/", $_POST['name'])){ $name=$_POST['name']; } if(isset($_GET['by'])){ $letter=$_GET['by']; //query to sort by last name $sql="SELECT contact_id, first_name, last_name, church_org, email_address, phone_number FROM ics_data WHERE last_name LIKE '$letter%' ORDER BY last_name ASC"; //run the query against the mysql query function $result=mysql_query($sql); //count results $numrows=mysql_num_rows($result); echo "<p>" .$numrows . " results found for " . $letter . "</p>"; //Create while loop and loop through result set while($row=mysql_fetch_array($result)){ $first_name=$row['first_name']; $last_name=$row['last_name']; $church_org=$row['church_org']; $email_address=$row['email_address']; $phone_number=$row['phone_number']; $contact_id=$row['contact_id']; //display the result of the array echo "<div id=\"search-results\">"; echo "<ul class=\"letter-results\">\n"; echo "<li class=\"result-row\">" . "<a href=\"#\" class=\"testclass\">" .$first_name . " " .$last_name . "". ", " ."" .$church_org ."</a></li>\n"; echo "</ul>"; echo "</div>"; } } Here is my Javascript file (Ajax) $(document).ready( function() { function formfill() { var organization = $('#organization').val(); var firstname = $('#firstname').val(); var lastname = $('#lastname').val(); var email = $('#email').val(); var phone = $('#phone').val(); $.ajax ({ method: "GET", url: "search.php", dataType: 'json', data: { organization:organization, firstname:firstname, lastname:lastname, email:email, phone:phone }, type: "POST", success: function(data) { $organization $firstname $lastname $email $phone }, failure: function() { alert('fail!'); } }); } I know that I do not have a reference yet to JSON in my php file and that it is needed. I'm not solid on the Ajax part. That is the part that is tripping me up. I know that I need to make the form autofill when clicking on a specific result returned from my query... but i'm not sure how to do that. Thank you in advance for any help or advice you can give!! I am relatively new to programming. Hopefully I posted this in the right forum as a lot of these technologies overlap.
  5. Good Day PHP world, I am encountering a problem in php code meant to allow the user to update their profile picture. I am using jquery.min and jquery.js. The code below runs with no errors reported. The file has been successfully uploaded to upload path using this form. upload.php <form id="imageform" method="post" enctype="multipart/form-data" action='ajaximage.php'> <input type="file" name="photoimg" id="photoimg" class="stylesmall"/> </form> ajaximage.php $path = "uploads/"; $valid_formats = array("jpg", "png", "gif", "bmp","jpeg"); if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST") { $name = $_FILES['photoimg']['name']; $size = $_FILES['photoimg']['size']; if(strlen($name)) { list($txt, $ext) = explode(".", $name); if(in_array($ext,$valid_formats)) { if($size<(1024*1024)) // Image size max 1 MB { $actual_image_name = $name.".".$ext; $tmp = $_FILES['photoimg']['tmp_name']; if(move_uploaded_file($tmp, $path.$actual_image_name)) { $query = "UPDATE users SET profile_image='$actual_image_name' WHERE student_id='{$_SESSION['user_id']}'"; $result = mysqli_query($link_id, $query); echo "<img src='uploads/".$actual_image_name."' class='preview'>"; } The problem is the image being uploaded does not display on the Student_home.php <div id="about-img"> <img class="profile-photo" align="middle" src='uploads/".$actual_image_name."' /> </div> But the image uploaded will display when i write directly its filename example <div id="about-img"> <img class="profile-photo" align="middle" src="uploads/107.jpg" /> </div> My problem is i wanted to display the uploaded picture of the specific student on Student_Home.php
  6. I would appreciate if someone could figure this out or tell me the easiest way to do this. I need a count up counter that appears in a textbox so I can record the time a user is on a page. On a side note, I do have their Start and finish time timestamp recorded in myphpadmin database but I am looking for the easiest (or best) way to do this. Any advice or scripts would be very much appreciated. Thanks in advanced. I did find this counter that works but the numbers appear 0.0.1 if counting up. I don't want to confuse the user. I really want to display to the user how long they was on a certain page. <script> $(document).ready(function() { var time = '00:00:00', parts = time.split(':'), hours = +parts[0], minutes = +parts[1], seconds = +parts[02], input = $('#timeInput'); var timer = setInterval(function(){ seconds++; if(seconds == 60) { seconds = 00; minutes++; if(minutes == 60) { minutes = 00; hours++; } } var newTime = hours + ":" + minutes + ":" + seconds; $('#timeInput').val(newTime); }, 1000); }); </script> <input type="text" name="time" id="timeInput"/>
  7. We are trying to get progress bar to place active class on the current page it one based on variable being set on page called "page", also the page is written into the <body class="page"> tag, once it is loading the page. It is not working as we need can anyone, help us with script below to set progress bar to do prev and next????? So variable is: var page = "refundstep1"; Body Class tage looks like: <body class="refunStep 1 main-layout"> Progress bar is: <div class="tabContent progress-bar hidden-phone"> <div class="step active"> <h2>Step 1: Enter your Pin</h2> </div> <div class="step inactive"> <h2>Step 2: Tell us your address</h2> </div> <div class="step inactive"> <h2>Step 3: Confirm Your Details</h2> </div> </div> Code to actual set the other list next as class="inactive", list passed or compelted as class="active done", Current page as class="active" var progressClass = $('.progress-bar div.step'); $(progressClass).addClass(function(index, activeClass) { var activeClass = 'done'; var activePage = 'active'; alert(page); var currentPage = page; var pageClass = $('body').hasClass(page); console.log(pageClass); if(pageClass === true) { progressClass.addClass(activePage); progressClass.prevAll().addClass(activeClass); //To select all next elements of `.progressClass` element: progressClass.nextAll().addClass(nopageClass); } return nopageClass; });
  8. my name is fairooj and ama new to php and jquery. i have a proplam. i want your help. <script type="text/javascript"> var count = 0; $(function(){ $('p#add_field').click(function(){ count += 1; $('#container').append( '<strong>Link #' + count + '</strong><br />' + '<input id="field_' + count + '" name="fields[]' + '" type="text" />' + '<input id="code_' + count + '" name="code[]' + '" type="text" /><br />' ); }); }); </script> this is my script to add more text boxes.. and this is ma code for insert it to database <?php //If form was submitted if (isset($_POST['btnSubmit'])) { //create instance of database class $db = new mysqldb(); $db->select_db(); //Insert static values into users table $sql_user = sprintf("INSERT INTO users (Username, Password) VALUES ('%s','%s')", mysql_real_escape_string($_POST['name']), mysql_real_escape_string($_POST['password']) ); $result_user = $db->query($sql_user); //Check if user has actually added additional fields to prevent a php error if ($_POST['fields']) { //get last inserted userid $inserted_user_id = $db->last_insert_id(); //Loop through added fields foreach ( $_POST['fields'] as $key=>$value ) { //Insert into websites table $sql_website = sprintf("INSERT INTO websites (Website_URL, web_Link) VALUES ('%s', '%s')", mysql_real_escape_string($value), mysql_real_escape_string($value) ); $result_website = $db->query($sql_website); $inserted_website_id = $db->last_insert_id(); //Insert into users_websites_link table $sql_users_website = sprintf("INSERT INTO users_websites_link (UserID, WebsiteID) VALUES ('%s','%s')", mysql_real_escape_string($inserted_user_id), mysql_real_escape_string($inserted_website_id) ); $result_users_website = $db->query($sql_users_website); } } else { ?> the problame web_Link sql table is repeating Website_URL table value.... plz how can i solve this am waiting for your reply..
  9. I have a multi-step form that offers different options of membership to users with the e-mail domain 'vip.co.uk' I finally have it working but have hit a wall with pulling the variables together to form an URL that can be submitted to the payment gateway in the final step. The variables I need to pass are username, password, email, subscription id (a value attached to a radio button in step 2 - not yet built it). I have a JS fiddle at http://jsfiddle.net/zsasvoo4/15/. The final form will be in PHP and I'd prefer to use that language.
  10. Hello, I am building an online game(users make a character and move on a map and so on...) All user data is stored in a mySQL database and I want the users to interact in real-time, but there can be a 1-3 second delay between the communication, but not exceed 3 seconds even if 500 players are playing at the same time. But for the purpose of the question let's say the users can only chat between one another, if I'll have a solution for that then I can use the same method for more parts of the game. I can't use websockets because my webhost doesn't support it( I don't want to use pusher.com). I know I can make real-time apps with ajax long polling, but I think that with 500 players playing at the same time it's not the best solution. So, finally: How can I make user interaction as close as possible to a real-time game? (Without too much load on the hosting server) (I am sorry if some of my terms are not correct - I am just getting back to coding after a long time...)
  11. I have the following menu that changes to red if each of the menu items are hovered over. This menu shows on every page of my website. I have the following problem: If a user was to click a menu item (e.g. Menu 2), the page will navigation to the page set in the a tag (i.e page2.html) If the user was to leave there mouse in the same position as it was in before the menu item was clicked (i.e. over the selected menu item), then the menu would automatically change to red again on the new page, as the jQuery hover code below will be activated. Is there a way to stop this behaviour? Ideally I want users to have to mouse off of the menu item and then on it again before the menu item changes to red if the users mouse is still over the selected menu item after clicking one of the menu links. <script type="text/javascript"> $(document).ready(function() { $('li').hover(function() { $(this).css('background', 'red'); }, function() { $(this).css('background', 'none'); }) }) </script> <ul> <li><a href="page1.html">Menu 1</a></li> <li><a href="page2.html">Menu 2</a></li> <li><a href="page3.html">Menu 3</a></li> </ul>
  12. Hi, I've seen this done, and I thought it would be simple now that I am starting to understand ajax but I can't figure it out. I am using jQuery ajax via wordpress. I can click a button, call a php function and use the value returned from php to populate the textbox. Ok, great! but I want to run a rather lengthy procedure, and while it's running I would like it to record it's status in a multi-line text box as sort of a debugger ( and to pass the time while waiting ) How can I accomplish this? I've googled but I must not be using the correct words to search.
  13. Hi ! I am having a heck of a time sending data back in responseText. First of all, I am not actually sure how my data is being sent back into responseText - it is the result of me using a jquery plugin called iframetransport which seeks to transport file inputs across an iframe for ajax like form submission. Anyway, I am echoing back data from PHP like so echo json_encode(array("rowData"=> '<div class = "row" data-id = "'.$row['id'].'" > <div class = "row"><img src="data:image/jpeg;base64,'.base64_encode( $row['blob'] ).'"/></div> <div class = "container"> <div class = "name"><p>'.$row['name'] .'</p></div> </div> </div>')); I know that this data is valid in normal ajax $.posts because I also have form submission without the iframetransport, and it returns the exact same data with no issue. However, when the above data makes its way into responseText it looks like this on the client side: "{"rowData":"\n\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tasdasd<\/p><\/div>\n\t\t\t\t\t\t\t<\/p><\/div>\n\t\t\t\t\t\t\t<\/p><\/div>\n\t\t\t\t\t\t\t1<\/p><\/div>\n\t\t\t\t\t\t\t<\/p><\/div>\n\t\t\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>"}" All my divs and elements are replaced with \t or they are not making it into the response. Also when I return blobs like this (this is even worse) I get a 414 (Request-URI Too Large) Any help is appreciated. This is the plugin http://cmlenz.github.io/jquery-iframe-transport/ if interested.
  14. Hi Everyone, I am struggling with a pdf. On our server I get the pdf as a byte array from the database, which I then build up in a StreamingOutput object and return as a pdf file. This is done using java using JAX-RS service. Now when I open the path/link in my browser(chrome/firefox) the pdf opens in the browser. So this means my backend is working. On my webapp I want to use $.ajax to download the pdf and view it in an Iframe or embed it in an <embed> or <object> tag. I need to do this as the service call is actually under username and password, and we do not create a session between the browser and the server - there is a long explanation for this. I saw the option to use http://[username]:[password]@www.myserver.com/... but this was dropped by most browsers. This is why I am trying ajax. Now in my ajax call I do receive the pdf in the success function as: %PDF-1.4.... This open the browser's pdfviewer correctly and every thing, but the pdf only returns blank pages. The Base64 is a java object that I found on the internet. But I have tried it without the base64 but still now luck. Here is my success function from my ajax call. success: function(data, status, xhr) { var pdfText = Base64.encode(xhr.responseText); var url = "data:application/pdf;base64," + escape(pdfText); var html = '<embed width=100% height=600' + ' type="application/pdf"' + ' src="' + url + '">' + '</embed>'; $("div.inner").html(""); $("div.inner").append(html); }, Can anyone help me? Kind regards
  15. hi, I am using fixed-header code for my table on vertical scroll, its working fine for all column name except last two (balance and pay status) because they are going out side page (horizontally). and when i scroll from bottom to see the last two columns values , the fixed header only show the columns till advance, fixed header not showing last two remaining columns that go out side page horizontally. Check the screen shots for better understanding. image-1 you can see all column till pay status. [ATTACH=CONFIG]64973[/ATTACH] image -2 you can see vertical scroll working fine till advance column. [ATTACH=CONFIG]64974[/ATTACH] Image -3 but in this you can see after full horizontal scroll towards right side, it only showing column till advance, instead of balance and pay status. [ATTACH=CONFIG]64975[/ATTACH] Here is the full code Untitled Document $(document).ready(function() { function moveScroll(){ var scroll = $(window).scrollTop(); var anchor_top = $("#maintable").offset().top; var anchor_bottom = $("#bottom_anchor").offset().top; if (scroll>anchor_top && scroll Please check this and if found give me the solution for this. thanks in Advance
  16. I have a website with a variable number of inputs in various categories. I want to allow the user to add rows to the table with the input lines in every category. The table looks like this: <tr><th>Working Capital Changes</th></tr><tr><td><input type="hidden" name="category_code[]" value="WORK"><input type="text" name="description[]" value="Increase (decrease) in working capital" size="60"></td> <td><input type="text" name="amount[1][]" value="" onblur="this.value = formatNumber2Comma(this.value);" ></td></tr> <tr><td><input type="hidden" name="category_code[]" value="WORK"><input type="text" name="description[]" value="" size="60"></td> <td><input type="text" name="amount[1][]" onblur="this.value = formatNumber2Comma(this.value);" ></td></tr> <tr><th>Depreciation and Amortization</th></tr><tr><td><input type="hidden" name="category_code[]" value="DEPR"><input type="text" name="description[]" value="Depreciation and Amortization (for taxes)" size="60"></td> <td><input type="text" name="amount[1][]" value="" onblur="this.value = formatNumber2Comma(this.value);" ></td></tr> <tr><td><input type="hidden" name="category_code[]" value="DEPR"><input type="text" name="description[]" value="" size="60"></td><td><input type="text" name="amount[1][]" onblur="this.value = formatNumber2Comma(this.value);" ></td></tr> I tried adding the following near the top of the page: <script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script type="text/javascript"> var count = 0; $(function(){ alert ('wow'); $('tr#add_field').click(function(){ alert ('whee'); count += 1; $('#container').append('<table><tr><td><input id="field_' + count + 'type="hidden" name="category_code[]" value="DEPR"><input type="text" name="description[]" value="" size="60"></td><td><input type="text" name="amount[1][]" onblur="this.value = formatNumber2Comma(this.value);" ></td></tr></table>' ); }); }); I get the wow alert on page load and whee when I click the link: <tr id="add_field"><th><a href="#">Click to add another line</a></th></tr> that I added to the bottom of the table before the </table> but I do not get an additional line I have tried moving the add_field line outside of the table and changing the <tr></tr> to a <p></p> but that does not help.
  17. Hello, I've just started learning PHP, JavaScript and I've got a big problem on my website. I'm getting this ReferenceError. I know what's the problem, but I don't know how to solve it, and I know people can do it for money but I don't have money, I'm searching for someone who's willing to help newbie. As I said I'm begginer, and I know something. The main problem is because I want to use GKPlugin and Player(jwplayer). Plugin need to use object, example: <object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400"> <param name="movie" value="player.swf" /> <param name="allowFullScreen" value="true" /> <param name="allowScriptAccess" value="always" /> <param name="FlashVars" value="plugins=plugins/proxy.swf&proxy.link=http://www.vidbull.com/53qx9uo10k5d" /> <embed name="flashplayer" src="player.swf" FlashVars="plugins=plugins/proxy.swf&proxy.link=http://www.vidbull.com/53qx9uo10k5d" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="600" height="400" /> </object> Script is generetad just to embed with iframe, and the problem is when I replace it with object, then I'm getting this error. I know that JS can't "call" that iframe to show because I've replaced it with object. You guys probably know about what I'm talking. I'm just searching for some instructions, guidelines from you. ReferenceError: embeds is not defined if (embeds[embedid].indexOf("rapidplayer")== iframe_ad){ Here's the rest of code, I think it's used to show iframe. elseif (substr_count($link,"gorillavid")){ $video_id = explode("/",$link); if (isset($video_id[count($video_id)-1])){ $video_id = $video_id[count($video_id)-1]; $embed = '<object id="flashplayer" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="600" height="400"> <param name="movie" value="http://www.kiinc.com/videott/player.swf" /> <param name="allowFullScreen" value="true" /> <param name="allowScriptAccess" value="always" /> <param name="FlashVars" value="plugins=http://www.kiinc.com/videott/plugins/proxy.swf&proxy.link=http://gorillavid.in/'.$video_id.'" /> <embed name="flashplayer" src="player.swf" FlashVars="plugins=http://www.kiinc.com/videott/plugins/proxy.swf&proxy.link=http://gorillavid.in/'.$video_id.'" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="600" height="400" /> </object>'; This is the original code. Don't look at providers(source as gorillavid) because I used gorillavid in previous an posted another example from another source (zalaa) elseif (substr_count($link,"zalaa")){ $video_id = explode("/",$link); if (isset($video_id[count($video_id)-1])){ $video_id = $video_id[count($video_id)-1]; $embed = '<IFRAME SRC="http://www.zalaa.com/embed-'.$video_id.'.html" FRAMEBORDER=0 MARGINWIDTH=0 MARGINHEIGHT=0 SCROLLING=NO WIDTH='.$width.' HEIGHT='.$height.'></IFRAME>'; Function which embed links and should embed GKPlugin/Player: // general image link if (!$embed){ $embed = "<div style='background-color:#000000; width: ".$width."px; height: ".$height."px;text-align:center;cursor:pointer;' onclick='window.open(\"$link\");'>"; $embed.= "<p style='text-align:center; padding-top: 70px;'>"; $embed.= "<a href='$link' target='_blank' style='font-size:24px; color: #ffffff !important'>Click here to play this video</a>"; $embed.= "</p>"; $embed.= "</div>"; } return $embed; } JavaScript code: function getEmbed(embedid){ if (embeds[embedid].indexOf("rapidplayer")== iframe_ad){ var html_content = "<div class='fake_embed' id='fake_embed"+embedid+"' onclick='closeFakeEmbed("+embedid+");'>" + "<br /><br />" + "<div class='fake_embed_ad_close'><a href='javascript:void(0);' onclick='closeFakeEmbed("+embedid+");'>Close Ad</a></div>" + "<div class='fake_embed_ad' id='fake_embed_ad" + embedid +"'>" + "<iframe src='"+baseurl+"/iframe_ad.php' width='300' height='300' frameborder='NO' border='0'></iframe>" + "</div>" + "<div class='fake_embed_bar'><span class='fake_embed_bar_right'></span></div>" + "</div>" + "<div id='real_embed"+embedid+"' style='display:none'>"+embeds[embedid]+"</div>"; jQuery('#videoBox'+embedid).html(html_content); jQuery('#videoBox'+embedid).show(); } else { jQuery('#videoBox'+embedid).html(embeds[embedid]); jQuery('#videoBox'+embedid).show(); } } function countDown(embedid){ showCounter = showCounter-1; jQuery('span#counter').html(showCounter); if (showCounter>0){ showTimer = setTimeout('countDown('+embedid+');',1000); } else { showTimer = null; showCounter = 20; getEmbed(embedid); } } function changeEmbed(embedid, counter){ if (counter == 0){ jQuery('.embedcontainer').html(''); jQuery('.embedcontainer').hide(); getEmbed(embedid); } else { if (showTimer){ clearTimeout(showTimer); } showTimer = null; showCounter = counter; jQuery('.embedcontainer').html(''); jQuery('.embedcontainer').hide(); jQuery('#videoBox'+embedid).html(js_lang.ticker); jQuery('#videoBox'+embedid+' span#counter').html(showCounter); jQuery('#videoBox'+embedid).slideDown("slow"); showTimer = setTimeout('countDown('+embedid+');',1000); } /* jQuery('li.selected').removeClass('selected'); jQuery('#selector'+embedid).addClass('selected'); */ }
  18. Hi there, I am needing a bit of advice. I am currently working on a new site, and I have my links at the top in a fixed header, and the rest of my content throughout the same page. http://sr.bluepigeon.com have a look it will make more sence then me describing it. Now i have worked a little bit with jQuery but do not know all the ins and outs of it, which is why I am a bit stuck. Now when I click one of the links on the page, I want the page to scroll down to that div and display it in the center of the screen. Now the code I am using (see below) obviously works on my laptops screen size but won't be as 'perfect' and centered on other sized screens. If i user the following code without each of the offsets then it will scroll to the correct div, but it will be displayed on the top of the page and not centered in the middle. What I am wanting to know, is, is it possible to make it scroll to a div and then center the div in the middle of the screen? If not how could i get as close as possible to this? $(document).ready(function(){ $("#blogl").click(function() { $('html, body').animate({ scrollTop: $("#blog").offset().top }, 2000); }); $("#racel").click(function() { $('html, body').animate({ scrollTop: $("#race").offset().top }, 2000); }); $("#aboutl").click(function() { $('html, body').animate({ scrollTop: $("#about").offset().top +700 }, 2000); }); $("#srl").click(function() { $('html, body').animate({ scrollTop: $("#sr").offset().top +100 }, 2000); }); $("#donatel").click(function() { $('html, body').animate({ scrollTop: $("#donate").offset().top }, 2000); }); }); Thanks for your help again Eric
  19. The code is for generated a home page with two div's: 'left_menu' and 'right_menu', where I want to navigate with the links from left_menu should display the content on the right_menu. I have two links (reports and roles) on the left_menu and two tabs (tab1 and tab2) on the right_menu. 1. When I click on reports, it should open the tab1 and clicking on users should open the tab2. 2. When I launch home.php, the first item(reports) should be opened by default and the tab1 accordingly. Here is the my code I tried, when I click the roles on left_menu, it is opening the default one i.e. tab1 and the left_menu isn't opened by default. home.php <html lang="<?php echo _SITE_LANGUAGE ?>"> <head> <script src="../js/jqueryv1.10.2.js"></script> <script type="text/javascript"> //accordion left menu $ (document).ready(function() { $ (".wings").click(function(event) { $(".box").slideUp("slow"); if ($(this).next().is(":hidden") == true) { $(this).next().slideDown("slow"); } }); //(".box").hide("slow"); }); //Tab (rightbox) $(document).ready(function() { $('#tabs li a:not(:first)').addClass('inactive'); $('.contain').hide(); $('.contain:first').show(); $('#tabs li a').click(function() { var t = $(this).attr('id'); if($(this).hasClass('inactive')) { //this is the start of our condition $('#tabs li a').addClass('inactive'); $(this).removeClass('inactive'); $('.contain').hide(); $('#'+ t + 'C').fadeIn('slow'); } }); }); </script> <style> .wings { width:200px; float:left; padding:7px 11px; } .box { width:195px; float:left; display:none; margin:0px 20px; } </style> </head> <body> <?php echo '<div class="left_menu"> <div class="wings"> <div style="float:left;"><img src="images/right_arrow.gif"/></div> <div style="float:left;padding:0px 7px;"><a href="display.php"><a href="report.php">Reports</a></div> <div style="float:right;"><img src="images/downarrow.png" style="width:17px;height:17px;cursor:pointer;"/></div> </div> <div class="box">'; $reports = $reports->get_report(); $reports_count = count($reports); if ($reports_count > 0 ) { foreach ($reports as $ds) { echo '<div style="float:left;margin:5px 14px;width:180px;"> <div style="float:left;"><img src="images/right_arrow.png"></div> <div style="float:left;padding:0px 6px;">'.$ds['dsource_name'].'</img></div> <div style="float:left;"><a href="edit_dsource.php?id='.$ds['id'].'"><img src="images/edit.gif"/></a></div> <div style="float:left;padding:1px 2px;"><img src="images/not-available.png"/></div> </div>'; } } else echo 'No Datasources'; echo '</div> <div class="wings"> <div style="float:left;"><img src="images/right_arrow.gif"/></div> <div style="float:left;padding:0px 7px;"><a href="display.php"><a href="report.php">Roles</a></div> <div style="float:right;"><img src="images/downarrow.png" style="width:17px;height:17px;cursor:pointer;"/></div> </div> <div class="box">'; $roles = $roles->get_report(); $roles_count = count($roles); if ($roles_count > 0 ) { foreach ($roles as $ds) { echo '<div style="float:left;margin:5px 14px;width:180px;"> <div style="float:left;"><img src="images/right_arrow.png"></div> <div style="float:left;padding:0px 6px;">'.$ds['dsource_name'].'</img></div> <div style="float:left;"><a href="edit_dsource.php?id='.$ds['id'].'"><img src="images/edit.gif"/></a></div> <div style="float:left;padding:1px 2px;"><img src="images/not-available.png"/></div> </div>'; } } else echo 'No Datasources'; echo '</div>'; echo '</div> <!--left_menu-->'; echo '<div class="right_menu"> <ul id="tabs"> <li><a id="tab1">Configuration</a></li> <li><a id="tab2">Report Viewer</a></li> </ul> <div class="container" id="tab1C"> <div id="content" style="padding-left:35px;"><h3><font color="brown"> </font><br> ( Report Tab content ) </div> </div> <div class="container" id="tab2C"> <div id="content" style="padding-left:35px;"><h3><font color="brown"> </font><br> ( Report Tab content ) </div> </div>'; echo '</div><!--right_menu-->'; ?> </body> </html> JS Fiddle : http://jsfiddle.net/gansai/s9NvX/1/
  20. Hi could anyone help me please. I have this code and tried to do event calendar and retrieve the event data from mysql phpMyAdmin. My problem is current year doesnt display all data from database on the calendar. example i've manually add data from January until May for current year (2014) but it only display the data for May only. it seems that other data is not been display properly. another problem is that im stuck with, example when im in current month (example May) all data is display but when i've click the navigation link to go to the previous month and when i go back to current month (May) the event that has been mark on the calendar is missing. PLEASE i need this to be done this week or else im dead! //config.php <?php /* Define MySQL connection details and database table name */ $SETTINGS["hostname"]='localhost'; $SETTINGS["mysql_user"]='root'; $SETTINGS["mysql_pass"]=''; $SETTINGS["mysql_database"]='talentlo'; $SETTINGS["data_table"]='event_calendar'; /* Connect to MySQL */ if (!isset($install) or $install != '1') { $connection = mysql_connect($SETTINGS["hostname"], $SETTINGS["mysql_user"], $SETTINGS["mysql_pass"]) or die ('Unable to connect to MySQL server.<br ><br >Please make sure your MySQL login details are correct.'); $db = mysql_select_db($SETTINGS["mysql_database"], $connection) or die ('request "Unable to select database."'); }; ?> //calendar.php <?php error_reporting(0); include("config.php"); /// get current month and year and store them in $cMonth and $cYear variables (intval($_REQUEST["month"])>0) ? $cMonth = intval($_REQUEST["month"]) : $cMonth = date("m"); (intval($_REQUEST["year"])>0) ? $cYear = intval($_REQUEST["year"]) : $cYear = date("Y"); // generate an array with all dates with events $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE `event_date` LIKE '".$cYear."-".$cMonth."-%'"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { $events[$row["event_date"]]["title"] = $row["title"]; $events[$row["event_date"]]["description"] = $row["description"]; $events[$row["event_date"]]["venue"] = $row["venue"]; $events[$row["event_date"]]["time"] = $row["time"]; $events[$row["event_date"]]["date"] = $row["event_date"]; } // calculate next and prev month and year used for next / prev month navigation links and store them in respective variables $prev_year = $cYear; $next_year = $cYear; $prev_month = intval($cMonth)-1; $next_month = intval($cMonth)+1; // if current month is December or January month navigation links have to be updated to point to next / prev years if ($cMonth == 12 ) { $next_month = 1; $next_year = $cYear + 1; } elseif ($cMonth == 1 ) { $prev_month = 12; $prev_year = $cYear - 1; } if ($prev_month<10) $prev_month = '0'.$prev_month; if ($next_month<10) $next_month = '0'.$next_month; ?> <table width="100%"> <tr> <td class="mNav"><a href="javascript:LoadMonth('<?php echo $prev_month; ?>', '<?php echo $prev_year; ?>')"><<</a></td> <td colspan="5" class="cMonth"><?php echo date("F, Y",strtotime($cYear."-".$cMonth."-01")); ?></td> <td class="mNav"><a href="javascript:LoadMonth('<?php echo $next_month; ?>', '<?php echo $next_year; ?>')">>></a></td> </tr> <tr> <td class="wDays">Monday</td> <td class="wDays">Tuesday</td> <td class="wDays">Wednesday</td> <td class="wDays">Thursday</td> <td class="wDays">Friday</td> <td class="wDays">Saturday</td> <td class="wDays">Sunday</td> </tr> <?php $first_day_timestamp = mktime(0,0,0,$cMonth,1,$cYear); // time stamp for first day of the month used to calculate $maxday = date("t",$first_day_timestamp); // number of days in current month $thismonth = getdate($first_day_timestamp); // find out which day of the week the first date of the month is $startday = $thismonth['wday'] - 1; // 0 is for Sunday and as we want week to start on Mon we subtract 1 for ($i=0; $i<($maxday+$startday); $i++) { if (($i % 7) == 0 ) echo "<tr>"; if ($i < $startday) { echo "<td> </td>"; continue; }; $current_day = $i - $startday + 1; if ($current_day<10) $current_day = '0'.$current_day; // set css class name based on number of events for that day if ($events[$cYear."-".$cMonth."-".$current_day]<>'') { $css='withevent'; $click = "onclick=\"LoadEvents('".$cYear."-".$cMonth."-".$current_day."')\""; } else { $css='noevent'; $click = ''; } echo "<td class='".$css."'".$click.">". $current_day . "</td>"; if (($i % 7) == 6 ) echo "</tr>"; } ?> </table> //events.php <?php error_reporting(0); include("config.php"); $sql = "SELECT * FROM ".$SETTINGS["data_table"]." WHERE `event_date` = '".mysql_real_escape_string($_REQUEST["date"])."'"; $sql_result = mysql_query ($sql, $connection ) or die ('request "Could not execute SQL query" '.$sql); while ($row = mysql_fetch_assoc($sql_result)) { echo "<h2>".stripcslashes($row["title"])."</h2>"; // echo "<span>".stripcslashes($row["description"])."</span>"; echo "<span>".stripcslashes($row["venue"])."</span>"; echo "<br />"; echo "<span>".stripcslashes($row["time"])."</span>"; } ?> //index.html <!DOCTYPE html> <html lang="en"> <!-- MEGAFOLIO LIGHTBOX FILES --> <link href="css/calendar.css" rel="stylesheet" type="text/css" /> <head> </head> <body> <div id="Calendar" > </div> <div id="Events" > </div> <script language="javascript" src="js/calendar.js"></script> </body> </html> //calendar.js var bustcachevar=1; //bust potential caching of external pages after initial request? (1=yes, 0=no) var bustcacheparameter=""; function createRequestObject(){ try { xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) { alert('Sorry, but your browser doesn\'t support XMLHttpRequest.'); }; return xmlhttp; }; function ajaxpage(url, containerid){ var page_request = createRequestObject(); if (bustcachevar) bustcacheparameter=(url.indexOf("?")!=-1)? "&"+new Date().getTime() : "?"+new Date().getTime() page_request.open('GET', url+bustcacheparameter, true) page_request.send(null) page_request.onreadystatechange=function(){ loadpage(page_request, containerid) } } function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)) { document.getElementById(containerid).innerHTML=page_request.responseText; }; } function LoadMonth(month, year) { ajaxpage("calendar.php?month="+month+"&year="+year, "Calendar") } function LoadEvents(date) { ajaxpage("events.php?date="+date, "Events") } LoadMonth();calendar.css
  21. I want when onmouseover on particular section to put an OPACITY #fff 0.2 layer on everything except the selected class i.e. table Similarly as you have: .tableHighlight:hover{background-color:#eee} <table id='table-main' class='tableHighlight'> ... but inversed (puts layer on everything else, but not the table itself) --- http://jsfiddle.net/LYcm9/1/
  22. Here is my java script $.each(data, function() { var myTable1 = '<tr bgcolor=#ffffff>' + '<td align=center>'+this.vehiclelog_plate+'</td>' + '<td align=center>'+this.vehiclelog_name+'</td>' + '<td align=center>'+this.vehiclelog_date+'</td>' + '<td align=center>'+this.vehiclelog_reftype+'</td>' + '<td align=center>'+this.vehiclelog_refid+'</td>' + '<td align=center>'+this.vehiclelog_description+'</td>' + '</tr>'; $('#tableField').append(myTable1); }); And here is my HTML <div id="tabs-6"> <div id="rform"> <form action = "home.php" method="post"> <fieldset> <legend>View Vehicle Service</legend><br><br> <div> <label class="label-left">Vehicle Name:</label> <span role="status" aria-live="polite" class="ui-helper-hidden-accessible"></span> <input id="autocomplete" title="type "a"" class="ui-autocomplete-input" name="vehicle_service_search" autocomplete="off"> </div> <div> <button id="searchVehicleDesc" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"> <span class="ui-button-text">View</span> </button> </div> <div> <table border="1" width="650" id = "tableField"> <tr bgcolor=#c0c0c0> <td width=100 align="center"><font face="helvetica"><b>Vehicle Name</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Service Type</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Others</b></font></td> <td width=100 align="center"><font face="helvetica"><b>Reference No.</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Reference Date</b></font></td> <td width=80 align="center"><font face="helvetica"><b>Reference Type</b></font></td> </tr> </table> </div> </fieldset> </form> </div> </div> And here is my response [{"success":1,"plate":"SIX666","name":"YAMAHA ISUZU","date":"0000-00-00","type":"Add Vehicle","id":"0","desc":""},{"success":1,"plate":"VIE597","name":"Resource id #6","date":"2014-05-09","type":"OIL","id":"332142","desc":"castroil"}] Im getting the right response from ajax but I can't put my value to a table I get an alert that says undefined.
  23. Hello Guys... I have one problem in javascript guys help me i'am begginer in javascript and jquery if user has enter value in textbox then he can't move on another screen before save the value of textbox if user click on Add or Edit Button the alert box print message 'Save the Value' it's ok . but when i click on Save button, i don't want alert box to save the textbox value <script type="text/javascript"> $(document.body).click(function(){ return check(); }); </script> <script type="text/javascript"> function check() { var txt = document.getElementById('txtbox').value; if(txt !== '') { alert('Save the Value'); } } </script> <input type="text" name="txtbox" id="txtbox"><br/> <input type="submit" name="btn1" id="btn1" value="Save"><br/> <input type="submit" name="btn2" id="btn2" value="Add"><br/> <input type="submit" name="btn3" id="btn3" value="Edit"><br/>
  24. Hello, I’d have a question to ask. First, let me explain what I want to achieve. In a table I display several links whose value (user id) is extracted from a database. By clicking on the link appears a modal pop up in which I would like to pass the selected value in a query using MySQL. Here is the table <table> <tr> <td>Username</td> <td>Id</td> </tr> <?php include ‘db_connection.php’; $sql = "SELECT * FROM users"; $result = mysql_query($sql); while($row = mysql_fetch_array($result)){ ?> <tr> <td><?php echo $row[userID]?></td> <td> <div id='basic-modal'> <a href="?id=<?php echo $row[userID]?>" class='basic'>Show</a> </div> </td> </tr> <?php } ?> </table> This is the link <div id='basic-modal'> <a href="?id=<?php echo $row[userID]?>" data-mydata="<?php echo $row[userID]?>" class='basic'>Show</a> </div> and this is the script which retrieves data. <script> jQuery(function ($) { $('#basic-modal .basic').click(function (e) { $('#basic-modal-content') .text($(this).data('mydata')) .modal(); return false; }); }); </script> Now I would like to pass the value in a SELECT through a variable named $userId as shown below in order to show the user data. <div id="basic-modal-content> $sql = "SELECT * FROM user WHERE id = $userId"; $res = mysql_query($sql); $row = mysql_fetch_array($res); ?> </div> Since I have little familiarity with the jQuery plugin I would like to ask you how to pass the selected id in the variable named $userId within the SELECT. Thanks
  25. Here is my button $( "#editVehicle" ).button().click(function( event ) { event.preventDefault(); var vp = $("input[name=vehicle_plate]").val(), dataString = 'vehicle_plate='+ vp; $.ajax({ type: "POST", url: "editvehicle.php", data: dataString, dataType: "json", success: function(data){ if(!data.error && data.success) { $("input[name=vehicle_model]").val(data.vehicleName); $("input[name=assigned_driver]").val(data.assignedDriver); } else { alert(data.errorMsg); } } }); }); And here is my PHP <?PHP include("db.classes.php"); $g = new DB(); $g->connection(); if($_POST) { $vehiclePlate = $g->clean($_POST["vehicle_plate"],1); $g->edit($vehiclePlate); } $g->close(); ?> and here is my db.classes public function edit($vehiclePlate) { $sql = "select vehicle_name, driver_id from vehicles where vehicle_plate='$vehiclePlate'"; $result = mysql_query($sql) or die(json_encode(array("error" => 0, "errorMsg" => "MySQL query failed."))); $row = mysql_fetch_array($result); if(mysql_num_rows($row)) { echo json_encode(array( "success" => 1, "vehicleName" => $row['vehicle_name'], "assignedDriver" => $row['driver_id'] )); } else { echo json_encode(array( "error" => 1, "errorMsg" => "No rows returned" )); } } There is an input field in my html where i input the vehicle plate then when the user clicks the button the program searches the database for the vehicle name and driver_id with the plate the user entered and returns the value to another inputfield named "vehicle_name" and "assigned_driver" but nothing is happening when the button is clicked not even the error alert message. Any idea on where am i going wrong here?
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.