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. I am using javascript:void(window.open('http://server1/test/test_update.php?matter="&Fields!matter.Value + "', '_blank', 'fullscreen=yes, scrollbars=auto'));" to launch a report from a SSRS 2008 report that is being viewed within an iFrame. This is done in the Jump to URL. <iframe name='myIframe' id='myIframe' src='http://sqlreports/ReportServer?Report&rs:Command=Render&rc:LinkTarget=_blank&rc:Stylesheet=my_htmlviewer' scrolling='auto' frameborder='0' width='100%' onload='resize_iframe()' ></iframe> the resize_iframe() function just makes the iFrame full screen to whatever the window is made. Before adding the @rc:LinkTarget=_blank to the iFrame, the links did not work. Now, when I click on the link to launch the PHP page I get two windows that open. One opens and renders the page properly: http://server1/test/test_update.php?matter=123456 while the other window opens with the "Internet Explorer cannot display the webpage" error with the following URL: javascript:void(window.open('http://server1/test/test_update.php?matter=123456,%20_blank,%20fullscreen=yes,%20scrollbars=auto')); I'm not quite sure what is causing these two windows to open up. When I remove the @rc:LinkTarget=_blank from the iFrame, the links go back to not working. I've also tried to remove the _blank for the Jump to URL. Any ideas/assistance would be greatly appreciated. Thanks, Jamey8420
  2. How to filter and show data in search without using submit button..because thats the only function i need to finish my code..can anyone help me? I dont want to use submit button cause it refreshes the page...I have the code for search already I need a function that after I search the data will show in the textboxes without using submit button. php code: <?php if($_GET){ include('include/connect.php'); $batchcode = $_GET['code']; $sql = mysql_query("SELECT aic,batchcode,address,name FROM tb_app WHERE batchcode = '".$batchcode."' "); if($sql) { while($rows = mysql_fetch_array($sql)){ $aic[] = $rows['aic']; $name[] = $rows['name']; $address[] = $rows['address']; } } }else{ $aic = array(NULL,NULL,NULL,NULL); $name = array(NULL,NULL,NULL,NULL); $address = array(NULL,NULL,NULL,NULL); } ?> html code: <html> <head> <title>test</title> </head> <body> <form action="" method="get"> Search Batchcode:<input type="text" name="code" id="query" /><br /> <table> <tr> <td> aic: <br /> <input type="text" name="optA1" value="<?php if(empty($aic[0])){$aic[0] = array(NULL);}else{echo $aic[0];} ?>" /> <br /> <input type="text" name="optA2" value="<?php if(empty($aic[1])){$aic[1] = array(NULL);}else{echo $aic[1];} ?>" /> <br /> <input type="text" name="optA3" value="<?php if(empty($aic[2])){$aic[2] = array(NULL);}else{echo $aic[2];} ?>" /> <br /> <input type="text" name="optA4" value="<?php if(empty($aic[3])){$aic[3] = array(NULL);}else{echo $aic[3];} ?>" /> <br /> </td> <td> Name List: <br /> <input type="text" name="optB1" value="<?php if(empty($name[0])){$name[0] = array(NULL);}else{echo $name[0];} ?>" /> <br /> <input type="text" name="optB2" value="<?php if(empty($name[1])){$name[1] = array(NULL);}else{echo $name[1];} ?>" /> <br /> <input type="text" name="optB3" value="<?php if(empty($name[2])){$name[2] = array(NULL);}else{echo $name[2];} ?>" /> <br /> <input type="text" name="optB4" value="<?php if(empty($name[3])){$name[3] = array(NULL);}else{echo $name[3];} ?>" /> <br /> </td> <td> Address: <br /> <input type="text" name="optC1" value="<?php if(empty($address[0])){$address[0] = array(NULL);}else{echo $address[0];} ?>" /> <br /> <input type="text" name="optC2" value="<?php if(empty($address[1])){$address[1] = array(NULL);}else{echo $address[1];} ?>" /> <br /> <input type="text" name="optC3" value="<?php if(empty($address[2])){$address[2] = array(NULL);}else{echo $address[2];} ?>" /> <br /> <input type="text" name="optC4" value="<?php if(empty($address[3])){$address[3] = array(NULL);}else{echo $address[3];} ?>" /> <br /> </td> </form> </body> </html> script code: <!--search function code--> <script type="text/javascript"> $(document).ready(function(){ $("#query").autocomplete({ source : 'search.php', select : function(event,ui){ $("#query").html(ui.item.value); } }); }); </script> search.php page code: <?php $q = $_GET['term']; mysql_connect("localhost","root",""); mysql_select_db("test"); $query = mysql_query("SELECT DISTINCT batchcode FROM tb_app WHERE batchcode LIKE '$q%'"); $data = array(); while($row = mysql_fetch_array($query)){ $data[]=array('value'=>$row['batchcode']); } echo json_encode($data); ?>
  3. So I have a webpage where I pull several rows from the database and create a list on the webpage. Any one of these rows can get updated independently at any time. For the past several years I've used something like this: function execRefresh() { $("#refreshIcon").fadeIn("fast"); $("#'. $p .'").load("/data.php?inid='. $p .'&rand=" + Math.random(), "", function () { $("#refreshIcon").fadeOut("slow"); } ); setTimeout(execRefresh, 20000) } $(document).ready(function () { execRefresh(); }); This will reload the entire content from the database to repopulate the list on the webpage. I'm wondering if there is a better way to do this. The downfalls I'd like to overcome if possible would be (and I realize these two overlap a bit): 1. I am loading the entire table for everyone on the webpage even if there are no changes (unnecessary loads/database pings). - Is there a way to only pull new data if there is a change? - Is there a way to only pull the rows that got changed? - Is there a way to make it so that I don't have to make a call to the database for every single user? 2. I have to create an interval to determine how often I reload the data. Currently I have 20 seconds, this means if an update occurs right after the user loaded data, it could be up to 20 seconds before they see that change (not loading when necessary). - Is there a way to tell the client there has been a change and it needs to update so that it doesn't have extended periods of time where the data isn't updated without just making the interval shorter (and thus having more unnecessary loads)? I know that, for example, Google chat is nearly instantaneous in telling you "Someone is typing" and then showing what they sent as a chat. I imagine that they don't have millions of users constantly pinging a database that contains the chats and whether or not a user is currently typing every second. What would the best way to do this be? I assume it's relatively common and there are possibly some best practices for things such as this. Thanks
  4. This is a general question, thus no script. I'm looking for hints as to what could cause the following: Is there any reason that javascript or jQuery include scripts could prevent radio button values from being sent to the server while all other values from selects and texts are correctly sent? When not using the javascript or jQuery includes the radio values are sent.
  5. Hi there, I am having a small problem getting php to work with google maps APIs. Basically, I have an API url where I pull down lat/long coordinates from for 10 houses and then I want these to map out on the google maps. So, I am not sure how to link the 2 together.. Here is what I have so far: <?php // Loading Domus API $url_search = 'http://url/site/go/api/search'; $xml_search = @simplexml_load_file($url_search) or die ("no file loaded") ; //Displaying latitude and longutude $xml_search = json_decode($xml_search); foreach($xml_search->property as $house) { echo $lat = $house->address->latitude , $long = $house->address->longitude; }; ?> and JavaScript bit: var locations = [ ]; var map = new google.maps.Map(document.getElementById('map'), { zoom: 10, center: new google.maps.LatLng(-33.92, 151.25), mapTypeId: google.maps.MapTypeId.ROADMAP }); var infowindow = new google.maps.InfoWindow(); var marker, i; for (i = 0; i < locations.length; i++) { marker = new google.maps.Marker({ position: new google.maps.LatLng(locations[i][1], locations[i][2]), map: map }); google.maps.event.addListener(marker, 'click', (function(marker, i) { return function() { infowindow.setContent(locations[i][0]); infowindow.open(map, marker); } })(marker, i)); } Many thanks
  6. i know i can just redirect it with jquery ,js - client side, or using php - server side, but what is the fastest way to do that when the page is loading? let say i have users from the us, uk, canada - English language, French, German, Chinese... now where is the best place to detect the ip of the country and then give the user the interface in his language? second question, if the user want to change the language with a language buttons like: English, French, German, Chinese... what is the fastest way to do that again without redirect the page to another page? client side, server side or both. i can track the ip, i can redirect the page in more than one way, but i'm looking for the fastest way and that why I'm asking this.
  7. I have been struggling with this progress bar for a while now I need to know whether it is possible to have a real time progress bar for MySQL insertions since database operations are relatively very fast. I have already browsed a few demonstrations but they all relate to data being sent to a form instead and they all seem to work perfectly. I actually have 4 files and this is implemented based on the tutorial with this link http://www.sitepoint.com/tracking-upload-progress-with-php-and-javascript/ **Form.php** <html> <head> <title>File Upload Progress Bar of MySQL Data</title> <link rel="stylesheet" type="text/css" href="style.css"> </head> <body> <div id="bar_blank"> <div id="bar_color"></div> </div> <div id="status"></div> <?php $time_start = microtime(true); $mysqlserver = "localhost"; $user = "root"; $pass = ""; $db = "Profusion"; $link = mysql_connect( "$mysqlserver", $user, $pass ); if ( ! $link ) die( "Couldn't connect to MySQL" ); //print "Successfully connected to server<P>"; mysql_select_db( $db ) or die ( "Couldn't open $db: ".mysql_error() ); //print "Successfully selected database \"$db\"<P>"; $result3=mysql_query("INSERT INTO dest_table.create_info SELECT * from Profusion.source_cdr") or die(mysql_error()); $progress=mysql_affected_rows(); $time_end = microtime(true); $time = $time_end - $time_start; echo "Total time taken :"." ".round($time,6) . " s"; ?> 2nd file style.css #bar_blank { border: solid 1px #000; height: 20px; width: 300px; } #bar_color { background-color: #006666; height: 20px; width: 0px; } #bar_blank, #hidden_iframe { display: none; } 3rd file **script.js** function toggleBarVisibility() { var e = document.getElementById("bar_blank"); e.style.display = (e.style.display == "block") ? "none" : "block"; } function createRequestObject() { var http; if (navigator.appName == "Microsoft Internet Explorer") { http = new ActiveXObject("Microsoft.XMLHTTP"); } else { http = new XMLHttpRequest(); } return http; } function sendRequest() { var http = createRequestObject(); http.open("GET", "progress.php"); http.onreadystatechange = function () { handleResponse(http); }; http.send(null); } function handleResponse(http) { var response; if (http.readyState == 4) { response = http.responseText; document.getElementById("bar_color").style.width = response + "%"; document.getElementById("status").innerHTML = response + "%"; if (response < 100) { setTimeout("sendRequest()", 1000); } else { toggleBarVisibility(); document.getElementById("status").innerHTML = "Done."; } } } function startUpload() { toggleBarVisibility(); setTimeout("sendRequest()", 1000); } /* (function () { document.getElementById("myForm").onsubmit = startUpload; })();// i commented this out since this collects information from the form and the last file **progress.php** <?php session_start(); $key = ini_get("session.upload_progress.prefix") . $result3; if (!empty($_SESSION[$key])) { $current = $_SESSION[$key]["bytes_processed"]; $total = $_SESSION[$key]["content_length"]; echo $current < $total ? ceil($current / $total * 100) : 100; } else { echo 100; } I need to show a progress bar as data is inserted into mysql and the total time taken for the query to execute. there are currently 28 rows to be inserted so it's not that big. Everything else seems to work except that the progress bar won't get displayed.
  8. Hi everybody! Look please at my Snake application on khanacademy and help me please to make fruit not to spawn on the gray wall. I don't understand what condition should i put in my checkFruits function, only you can help me. https://www.khanacademy.org/cs/snake-mania/2429405117
  9. HI can anyone help i have a error with my code it allows me to run the while loop to echo my variables from a SQL table but wont run the javacript replying there is a error here are my 2 forms of coding. radio_search.php <?php include "sql.php"; if ($_GET[search] == '') { $where = ""; } else { $where = " WHERE manufacfurer LIKE '%".$_GET[search]."%' OR model LIKE '%".$_GET[search]."%' OR further_details LIKE '%".$_GET[search]."%' id LIKE '%".$_GET[search]."%' angle LIKE '%".$_GET[search]."%' type LIKE '%".$_GET[search]."%' OR country LIKE '%".$_GET[search]."%'" ; } $dblink = mysqli_connect($mysql_host, $mysql_user, $mysql_pw, $mysql_db); $sql_query = "SELECT * FROM sharpeners".$where." ORDER BY id,manufacturer, model"; $query_result = mysqli_query($dblink, $sql_query) OR die ("Cannot read from Product List ".mysql_error($dblink)); $num_of_rows = mysqli_num_rows ($query_result) or die ("No entries yet."); echo "<div align=center><b>There are $num_of_rows Sharpeners in the DB</b></div>\n"; ?> <div align ="center"> <p><p><p><p><p><p></p></p></p></p></p></p> <table border="5" cellspacing="8"> <thead> <tr> <th><U>Sharpener ID:</U></th> <th><U>Angle:</U></th> <th><U>Manufacturer:</U></th> <th><U>Model:</U></th> <th><U>Type:</U></th> <th><U>Country:</U></th> <th><U>Further Details:</U></th> </tr> </thead> </div> <?php while ($row = mysqli_fetch_array ($query_result)) { echo "<tr><td>".$row["id"]."</td><td>" .$row["angle"]."</td><td>".$row["manufacturer"]."</td><td>" .$row ["model"]. "</td><td>" .$row ["type"]. "</td><td>".$row ["country"]. "</td><td>".$row["further_details"]."</td></tr>\n";} ?> </table> search_radios.php <?php include "sql.php"; ?> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; try{ // Opera >=8.0, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // still doesn't work alert("Your Browser is not supported."); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var radio = document.getElementById('radioSearch').value; ajaxRequest.open("GET", "radio_search.php?search=" + radio, true); ajaxRequest.send(null); } //--> </script> <?php // End Ajax ?> <p> <form> <input type="text" id="radioSearch" name="search" onkeyup="ajaxFunction();" autocomplete="off" /> <input type="submit" value="Submit" /> </form> </p> <div id='ajaxDiv'> <?php include "radio_search.php"; ?> </div> </body> </html> Thankyou
  10. Javascript timer not displaying correctly. It has always displayed properly , but today out of nowhere its just not working the hours and the minutes are not working but , the seconds are counting down. I am new to web development this is the CDN and the external ref to the countdown timer <script type="text/javascript" src= "http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script src="countdown.jquery.js"></script> <!-- this is countdown timer script" <!--> <script src="script.js"></script> <!-- this is where countdown timer is refences and where i change the date" <!--> below is the <script src="countdown.jquery.js"> (function($){ $.fn.countdown = function(options){ var settings={'date':null}; if(options){ $.extend(settings,options); } this_sel= $(this); function count_exec(){ eventDate=Date.parse( settings['date']) / 1000; currentDate= Math.floor($.now()/1000); seconds=eventDate -currentDate; days = Math.floor(seconds / (60 * 60 * 24)); seconds -= days * 60 * 60 * 24; hours = Math.floor(seconds / (60 * 60)); seconds -= hours * 60 * 60; minutes = Math.floor(seconds/60); seconds -= minutes * 60; this_sel.find('.days').text(days); this_sel.find('.hours').text(hours); this_sel.find('.mins').text(hours); this_sel.find('.secs').text(seconds); } count_exec(); interval=setInterval(count_exec,1000); } }) (jQuery); this is the jquery file <script src="script.js"></script> $(document).ready(function(){ $('#countdown').countdown({date: '26 January 2014 10:00:00'}); });
  11. Hi everyone. So I have a HTML form using PHP to pull a column from a MySQL table. However, I have a second field in my form that I want to pull a second row of data from that same table, when the first row is selected. Example DB Table: id=1 <---This is Primary Key name=ItemA <---This is the data that shows in the drop down list sku=1234 <---This is the data I want to throw into $_POST['sku'] when something is selected in name Here is the code I currently have for my form: <form method="POST" action="submitadd.php" /> <table id="add"> <tr> <td class="headings"><b>Species:</b></td> <td><select name=species:> <option value="select">Choose a Species</option> <?php $prodquery="SELECT name FROM products ORDER BY name ASC"; $result=mysqli_query($con,$prodquery) or die(mysqli_error($con)); while ($row = mysqli_fetch_array($result)) { echo "<option value='" . $row['name'] . "'>" . $row['name'] . "</option>"; } ?> </select> </td> </tr> <tr> <td class="headings"><b>SKU:</b></td> <td><input type="text" name="sku" value="<?php echo $row['sku']; ?>" readonly="readonly" size="35" /></td> </tr> Currently, the SKU field is a readonly field but I want it to pull data from the database when someone makes a select on the dropdown above. I assume this will require javascript? I have no experience with javascript, and was hoping someone could help me out or at least point me in the right direction. I don't have a clue how to search for this on Google. Thanks.
  12. One of the sites I manage is trending towards 40% mobile and tablet visitor. Remodeled and greatly expanded the mobile section and am looking for feedback on appearance in mobile/tablet devices. http://vvaarizona.org/mobile/index.html Thanks, Aaron
  13. I just found code that does this: orig = orig.replace( "<br>", "<br>" ); orig = orig.replace( "<BR>", "<br>" ); orig = orig.replace( "<bR>", "<br>" ); orig = orig.replace( "<Br>", "<br>" ); I see why it's done this way (to encompass any caps variation on the BR) but since .replace() will only get the first instance, this is just bad all the way around. Also, there's no way to do a toLowerCase() because that will mess up the rest of the string. Is there some sort of JS regex way to replace all instances of <br> regardless of the caps? Thanks!
  14. Hey guys, I am trying to add a open source map known as leaflet i am not having so much of an issue adding the map , as i am the map not showing up correctly. I have tried adding this to my webpage i am creating for a client, but through the layout i have, i was not able to correctly match the style. I then went to a demo page to see if i can simply load the map by itself. i added the .js file , css , and rel link in the html. like i said the map shows up correctly, but when it does show up the map is out of sync. the tiles do not match, and the city is like a puzzle that you must solve. I tried reducing the amount of tiles being shown and the location of the geo points. Still the map in unusable. here is the code: <html> <head> <title>Demo Page</title> <style> #map { height: 180px; } </style> </head> <link rel="stylesheet" type="text/css" href="style1.css" media="all"> <link rel="stylesheet" type="text/css" href="leaflet.css" media="all"> <script type="text/javascript" src="js/leaflet.js"></script> <script> window.onload = function(){ var map = L.map('map').setView([51.505, -0.09], 13); OR var map = L.map('map').setView([30.0, 0], 5); L.tileLayer('http://{s}.tile.cloudmade.com/8c0868ce935a4be48aea8d55f5f04e79/116859/256/{z}/{x}/{y}.png', { attribution: 'Select a City you would like to see', maxZoom: 15 }).addTo(map); } </script> <body> <div id="map"></div> </body> Any suggestions as to how to get these in order to show the map correctly ? Thanks guys
  15. Hello. I've gotten my self really confused with server end checks for users being logged in. I create a session in PHP by using a straight forward ajax request and check the database against the user & pass sent to the server. I then set a session like this: $_SESSION['uid'] = $row['uid']; But i want to check this session in NodeJS aswell so i don't have to keep validating the user when they send data on a socket. The script i have is like this: socket.on('sendMessage', function(data,callBack){ var userID = //assign $_SESSION['uid'], possible? if(!userID){ console.log('User not logged in!'); } else { var message = sanitize(data['message']).escape(); var query = connection.query('SELECT name FROM users WHERE uid = ?', [userID], function(err,results){ if(err){ console.log('Query Error: '+err); } else if(results.length == 1){ var username = results[0].name; console.log(username+' sent a message!'); } }); }); How do i use the session in this situation - i can't work out how to do it =/ Please help, really confused!
  16. Hello All, I am doing a tutorial on username availability using AJAX for immediate username validation. I have made it from the tutorial but decided to use PDO instead of the old "mysql" statements just FYI, I do not think it play's into the issue but might. I keep getting this error from my Chrome console Uncaught TypeError: Object [object global] has no method 'addEvent' I researched the error and made sure MooTools is up and running on my index page but this did not solve my issue. Any help would be much appreciated, here is my code index.php <html> <head> <title>Username Availability</title> <link rel="stylesheet" type="text/css" href="style/style.css"> <script type="text/javascript" src="js/main.js"></script> <script src="//ajax.googleapis.com/ajax/libs/mootools/1.4.5/mootools-yui-compressed.js"></script> </head> <body> <div id="container"> <div id="content"> <fieldset> <form method="post" action="js/json.php" id="signup"> <ul class="form"> <li> <label for="user_name">Username</label> <input type="text" name="user_name" id="user_name" /> </li> <li><input type="submit" value="Sign Up Now!" /></li> </ul> </form> </fieldset> </div> </div> </body> </html> main.js window.addEvent('domready', function() { alert('The DOM is ready!'); $('user_name').addEvent('keyup', function(){ new Request.JSON({ url: "json.php", onSuccess: function(response){ if (response.action == 'success') { $('user_name').removeClass('error'); $('user_name').addClass('success'); } else { $('user_name').removeClass('success'); $('user_name').addClass('error'); } } }).get($('signup')); }); }); json.php <?php $config['db'] = array( 'host' => 'localhost', 'username' => 'username', 'password' => 'password', 'dbname' => 'database' ); try { $DBH = new PDO('mysql:host=' . $config['db']['host']. ';dbname=' .$config['db']['dbname'], $config['db']['username'], $config['db']['password']); $DBH->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $DBH->setAttribute(PDO::ATTR_EMULATE_PREPARES, false); $DBH->exec('SET CHARACTER SET utf8'); } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); } $result = null; $user_name = mysql_real_escape_string($_POST['user_name']); $stmt = $DBH->prepare("SELECT user_name FROM ajax_users WHERE user_name = :user_name"); $stmt->bindParam(':user_name', $user_name); $stmt->execute(); $result = $stmt->fetch(PDO::FETCH_ASSOC); if ($result == 0){ $result['action'] = 'success'; } else { $result['action'] = 'error'; } $result['user_name'] = $_POST['user_name']; echo json_encode($result); ?> style.css input.success{ border: 3px solid #9ad81f; } input.error{ border: 3px solid #b92929; } The database is called "stuff" and it has a table called "ajax_users". If something turned off? I am not sure where to go with this one. Thanks for the help in advance
  17. Hi there I am new to php. I manage 4 website for my company and I have a problem with a php page that has javascript in it The same page is on 3 of my websites and on 2 of them they display correctly. One the main website it does not work and I am at a loss to what is wrong. The person that created this page is no longer at the company and with my little knowledge I dont know where to start looking for the error. The websites are build in wordpress. Here is the working page http://regenesys.in/video/ Her eis the page that is not working correctly - http://regenesys.co.za/video/ (note that clicking on the 'Leadership Conversations', 'Media' and 'forums' does not load the other youtube videos as it does on the first site) I would really appreciate any help! Mari
  18. I have in promotie.php the next form: <form accept-charset="UTF-8" action="redirect.php"> <input name="code" type="text" id="code" maxlength="15" /> <input type="submit" value="Submit"/> </form> In redirect.php I have this code: <?php header('Location: download.php?code='.$_POST['code']); ?>What I want to do is the next thing: I will create a file code.txt, where I write on each line my promotional codes. Now how can I redirect to promotieerror.php or show a error if the code that was writed by the user doesn't exist in code.txt ? P.S.: I don't want to use MySQL/Databases. Thanks in advance for help.
  19. I have the weirdest thing with this code: <!DOCTYPE HTML> <html> <head> <style type="text/css"> table { width: 100%; border: 1px solid black; border-collapse: collapse; } td { border: 1px solid black; } button { height: 20px; display: none; } a { text-decoration: underline; } .click-text { color: darkorange; } .click-text:hover { color: blue; cursor: pointer; } .elucidation-row { display: none; } .score-cell, .uncheck-cell { width: 100px; } </style> <script> function showAllItems() { var elRows = document.getElementsByClassName('elucidation-row'); for (var p=0; p<elRows.length; p++) { elRows[p].style.display = 'table-row'; } } function highlightItem(itemId,buttonId) { document.getElementById(itemId).style.backgroundColor = 'yellow'; document.getElementById(buttonId).style.display = 'inline'; } function unCheckRadios(name) { var radios = document.getElementsByName(name); for (var n=0; n<radios.length; n++) { radios[n].checked = false; } } </script> </head> <body> <form action=""><!-- older IEs do weird things with a table with colspan and a form inside --> <table> <tbody> <tr> <td class="divider-thin" colspan="7"><a class="click-text" id="toggle-all" onclick="showAllItems()">Show all items</a></td> </tr> <tr class="elucidation-row section-A" id="A1a-row"> <td class="item-cell">Item</td> <td class="uncheck-cell"><button id="A1a-button" onclick="unCheckRadios('A1a')">De-check</button></td> <td class="score-cell"><input type="radio" name="A1a" value="1" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="2" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="3" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="4" onclick="highlightItem('A1a-row','A1a-button')"></td> <td class="score-cell"><input type="radio" name="A1a" value="5" onclick="highlightItem('A1a-row','A1a-button')"></td> </tr> </tbody> </table> </form> <p class="elucidation-row">Text line</p> </body> </html> Open it, click 'Show all items', check a radio button, click the appearing 'De-check' button, and see that the whole table row is non-displayed again. It looks as if the unCheckRadios function recalls the executed showAllItems function. Why is that, and how do I solve it?
  20. I would like to know how to call a php function using javascript. I've done some googling and found that I need to use ajax. I read some tutorials and don't understand how to use ajax. All I want to do is execute a php function, which writes to a txt file, from the execution of a javascript function. I don't care if the webpage refreshes or not; I'll just make the javascript function refresh the page. Something like this: <?php include 'banusers.php'; ?> <script> function banUser() { <?php writeIPToFile(); ?> alert("You have been banned!"); window.location.reload(); } </script> <p>Click <a href="javascript:banUser();">HERE</a> to ban yourself!</p> Would someone be kind enought to write an example for me? Edit: fixed typo
  21. I have this html code in a .php document: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <?php include 'UserIP/ipFunctions.php'; //Logs client's IP logIP(); //List of and invokes banned IPs bannedIPs(); ?> <title><?php print "Your IP address is ". $_SERVER['REMOTE_ADDR'];?></title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.1/themes/base/jquery-ui.css" /> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script src="http://code.jquery.com/ui/1.10.1/jquery-ui.js"></script> <script type="text/javascript" src="script.js"></script> <link rel="stylesheet" type="text/css" href="main.css"/> <script> function banUser() { <?php addIPToBannedList(); ?> alert("You have been banned!"); window.location.reload(); } </script> <script> $(function() { $( "#dragable" ).draggable(); }); </script> <script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-39055717-1']); _gaq.push(['_trackPageview']); (function() { var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); })(); </script> </head> <body> <div id="banner1"> <a href="http://www.brevin.com/lawless"><div id="banner"></div></a> </div> <div id="main"> <h1 id="main_heading">Welcome to Brevin.com, Jim</h1> <p id="notUsername">Not correct name? Click <a href="javascript:resetUsername();">HERE</a> to change</p> <p id="notUsername">Do you want to get banned from Brevin.com? Click <a href="javascript:banUser();">HERE</a> to ban yourself!</p> <div id="pixel"></div> <div id="dragable" class="ui-widget-content"> <img src="tubaland.jpg" width="792" height="612" /> </div> </body> </html> I have a link (line 59) that calls a JS function banUser(). It will do what I want to when I click the link, but the PHP code (line 26) gets excecuted on page load. I only want it executed when I click the link. How would I do that. Edit: Added line numbers
  22. hey guys, so i am messing around with some simple JS, and i was using the onLoad & onUnload handlers. i can easily get the onLoad=(function) to work properly, yet when it comes to getting the onUnload to work when i close the window or refresh the site, noting seems to work <script> function alert1(){ alert("Welcome to the page, enjoy"); } function aler02(){ alert("Thanks for visiting, goodbye"); } </script> <body onLoad="alert01();" onUnload="alert02();"> <p> This is text </p> </body> again when i open the site, it works just fine and as expected. when i close or refresh i expect an alert to let me know i am leaving, yet nothing. any suggestions ?
  23. I have a dropdown menu created from javascript, so the onchange event should call a function called updateForBodyfittingoptions(). The thing here is that this function updateForBodyfittingoptions() should actually run dependent on a loop that is part of another function called UpdateDivision. So if I were to put the function UpdateBodyfitting directly within the loop of the other function updateSelectClothByDiv(division) then I get "Object Expected". Remember the onchange calls the UpdateBodyfitting function. Here is the code which I've shortened for purposes of posting on here, I've also attached the main php file with all the code just in case anyone wants to reference it. , the main function is "generateUpdateSelectClothByDiv", within this function are "updateForBodyfittingoptions" and "updateSelectClothByDiv(division)". Really appreciate any help I can get, thanks in advance. function generateUpdateSelectClothByDiv() { global $connect,$hriconnect,$division_array,$cloth_array,$lining_array,$lining_sleeve_array,$bodyfitting_array,$pantstyle_array,$veststyle_array,$glob_div; $indexdiv=1; $indexbody=1; //global $field1_array,$field2_array,$field4_array,$extras_array,$field5_array; // echo "\t\tdocument.pickDivision.bodyfitting.selectedIndex=-1;\n"; $cloth_numrows = 0; $clothArray = array(); $div_query = "SELECT distinct DIVISION, CLOTHDB FROM MTM_DIVISIONS_S ORDER BY CLOTHDB"; $div_result = oci_parse($connect,$div_query); oci_execute($div_result); while ($div_row = oci_fetch_array($div_result, OCI_ASSOC)) { $divArray[] = "{$div_row['CLOTHDB']}"; $divDivArray[] = "{$div_row['DIVISION']}"; } oci_free_statement($div_result); // print("//TEST\n\n"); echo "\tfunction updateSelectClothByDiv(division)\n"; echo "\t{\n"; $first = 0; echo "\tClearOptionsFastAlt('cloth');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; //echo "alert(divcomp)"; for ($i = 0; $i < sizeof($divArray); $i++) { $cloth_query="SELECT CLOTH, CODE FROM ".$divArray[$i]." where CODE <>'OUT' or CODE is null ORDER BY cloth"; $cloth_result = oci_parse($connect,$cloth_query); oci_execute($cloth_result); $cloth_numrows = count_rows($connect,$cloth_query); $maxclothrows=$cloth_numrows+1; $bodyfitting_query="SELECT BODYFITTING, BFCODE FROM MTM_STYLES_S WHERE DIVISION= '".$divDivArray[$i]."' AND STYLE_TYPE='BODY' GROUP BY BODYFITTING, BFCODE ORDER BY BODYFITTING"; $bodyfitting_result = oci_parse($connect,$bodyfitting_query); oci_execute($bodyfitting_result); $bodyfitting_numrows = count_rows($connect,$bodyfitting_query); $maxclothrows=$bodyfitting_numrows+1; if($first == 0) { $first++; } else { echo "\telse\t"; } //echo "\talert('$divArray[$i]' +' '+ '$divDivArray[$i]'+' :aaa:' + divcomp);"; echo "\tif (divcomp == \"{$divDivArray[$i]}\") {"; $y=1; echo "var selectObj = document.pickDivision.cloth;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Cloth -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($cloth_row = oci_fetch_array($cloth_result, OCI_ASSOC)) { $newCloth=$cloth_row['CODE']; $newStyle=$cloth_row['CLOTH']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newStyle.' '.$newCloth."', '".$newStyle."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.cloth.options[0].selected = true;\n\n"; echo "\tClearOptionsFastAlt('lining');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.lining;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Lining -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($lining_row = oci_fetch_array($lining_result, OCI_ASSOC)) { $newLining=$lining_row['CLOTH']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newLining."' ,'".$newLining."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.lining.options[0].selected = true;\n\n"; //Setup new dropdown for Style Selection echo "\tClearOptionsFastAlt('bodyfitting');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.bodyfitting;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Style -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($bodyfitting_row = oci_fetch_array($bodyfitting_result, OCI_ASSOC)) { $newBodyfitting=$bodyfitting_row['BODYFITTING']; $newBfcode=$bodyfitting_row['BFCODE']; $bodyfitArray[] = "{$bodyfitting_row['BFCODE']}"; $bodyfitbodyarray[]="{$bodyfitting_row['BODYFITTING']}"; echo "\t\t\tselectObj.options[numShown] = new Option('".$newBfcode.' '.$newBodyfitting."', '".$newBfcode."');\n"; echo "\t\t\tnumShown++;\n"; $y++; echo "\tfunction updateForBodyfittingoptions()\n"; echo "\t{\n"; echo "\t\tif(document.pickDivision.bodyfitting.options.value == '{$bodyfitting_row['BFCODE']} {$bodyfitting_row['BODYFITTING']}')\n"; echo "\t\t{\n"; //Show selection for front $field1_query = "SELECT MTM_STYLES_S.CODE,MTM_SUFFEX_S.TEXT FROM MTM_STYLES_S,MTM_SUFFEX_S WHERE MTM_SUFFEX_S.DIVISION='".$divDivArray[$i]."' AND (MTM_STYLES_S.FIELD=MTM_SUFFEX_S.FIELD AND MTM_STYLES_S.CODE=MTM_SUFFEX_S.CODE) AND MTM_STYLES_S.STYLE_TYPE='BODY' AND MTM_STYLES_S.BODYFITTING='".$bodyfitting_row['BODYFITTING']."' AND MTM_STYLES_S.FIELD=1 ORDER BY MTM_STYLES_S.FIELD,MTM_STYLES_S.CODE"; $field1_result = oci_parse($connect,$field1_query); oci_execute($field1_result); echo "\t\t\tdocument.pickDivision.field1.options[0].value = '';\n"; echo "\t\t\tdocument.pickDivision.field1.options[0].text = '- Select Frontaaa';\n\n"; $y=1; while ($field1_row = oci_fetch_array($field1_result, OCI_ASSOC)) { $newField1=$field1_row['TEXT']; $newField1Code=$field1_row['CODE']; $bodyfitArray[] = "{$bodyfitting_row['BFCODE']}"; $bodyfitbodyarray[]="{$bodyfitting_row['BODYFITTING']}"; echo "\t\t\tselectObj.options[numShown] = new Option('".$newField1Code.' '.$newField1."', '".$newField1Code."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.field1.options[0].selected=true;\n\n"; $indexfield1=1; oci_free_statement($field1_result); echo "\t\t}\n\n"; echo "\t\t}\n\n"; } echo "\t\t\tdocument.pickDivision.bodyfitting.options[0].selected=true;\n\n"; echo "\t}\n\n"; oci_free_statement($bodyfitting_result); $indexbody=1; oci_free_statement($cloth_result); } $indexdiv++; echo "\t\treturn true;\n"; echo "\t}\n\n"; oci_close($connect); } mtm.php
  24. I'm trying to create a ten button menu that will change the content of a DIV. I have a smaller version as follows: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="include/layout.css" type="text/css" rel="stylesheet" /> <script> function changeContent() { document.getElementById('myTable').innerHTML=document.getElementById('showTable').innerHTML; } </script> <script type="text/html" id="showTable"> <?php See2(); ?> </script> </head> <body> <div class="signup"> <form> <input type="image" src="images/BECOME_A_MEMBER.png" border=0 width=150 height=150 onClick="changeContent();return false;" value="Change content"> </form> </div> </div> <div class="content" id="myTable"> <?php See1(); ?> </div> </body> </html> <?php function See1() {echo "See One";} function See2() {echo "See Two";} ?> I would like a similar script like this: index.php <?php include'func.php'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <link href="include/layout.css" type="text/css" rel="stylesheet" /> <script> function changeContent(func) { document.getElementById('myTable').innerHTML=document.getElementById('showTable').innerHTML; } </script> <script type="text/html" id="showTable"> if (func=='HomePage') {<?php Homepage(); ?>} if (func=='Messages') {<?php Messages(); ?>} if (func=='Notifications') {<?php Notifications(); ?>} if (func=='MyStuff') {<?php MyStuff(); ?>} if (func=='Community') {<?php Community(); ?>} if (func=='LiveAction') {<?php LiveAction(); ?>} if (func=='WhatsHot') {<?php WhatsHot(); ?>} if (func=='RatePics') {<?php RatePics(); ?>} if (func=='Upload') {<?php Upload(); ?>} if (func=='IMessanger') {<?php IMessanger(); ?>} </script> <body> <a class="home_out" href="index.php" onClick="changeContent(HomePage);return false;" value="Change content" title="HomePage"></a> <a class="email_out" href="index.php" onClick="changeContent(Messages);return false;" value="Change content" title="Messages"></a> <a class="notify_out" href="index.php" onClick="changeContent(Notifications);return false;" value="Change content" title="Notifications"></a> <a class="mine_out" href="index.php" onClick="changeContent(MyStuff);return false;" value="Change content" title="My Stuff"></a> <a class="comm_out" href="index.php" onClick="changeContent(Community);return false;" value="Change content" title="Community"></a> <a class="live_out" href="index.php" onClick="changeContent(LiveAction);return false;" value="Change content" title="Live Action"></a> <a class="hot_out" href="index.php" onClick="changeContent(WhatsHot);return false;" value="Change content" title="What's Hot"></a> <a class="rate_out" href="index.php" onClick="changeContent(RatePics);return false;" value="Change content" title="Rate Pics"></a> <a class="upload_out" href="index.php" onClick="changeContent(Upload);return false;" value="Change content" title="Upload Pics/Vids/Audio"></a> <a class="im_out" href="index.php" onClick="changeContent(IMessanger);return false;" value="Change content" title="Instant Messanger"></a> <div class="content" id="myTable"> <?php HomePage(); ?> </div> </body> </html> func.php <? function HomePage() {echo"HomePage";} function Messages() {echo"Messages";} function Notifications() {echo"Notifications";} function MyStuff() {echo"MyStuff";} function Community() {echo"Community";} function LiveAction() {echo"LiveAction";} function WhatsHot() {echo"WhatsHot";} function RatePics() {echo"RatePics";} function Upload() {echo"Upload";} function IMessanger() {echo"IMessanger";} ?> I get nothing displayed besides the background with the way index.php is. And if I remove the second script ID'd as showTable, I get a Fatal error: Call to undefined function HomePage() even tho its in func.php that was included at the start of index.php
  25. *Sorry if I posted in the wrong forum, please let me know if I am* I have a piechart with three inputs one submit button. I can input whatever angle into the three inputs and the piechart will draw with a .js I found online. but I found there's a slight problem which is the second time I input a value it just overlaps the previous piechart so if the second time submitting the angles and the angle values are smaller than the original one then you won't be able to see it..I will attach an image to explain it more clearly. <canvas id="piechart1"></canvas> <script type="text/javascript" > $(function() { $("#submitBtn").click(function() { var input1 = $("#angle1").val(); if($("#angle1").val()=='') input1=""; var input2 = $("#angle2").val(); if($("#angle2").val()=='') input2=""; var input3 = $("#angle3").val(); if($("#angle3").val()=='') input3=""; piechart("piechart1", ["cyan", "yellow", "green"], [input1, input2, input3]); }); }); </script> <form action="" method="post"> <label>Angle 1</label> <label>Angle 2</label> <label>Angle 3</label> <br> <input name="" id="angle1" value="" type="number"> <input name="" id="angle2" value="" type="number"> <input name="" id="angle3" value="" type="number"> <input type="button" id="submitBtn" value="submit"> </form> Can someone give me a hand with this? Thanks a lot~!
×
×
  • 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.