Jump to content

Search the Community

Showing results for tags 'javascript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • 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

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hi all- this is my first post here, I've been working with javascript for only a few months and can usually find the answers by googling, but I am kind of stumped on this one. I have a form where I can select toppings for a pizza and when you change the dropdown selector to choose a topping, a javascript function posts to a standalone php file to automatically update the database. It works great in chrome, but I can't seem to get it to work in IE. If I run the standalone script directly in a browser window, it works, even in IE. So I am assuming that my javascript code that posts to the file is not able to post to the file in IE for some reason. Here is the js function trying to post to the form: function updateCart() { var filename = "<?php echo $server;?>update_cart.php"; $.post(filename, $("#cartform").serialize()); alert("file name: " +filename); } The alert pops up and correctly displays the path to the file in both chrome and IE. Does anyone see any obvious reasons why this wouldn't work in IE? thanks for your help, Andy
  2. Hi! I'm making a time laps calculator based off of the equation found http://americandslr.com/2010/10/time-lapse-calculator/ there. I'm completely done with the functional part of it. Now I need to worry about the aesthetic part of it. Here is the code: <?php if (isset($_POST['filming'])) $hour = $_POST['filming']; if (isset($_POST['framerate'])) $framerate = $_POST['framerate']; if (isset($_POST['dtrt'])) $dtrt = $_POST['dtrt']; $half = $hour * 3600; $halftwo = $framerate * $dtrt; $answer = $half / $halftwo; ?> <!DOCTYPE html> <html lang='en'> <head> <title>Timelapse Calculator</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <!-- Bootstrap --> <link href="css/bootstrap.min.css" rel="stylesheet" media="screen"> </head> <body> <div class="well span 5"> <form class="form-horizontal" method="POST"> <fieldset> <!-- Form Name --> <legend><h1><center>Timelapse Calculator</h1></center><br></legend> <!-- Text input--> <div class="control-group"> <label class="control-label" for="filming"><strong>Film Time (in hours)</strong></label> <div class="controls"> <input id="filming" name="filming" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">1 hour would be "1", 1 and a half hours would be "1.5" etc. </p> </div> </div> <!-- Text input--> <div class="control-group"> <label class="control-label" for="framerate"><strong>Frame Rate</strong></label> <div class="controls"> <input id="framerate" name="framerate" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">How fast will it be presented?</p> </div> </div> <!-- Text input--> <div class="control-group"> <label class="control-label" for="dtrt"><strong>Duration</strong></label> <div class="controls"> <input id="dtrt" name="dtrt" type="text" placeholder="type here..." class="input-medium" required=""> <p class="help-block">How long do you want the time lapse to last? <u>IN SECONDS</u></p> </div> </div> <!-- Button --> <div class="control-group"> <label class="control-label" for="submit"></label> <div class="controls"> <input type="submit" class="btn btn-primary btn-large" value="Submit"/> </div> </div> </fieldset> </form> <h2><center><strong><?php echo $answer . " seconds between picture" ?></center></strong></h2> </div> <script src="http://code.jquery.com/jquery.js"></script> <script src="js/bootstrap.min.js"></script> </body> </html> (yes i'm using bootstrap) Here is a screenshot of what it looks like before and after you submit: Before submission: http://gyazo.com/361d109f0af010fcda4d90288b338566 After submission: http://gyazo.com/cf1c2c2089af3f6b4bf349aeab7fc1d4 1. how do I make it round to the nearest tenth? When I used "round($answer, 1);" it crashed my script. 2. How can I make the "seconds between picture" only appear after you press submit? Thanks, I'm a noob. Fisher
  3. Good Day, I have created a web page with more than 10 text boxes, i know how to use all validations from vs . now i want to apply validations using Javascript. here are my problems below. 1.For Email; I want a textbox to change border color to red if it is invalid email, belows it is what i have so far.. <script type="text/javascript"> ar emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i function checkmail(e){ var returnval=emailfilter.test(e.value) if (returnval==false){ alert("Please enter a valid email address.") e.select() } return returnval } </script> on the text box; <asp:TextBox ID="txtEmail" name="email" onClick="return checkmail(this.myemail)" runat="server" </asp:TextBox> 2.For Numbers This texbox will only allows numbers only ,I want a textbox to change border color to red if it is invalid input, belows it is what i have so far.. <script type="text/javascript"> function numeralsOnly(evt) { evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); if (charCode > 31 && (charCode < 48 || charCode > 57)) { alert("Enter numbers only in this field."); return false; } return true; } </script> on the text box; <asp:TextBox ID="txtFullName" onkeypress="return numeralsOnly(event)" runat="server"</asp:TextBox> 2.For Letters This texbox will only allows Letters only,I want a textbox to change border color to red if it is invalid input, belows it is what i have so far.. <script type="text/javascript"> function lettersOnly(evt) { evt = (evt) ? evt : event; var charCode = (evt.charCode) ? evt.charCode : ((evt.keyCode) ? evt.keyCode : ((evt.which) ? evt.which : 0)); if (charCode > 31 && (charCode < 65 || charCode > 90) && (charCode < 97 || charCode > 122)) { alert("Enter letters only."); return false; } return true; } </script> on the text box; <asp:TextBox ID="txtFullName" onkeypress="return lettersOnly(event)" runat="server"</asp:TextBox> Thanks for your help....
  4. hi i would like to have my css test box attached to the side of the box like it is on the second picture ... any way to do it ? #socialbox { background-color: #FFF; padding: 7px; height:200px; width:35px; border: 1px solid #DBDBDB; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px; -webkit-box-shadow: #E4E4E4 0px 0px 5px; -moz-box-shadow: #E4E4E4 0px 0px 5px; box-shadow:#E4E4E4 0px 0px 5px; margin-bottom: 5px; /* max-width:50px; max-height:100px; */ float:right; margin-right:180px; }
  5. Hi Guys, I have a simple mysql_num_rows() expects parameter 1 to be resource, boolean given error in my script, I have tried to debug it myself but I don't understand why the script doesn't think the variable "$query" isn't an integer. I am trying to create a login form for users who are already registered and I want them to be able to see instant feedback as to whether their info has been accepted or not. The users won't be redirected though. testlogin.php <?php $name = $_GET['name']; $password = $_GET['password']; if (!$name && $password) { echo "Error"; exit; } mysql_connect("localhost" , "root" , "") or die("Issue with connection!"); mysql_select_db("testlogin"); $query = mysql_query("SELECT * FROM users WHERE Name='".$name."'"); $name = $_GET['name']; $password = $_GET['password']; if(!$name && $password) { echo 'No name or password'; exit(); } mysql_connect("localhost","root", ""); mysql_select_db("testlogin"); $query = mysql_query("SELECT * FROM users WHERE Name ='".$name."'"); $numrows = mysql_num_rows($query); if($numrows !=0) { while($row = mysql_fetch_assoc($query)) { $dbname = $row['Username']; $dbpassword = $row['password']; } if($name == $dbname && $password == $dbpassword) { echo "you are in!"; }else { echo "Please enter a valid username and password"; } }else { echo "Your name is not registered!"; } ?>
  6. Hi all, This problem is killing me. I hope / pray someone can help. Essentially I need to pass a JS variable to a PHP variable without refresh/form submission or redirecting. I'm new to Ajax so please be patient The owner of this site generally lives in 3 countries lucky ******. When he logs in he wants the contact page updated with his current number. I have a form with hidden fields that return the address location using an ajax call to ipinfo.io - this works fine. <script> $(function() { var admin = <?php echo json_encode($admin->isAdmin($user['username'])); ?>; var phone=""; if(admin == true){ $.ajax({ url:"http://ipinfo.io", dataType:'jsonp' }) .success(function(response){ $("#address").val(response.country); $("input[id=address]").val(response.country); var testLoc = $('#address').val(); if(testLoc == "GB"){ phone = "<?php echo $gb?>"; $("#phone").append(phone); }else if(testLoc == "GABON"){ phone = "<?php echo $gabon?>"; $("#phone").append(phone); }else if(testLoc == "THAILAND"){ phone = "<?php echo $thai?>"; $("#phone").append(phone); } }); var time = new Date(); $("#localTime").append(time); }else{ //alert("Not Admin"); $("#phone").append(phone); } }); </script> The above essentuially checks to see that he is THE admin, if it is it then sets the hidden field value to be the country, that is then placed in the testLoc variable and depending on what it is, it spits out the number. This all works well unless of course you visit the site and you're not the admin. All you see is an empty string. I need to get that phone variable or location variable, either of them really from the js into a php variable. That way when a normal joey visits the page I can just echo out that variable instead. phone or location var in js script to php variable?
  7. <link type="text/css" href="assets/css/main.css" rel="stylesheet" /> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="assets/js/google_maps/jquery-1.9.1.js"></script> <script type="text/javascript" src="assets/js/google_maps/jquery-ui-1.10.3.custom.min.js"></script> <script type="text/javascript" src="assets/js/google_maps/main.js"></script> <script> function updatelocation(){ var lat = document.getElementById('latitude').value; var long = document.getElementById('longitude').value; newlocation = lat+ "," +long; alert(newlocation); } </script> <div class="row"> <div class="large-12 small-6 columns"> <label>Address: </label><input id="address" type="text"/> <div id="map_canvas" style="width:100%; height:300px"></div> <br/> <label>latitude: </label><input id="latitude" type="text"/><br/> <label>longitude: </label><input id="longitude" type="text"/> <input name="setlocation" type="button" onClick="javascript:updatelocation()" value="Set As Your Location"> </div> </div> Here is my code can some one help me? The display should be right next to the address textbox.
  8. Hello, I'm trying to retrieve dates from the database based on a selection. If a user selects singer A for example, then I'm going through the database and get the unavailable dates of singer A. var unavailableDates; function unavailable(date) { dmy = date.getDate() + "-" + (date.getMonth() + 1) + "-" + date.getFullYear(); if ($.inArray(dmy, unavailableDates) == -1) { return [true, ""]; } else { return [false, "", "Unavailable"]; } } $(document).ready(function() { $("#datepicker").datepicker({ dateFormat: 'yy-mm-dd', beforeShowDay: unavailable, minDate: 0, firstDay: 1, // rows starts on Monday changeMonth: true, changeYear: true, showOtherMonths: true, selectOtherMonths: true, altField: '#date_due', altFormat: 'yy-mm-dd' }); $('#datepicker').focus(function(){ //alert($('#name').html()); $.ajax({ url: 'getDates.php', data: "artist_id="+$('#name').html(), dataType: 'json', success: function(data) { alert(data) } }); }) }); Everything works fine. Using the "getDates.php" I retrieved the dates and pass them through the function. But how can I pass the data (after success: function) to the unavailable dates above? I have the dates from database but I don't know how to link them with the array "unavailableDates" (line 1) in order to show unavailable dates in datePicker.
  9. Hello all, Im working on a back-end system that sends push notifications. At the moment on click of send button the loading gif appears underneath. I would like the send button to disappear and for the loading gif to appear as it is now. How can I implement this feature ? Any help would be much appreciated <div class="row-fluid"> <input type="submit" name="badgeSubmit" class="span5 offset7 blue-button" value="Send" onClick='return checkvalue() && toggle(); return false;' /> <img style="position:relative; top:20px;"src="/images/sending.gif" alt="loading" class="sending"> </div>
  10. Hello, I am trying to create an array where by the items listed are nested with the names and the array spat out is easy to use when I am creating an ajax function with data from it all. Below is an idea of what I need to do: # This is where I am grabbing the data from the instagram class $data_url[] = $data->images->standard_resolution->url; $data_link[] = $data->link; $data_id[] = $data->getId(); $data_likes[] = $data->likes->count; {["images":[ ["data_url":[ ["http:\/\/distilleryimage4.s3.amazonaws.com\/f8e5e2fafe8811e2a42922000a9e51c4_7.jpg"] ], ["data_link":[ ["http:\/\/instagram.com\/p\/cq2pjLMNNE\/"] ], ["data_id": [516465457066201924_288233123] ], ["data_likes": [18] ] ] ] } In my current ajax.php page, I am creating a place where data can be captured and I can use it to get the images and place them into a page. Here is what I have got so far: $instagram = new Instagram\Instagram; $instagram->setAccessToken($_SESSION['instagram_access_token']); $token = $_SESSION['instagram_access_token']; //$clientID = $_SESSION['client_id']; $current_user = $instagram->getCurrentUser(); $tag = $instagram->getTag('folkclothing'); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); /* $params = isset( $_GET['max_tag_id'] ) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null; */ /* $media = $tag->getMedia($params); */ /* $next_page = $media->getNext(); */ /* // Receive new data $imageMedia = $instagram->pagination($media); */ // Collect everything for json output $images = array(); $data_link = array(); $data_id = array(); $data_likes = array(); foreach ($media as $data) { $images[] = array($data_url[] = $data->images->standard_resolution->url,$data_link[] = $data->link, $data_id[] = $data->getId(), $data_likes[] = $data->likes->count); } echo json_encode(array( 'next_id' => $media->getNextMaxTagId(), 'images' => $images )); Below is what my /ajax/ url gives me: {"next_id":"1374887530845","images":[["http:\/\/distilleryimage4.s3.amazonaws.com\/f8e5e2fafe8811e2a42922000a9e51c4_7.jpg","http:\/\/instagram.com\/p\/cq2pjLMNNE\/","516465457066201924_288233123",18],["http:\/\/distilleryimage10.s3.amazonaws.com\/46f790e0fdaf11e29de622000ae90e7b_7.jpg","http:\/\/instagram.com\/p\/coEUD0MyGO\/","515681128006492558_197168271",23],["http:\/\/distilleryimage6.s3.amazonaws.com\/7e510fa6fcee11e29a4b22000a1fb593_7.jpg","http:\/\/instagram.com\/p\/clmYo1AgU6\/","514986551277651258_20025128",25],["http:\/\/distilleryimage0.s3.amazonaws.com\/4f41be96fc3411e2829822000a9f1487_7.jpg","http:\/\/instagram.com\/p\/cjN3PipYkE\/","514315753313634564_190097401",10],["http:\/\/distilleryimage0.s3.amazonaws.com\/bcc8d83cfb9911e2921e22000aa81fd0_7.jpg","http:\/\/instagram.com\/p\/chPPNdGDhI\/","513758848433535048_6206549",13],["http:\/\/distilleryimage2.s3.amazonaws.com\/ef97af2efb5611e2b16122000a1f9e61_7.jpg","http:\/\/instagram.com\/p\/cgYg4ljpby\/","513518170419402482_52465932",1],["http:\/\/distilleryimage5.s3.amazonaws.com\/8e7bbf04fa9e11e2aea022000a9d0ee7_7.jpg","http:\/\/instagram.com\/p\/ceBeGXNpA9\/","512853874029531197_20203491",2],["http:\/\/distilleryimage4.s3.amazonaws.com\/96dc4444f9f811e2b88d22000a1fd1dd_7.jpg","http:\/\/instagram.com\/p\/cb5gooAgW4\/","512255913931965880_20025128",6],["http:\/\/distilleryimage11.s3.amazonaws.com\/6b80e884f9dc11e29b2522000a9f13d5_7.jpg","http:\/\/instagram.com\/p\/cbibv3JW9H\/","512154423034998599_430907394",20],["http:\/\/distilleryimage7.s3.amazonaws.com\/64f82bd6f95411e2a73522000a1faf50_7.jpg","http:\/\/instagram.com\/p\/cZzAF8syFb\/","511664339442409819_197168271",16],["http:\/\/distilleryimage10.s3.amazonaws.com\/b54645f4f93711e283e622000a1fb86d_7.jpg","http:\/\/instagram.com\/p\/cZbgGrlSzW\/","511560986135964886_187431354",17],["http:\/\/distilleryimage8.s3.amazonaws.com\/a9fc18a2f87111e29c8b22000a9f18f4_7.jpg","http:\/\/instagram.com\/p\/cW5Q5CBrlw\/","510847457153169776_378485429",6],["http:\/\/distilleryimage0.s3.amazonaws.com\/55b6269cf86311e2b5f422000a1f9a34_7.jpg","http:\/\/instagram.com\/p\/cWthoKit5E\/","510795830715407940_203990694",16],["http:\/\/distilleryimage9.s3.amazonaws.com\/bff691e2f82a11e2939b22000a1f9251_7.jpg","http:\/\/instagram.com\/p\/cV_K8mBu9R\/","510591961963884369_256035442",12],["http:\/\/distilleryimage4.s3.amazonaws.com\/5ef4c3c0f73811e2890322000a9e48f1_7.jpg","http:\/\/instagram.com\/p\/cS4nTwwE_U\/","509718699729506260_37194114",34],["http:\/\/distilleryimage8.s3.amazonaws.com\/a1b5f0acf6cb11e2957722000a1f9a39_7.jpg","http:\/\/instagram.com\/p\/cRfiPgmAWQ\/","509326925426591120_453101536",11],["http:\/\/distilleryimage6.s3.amazonaws.com\/4bf62240f68511e29aee22000a9f38e6_7.jpg","http:\/\/instagram.com\/p\/cQl6qiBzdu\/","509073517011482478_5670460",223],["http:\/\/distilleryimage1.s3.amazonaws.com\/d23848d6f61e11e2807c22000a9e06c7_7.jpg","http:\/\/instagram.com\/p\/cPR9_otpGt\/","508704309923713453_20203491",6]]} Can anyone guide me into the best way I can do this so it gives me an array from my ajax.php so I can grab the data and place it into my page better? I have tried numerous techniques but they have not worked at all. Thanks, Mark
  11. I am building a relatively small app in laravel. Currently I am trying to create a load more button to load more images into a container in the view. Would anyone know when clicking load more I get an internal server error? Here is my set up: View for my images: $instagram = new Instagram\Instagram; $instagram->setAccessToken($_SESSION['instagram_access_token']); $token = $_SESSION['instagram_access_token']; //$clientID = $_SESSION['client_id']; $current_user = $instagram->getCurrentUser(); $tag = $instagram->getTag('folkclothing'); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); $liked_media = $current_user->getLikedMedia(); echo '<section id="images">'; foreach ( $media as $item ) { echo '<article class="instagram-image">'; // define the form and set the action to POST to send the data to this script echo '<form class="forms" action="'; echo URL::current(); echo '" method="post">'; $id = $item->getId(); echo '<a class="fancybox" href="' . $item->link . '"><img src="' . $item->images->standard_resolution->url . '" /></a>'; if ( $current_user->likes($item) ){ echo '<button class="ajax instabtn unlike icon-heart" type="submit" name="action" value="Unlike"></button>'; } else { echo '<button class="ajax instabtn like icon-heart" type="submit" name="action" value="Like"></button>'; } echo '<input type="hidden" name="id" value="'; echo $id; echo '">'; echo '<p>'; echo $item->likes->count; echo '</p>'; //echo '<p>'.$item->getId().'</p>'; //echo '<p>By: <em>' . $item->user->username . '</em> </p>'; //echo '<p>Date: ' . date('d M Y h:i:s', $item->created_time) . '</p>'; //echo '<p>$item->comments->count . ' comment(s). ' . $item->likes->count . ' likes. '; echo '</form>'; echo '</article>'; } echo '</section>'; Here the instagram class generates the images and puts them into the div through a loop. Below is a load more button storing the data need in it. Load more button: echo "<br><button id=\"more\" data-maxid=\"{$media->getNextMaxTagId()}\" data-tag=\"{$tag}\">Load more ...</button>"; And then there is an ajax view that stores the relevant data for the images to be found for the next page: <?php // set up autoloader function app_autoloader($class) { include './' . $class . '.php'; } spl_autoload_register('app_autoloader'); // Initialize class for public requests $instagram = new Instagram\Instagram; // Receive AJAX request and create call object $tag = $_GET['tag']; $clientID = $instagram->getApiKey(); $media = $tag->getMedia(isset($_GET['max_tag_id']) ? array( 'max_tag_id' => $_GET['max_tag_id'] ) : null); $call = new stdClass; $call->next_max_id = $maxID; $call->next_url = "https://api.instagram.com/v1/tags/{$tag}/media/recent?client_id={$clientID}&max_tag_id={$media->getNextMaxTagId()}"; // Receive new data $media = $instagram->pagination($call); // Collect everything for json output $images = array(); foreach ($media->data as $data) { $images[] = $data->images->standard_resolution->url; } echo json_encode(array( 'next_id' => $media->getNextMaxTagId, 'images' => $images )); This page finds the tag and gets the media for that tag and finds the next_max_id. In my jquery I use and ajax call to get this data and load the images into my div but instead I get an internal server error like so: Failed to load resource: the server responded with a status of 500 (Internal Server Error) http://client:8888/ajax?tag=client&max_tag_id=1374869525975&_=137571153802 Does anyone have an idea why it would not produce the results? I know its not too far off. Thanks, Mark ajax.blade.php image.blade.php
  12. Hello, I'm here with a question that maybe silly for most of you but I just can't handle it. As I know, there's no way in built in PHP inside JS because diferent kind of languages ( Server Side and Client Side ). But I have a problem that I need help to handle. I have a multilanguage system in my site ( PHP ) and form validations ( JS ). I have the error messages showed by JS instantly, but I can only print text, not a PHP variable info. For example: $(function() { // validate signup form on keyup and submit $("#loginform").validate({ rules: { user: "required", password: "required", }, messages: { user: "Please enter your username or email.", password: "Please enter your password", } }); }); And my multilanguage system uses the following system: $lang['login_error'] = 'Incorrect details provided.'; There is any way to make something like this: $(function() { // validate signup form on keyup and submit $("#loginform").validate({ rules: { user: "required", password: "required", }, messages: { user: <?php echo $lang[login_error']; ?>, password: "Please enter your password", } }); }); I know this doesn't work, but it's to make an easy example in what I need, because depending the language the user as choosen, the error should be there in that language, not only in one language. Could you please help me to handle this ? Thanks in advance.
  13. Developing CART for Online Shopping I am trying to add buttons on html page and the code is working............I have some products in <SELECT> tag i.e. Product 1,Product 2,Product 3,Product 4,Product 5......... I create an array "list_array" and storing all the values in array dynamically... I click on <BUTTON>ADD </BUTTON> and it reads the value from <SELECT> tag and add it into array...........To display all the products, I execute the loop and display all the items in array with a <BUTTON>REMOVE</BUTTON> in-front of every product.......... To delete the particular product, I can select it in <SELECT> tag and then click on delete button..........It removes the element from array .........To display the cart, I am using the loop again, and it shows all the products after clicking the <BUTTON>Display</BUTTON> Now the issue that I am facing here is that I am adding <BUTTON>REMOVE</BUTTON> button when I am displaying the products that have been added in CART, the code of java_script is listed below function display() { string = ""; str=""; for(j=0;j<i;j++) { str = list_array[j]+"_"+j; string = list_array[j]+" <button onclick='remove_me(this)' id="+str+">Remove</button><br>"+string; } document.getElementById('write').innerHTML = "Array:<br> " + string; document.getElementById('i_val').innerHTML = "I: " + i; } Now, I am trying every way to make a code that will help me in removing the product by clicking on <BUTTON>REMOVE</BUTTON>, I hope I have explained everything here, so, help me to fix this issue...............
  14. I have this array that has n elements ---> list_array = new Array(); it contains ['Product 1','Product 2','Product 3','Product 4','Product 5','Product 6','Product 7','Product 8'] what I am trying to do is that starting a loop from j=0 to j<n, I am adding button on html page, now when I click on button, it must remove itself from the page. I want to do this with the help of javascript...Is there anyone who can help ??? If I click on "product 8", the page must display other 7 buttons and it must delete the button itself on the page..... function create() { for(j=0;j<i;j++) { "<button onclick='remove_me(this)' id="+list_array[j]+">Remove</button><br>"; } } function remove_me(obj) { _button = obj.id; remove(_button); } I am trying to perform this operation, however, it only receive "Product" in obj.id.............It skips the text after the first whitespace..... I hope that you got my concern, looking for quick reply.......
  15. Hi guys, I have a relatively hard question. The problem is that I must leave the HTML code as it is and not put any divs around the image tags. How can I add a class or a selector to an image tag so that I can style that specific image tag for a specific style sheet. The reason why I'm doing this is because my code is styled in three different style sheets for responsive web design. I need a way to select these image tags using an identifier without affect the html code to go crazy in other layouts. <img src="./ajaxfiles/globebuttons/1xtremevision.png" alt="" name="btn3" id="btn3" onclick="MM_swapImage('car','','./ajaxfiles/carbackgrounds/XtremeVision-E-City.jpg','btn1','','./ajaxfiles/globebuttons/1standardreplacement.png','btn2','','./ajaxfiles/globebuttons/1powervision.png','btn3','','./ajaxfiles/globebuttons/xtremevision.png','btn4','','./ajaxfiles/globebuttons/1bluevisionultra.png','btn5','','./ajaxfiles/globebuttons/1crystalvision.png','btn6','','./ajaxfiles/globebuttons/1diamondvision.png',1)" /> Any help would be much appreciated, please post a way to style these image tags ? All the best, Adam
  16. i have resposive webpage layout with masonry. when user resizes the browser below certain viewport width, i destroy masonry. but after user resized back, i can't reinitialize masonry. it just will not arrange the blocks as it should. any ideas how to fix this?
  17. Hi guys, I'm trying to build the following functionality, but find myself seriously lacking in coding aptitude and knowledge. I'm hoping you guys can help me out. Ultimate goal: Clean search bar in middle of screen with no submit button; typing specific text ex. "test" brings an html/javascript widget from a separate file ex. "test1.html" and includes that content below the search bar all without a refresh. My current solution (and note that the code is retrofitted from a different project that someone else wrote), is an if-then solution, whereby if the text in the input == "test" then the page includes the test1.html file. main.html <!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=iso-8859-1" /> <title>Testing</title> <script language="javascript" type="text/javascript"> var XMLHttpRequestObject_test = false; var strSend; if (window.XMLHttpRequest) { XMLHttpRequestObject_test = new XMLHttpRequest(); } else if (window.ActiveXObject) { XMLHttpRequestObject_test = new ActiveXObject("Microsoft.XMLHTTP"); } var i; var finished; function test() { if (XMLHttpRequestObject_test) { strSend = "receive.php?"; i = 0; finished = false; while (finished != true) { if (document.input1.elements[i].type == "text") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } else if (document.input1.elements[i].type == "checkbox") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].checked; } else if (document.input1.elements[i].type == "hidden") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } else if (document.input1.elements[i].type == "password") { strSend = strSend + "&" + document.input1.elements[i].name + "=" + document.input1.elements[i].value; } i = i + 1; if (document.input1.elements[i] != "[object HTMLInputElement]") { finished = true; } else { finished = false; } } XMLHttpRequestObject_test.open("GET", strSend); XMLHttpRequestObject_test.onreadystatechange = function () { if (XMLHttpRequestObject_test.readyState == 4 && XMLHttpRequestObject_test.status == 200) { document.getElementById('test').innerHTML = XMLHttpRequestObject_test.responseText; } } XMLHttpRequestObject_test.send(null); } } </script> </head> <body> <form name="input1"> <input name="txt1" type="text" /> </form><br /> <input name="cmd_submit" type="button" value="Submit" onclick="test()" /><br/> <br/> <div id="test"></div> </body> </html> receive.php <?php if($_REQUEST['txt1'] == "test") { include('test1.html'); } else { echo stripslashes($_REQUEST['txt1']); } ?> Test1.html (the content to be included) <?php echo '<script type="text/javascript" src="http://www.gmodules.com/ig/ifr?url=http://hosting.gmodules.com/ig/gadgets/file/100840413740199312943/stock-quotes.xml&up_stockList=%5EIXIC%2C%5EGSPC%2C%5EN225%2C%5EHSI%2C%5ESTI%2C%5EFTSE%2C%5EGDAXI%2C%5EFCHI&up_chart_bool=1&up_font_size=12&up_symbol_bool=0&up_chart_period=0&up_refresh_secs=30&synd=open&w=290&h=300&title=Stock+Quotes&border=%23ffffff%7C3px%2C1px+solid+%23999999&output=js"></script>'; echo '<p class="p1">ONETEST!</p>'; ?> Result after typing "test" into search bar (no quotes) [SEARCH BAR] ONETEST! Very accurate representation of the search bar, I know. But the google widget that I used to test this doesn't show up, only the text. I have tried many variations on trying to echo the javascript such that php doesn't chuck it, but nothing. // I have alternative code that includes the content via ajax without the use of php and it brings the widget in without a problem, however, I have no idea how to make that "search bar - if string == 'test', then, show include" paradigm without php. Thank you in advance, Alex Long time visitor, first time poster
  18. </html> <script type="text/javascript"> var inc = 10; function move_down() { bar = document.getElementById('tarea'); inc += 10; bar.scrollTop = inc; document.getElementById("write").innerHTML = inc; } function move_up() { bar = document.getElementById('tarea'); inc -= 10; bar.scrollTop = inc; document.getElementById("write").innerHTML = inc; } setInterval( function() { if(inc>=450) {move_up();} if(inc<450) {move_down();} } ,100); </script> <body> This is a code that will help in running data in the same loation, vertically <br> <br> <textarea rows="10" cols="20" id="tarea"> this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text this is a text </textarea> <br><br> <button onclick="movedown()" id="tarea">Click here</button><br> <div id="write"></div> </body> </html> I am trying to make a auto scroll function in java script, however, I am unable to do it, can you help with the code and tell what is wrong with the code ....................
  19. I am trying to code something in Java-script, I am trying to "fade_in" image and "fade_out" image with Set_interval function, I am facing problem, help me @@@@@ <html> <script type="text/javascript"> var inc_bit =1e-2; function inc_change() { var s = document.getElementById('img'); document.getElementById('write').innerHTML = inc_bit; inc_bit = inc_bit + 1e-2; s.style.opacity = inc_bit; if(inc_bit>1e0) { setInterval(function() {dec_change();},100); } } function dec_change() { var s = document.getElementById('img'); document.getElementById('write').innerHTML = inc_bit; inc_bit = inc_bit - 1e-2; s.style.opacity = inc_bit; if(inc_bit<1e-2) { setInterval(function() {inc_change();},100); } } setInterval(function() {inc_change();},90); </script> <body onload="inc_change()"> <img src="pic1.jpg" height="200px" width="250px" id="img" style="opacity:0.0"/> <div id='write'></div> </body> </html>
  20. An invoice will be opened in a new window when the Generate invoice button is clicked. Below is the sample code. For Example <form name="invoice" action="inv_rec.php" method="post" id="inv" target="invoices" onsubmit="return check_counter();" > <table> <tr> <td> <label for="cusname"><strong>Customer Name* </strong></label> <input type="text" size="20" name ="cusname" value="" id="Customername" required/> </td> <td> <label for="for_place"><strong>Place</strong></label> <input type="text" size="20" name ="for_place" value="" id="for_place" /> </td> </tr> ........ <tr> <td> <input type="submit" value="Generate Invoice" name="submit" id="sub"> </td> </tr> </table> </form> <script> var counter = 1; function check_counter() { if(counter == 1) { alert("Please enter the product details"); return false; } window.open('', 'invoices', 'width=650,height=800,status=yes,resizable=yes,scrollbars=yes'); return true; } </script> In my example the page will be redirected to inv_rec.php(opens in new window) which contains dynamically generated data obtained from mysql where the user needs to take the print of it. I want to clear all the form data which is open in the previous window(where the invoice form is displayed,i.e user fills the data to generate a invoice).Any help is appreciated.
  21. I need some help amending a comment tag in a text-area. Of-course this would be easy if I could just simply edit the html. However the script is using an i-frame. I can't find where the i-frame code is. What can I do when looking in the directory for the iframe, where is it? If you need me to show you the file structure that can be done and I can show you the code of where the iframe is.
  22. Hi all, I have a webpage which opens redeem.html. The page has an option which you can see in the URL given underneath. - Caltex starcash card promotion When clicking on the navigation bar "redeem" its opens redeem.html however I'd like it to select the first option "Caltex starcash car promotion" by default on click of redeem in the navigation bar. So at first the url looks like this: http://www.continentalpromotions.com.au/redeem.html and I want this : http://www.continentalpromotions.com.au/redeem.html# Click on the url and have a go at looking at the URL to understand what I want, I can't figure this one out right now on how to get the options to be selected already. Any help would be very much appreciated the code is listed underneath of the <div> containing the link. <div class="span4"><a href="#"><img id="promo1" src="img/Promotions/redeempage/CaltexCardredeem.png" onClick="changeimage()" width="284" height="261" border="0"></a><br> <br> </div>
  23. Hello everyone! I'll get straight to the point. I have built a portfolio gallery for a client that uses a javascript/jquery to arrange my thumbnails on a single page. It includes a "filter" function that allows me to narrow down what is displayed on the page based on certain keywords associated with the content. I have an upload script which allows me to add data through a form to my MySQL database. The image name is saved to the database and the image is uploaded to a particular folder on my server. I then pull that information into my portfolio page and loop through all the "rows" in the database which creates my page full of thumbnails. When a user clicks on any given thumbnail, a lightbox is shown which shows a larger image or embedded video, along with the title and description of the project. Everything works great. I would like to go one step further and add a feature to click to the "next" and "previous" item in the portfolio from within the lightbox without having to close the lightbox and click another thumbnail. Make sense? I am a beginner with php but am learning my way around it. Javascript is still a foreign language so I would like to accomplish this in PHP if possible. Thank you for any help you can offer to get me in the right direction. <?php include('includes/connection.php'); $tbl_name="portfolio_pg"; ?> <nav id="filter"></nav> <section id="main"> <ul id="grid"> <?php $data = mysql_query("SELECT * FROM portfolio_pg") or die(mysql_error()); while($info = mysql_fetch_array( $data )) { ?> <li data-tags="<?php echo $info['Filters']; ?>"> <a href="javascript:void();" onclick="document.getElementById('underlay').style.display='block'; document.getElementById('<?php echo $info['pg_id']; ?>').style.display='block';"><?php echo "<img src=images/portfolio/thumbs/".$info['photo'] ." width=\"164\" height=\"164\">"; ?></a> <div id="underlay"></div> <div class="lightbox" id="<?php echo $info['pg_id']; ?>"> <div id="closer"><a href="javascript:void();" onclick="document.getElementById('underlay').style.display='none'; document.getElementById('<?php echo $info['pg_id']; ?>').style.display='none';">close</a></div> <?php if($info['Project_Link']!="") { echo "<div class=\"vidHolder\"> ".$info['Project_Link']." </div>"; } else { echo "<div class=\"picHolder\"><img src=\"images/portfolio/".$info['photo_2'] ."\" width=\"100%\" height=\"100%\"></div>"; } ?> <div class="projectHead"><?php echo $info['Page_Heading_1']; ?></div> <div class="projectBod"><?php echo $info['Paragraph_1']; ?></div> </div><!-- Close Lightbox Viewer --> </li> <?php // close while loop } ?> </ul> </section> you can see it in action by going following HERE Thanks for any help
  24. I am working on code that can run images from left to right when I click on hyperlink ?? The code is listed below, please help me out ... <script type="text/javascript"> var left3; function next1() { var str = document.getElementById('pic01'); var left2 = parseInt(str.offsetLeft); left3 = left2; } function next2() { left3 =left3 + 50; var st = left3+'px'; document.getElementById('pic01').offsetLeft=st; } </script> <body onLoad="next1()"> <img src="pic1.jpg" height="100px" width="120px" style="margin-left:125px;" id="pic01"/> <br><br> <a href="#" style="margin-left:100px" onClick="next2()">Next</a> <body>
  25. Hello, I have piece of code I have written that, when the form is submitted it sends the string from the textbox through ajax, through a database and returns a name corresponding to that string. It works fine in chrome but not in firefox and I was wondering if you could help. If I set the function to a simple alert(code) it will fire it and work fine however when I revert it to the ajax script it simply reloads the page with the "?code=string" and ignores anything and everything in the js function. This is the ajax code: function signin(code) { // event.preventDefault(); var xmlhttp; var photo; if (code=="") { document.getElementById("resultcontents").innerHTML="lol"; return; } 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) { var str = xmlhttp.responseText; var split = str.split(", "); document.getElementById("resultcontents").innerHTML=split['0']; document.getElementById("counter").innerHTML=split['1']; if(!(split['2'] == undefined)){ document.getElementById("webcamcanvas").innerHTML="<img src='" +split['2']+"' width='400' height='300'>"; } document.getElementById("codetextbox").value=""; document.getElementById("codetextbox").focus(); } } xmlhttp.open("GET","files/******.php?code="+code,true); xmlhttp.send(); } This is the HTML form: form onsubmit="signin(codeform.codetextbox.value)" name="codeform"> <input type="textbox" name="codetextbox" id="codetextbox" /> </form> The reason it has no submit button is because firstly, it clutters up the page and secondly I'm using a barcode scanner which automatically inserts a carriage return, submitting the form. Any help would be greatly appreciated! Also, I'm sorry if this is in the wrong section, it's to do with both JS and Ajax and I didn't know which to choose. Jacbey.
×
×
  • 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.