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'm using pretty photo. I want to refresh the parent page when I close the modal window which is an iframe. This script closes the modal, but does not refresh the parent frame. <a href="#" onclick="window.parent.jQuery.prettyPhoto.close();">Close</a>
  2. Hello all, I was trying to use PHP to echo a Javascript function but it wasn't going well at all. I am wondering, is it possible to do the following: <script type="text/javascript"><span id="formResponse"></script> Thank you, Josh.
  3. i have a form. if user enter the data, the db table display. but i want the table to get displayed when the user logins for the first time. simple one but i can't get it how... aa.html <html> <body> <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = ajaxRequest.responseText; } } var age = document.getElementById('age').value; var wpm = document.getElementById('wpm').value; var sex = document.getElementById('sex').value; var name = document.getElementById('name').value; var queryString = "?age=" + age + "&wpm=" + wpm + "&sex=" + sex + "&name=" + name; $a=ajaxRequest.open("GET", "ss1.php" + queryString, true); ajaxRequest.send(null); } //--> </script> <form name='myForm'> Name:<input type='text' id='name' /> <br /> Age: <input type='text' id='age' /> <br /> WPM: <input type='text' id='wpm' /> <br /> Sex: <select id='sex'> <option value='m'>m</option> <option value='f'>f</option> </select> <input type='button' onclick='ajaxFunction()' value='Insert New row' /> </form> <div id='ajaxDiv'>Your result will display here</div> </body> </html> ss1.php $age = $_GET['age']; $sex = $_GET['sex']; $wpm = $_GET['wpm']; $name= $_GET['name']; // Escape User Input to help prevent SQL Injection $a=isset($_GET['age']) && $_GET['age']; $b=isset($_GET['sex']) && $_GET['sex']; $c=isset($_GET['wpm']) && $_GET['wpm']; $d=isset($_GET['name']) && $_GET['name']; $age = mysql_real_escape_string($age); $sex = mysql_real_escape_string($sex); $wpm = mysql_real_escape_string($wpm); $name = mysql_real_escape_string($name); //build query $query = "INSERT INTO `ajax_example`(`ae_name`, `ae_age`, `ae_sex`, `ae_wpm`) VALUES ('$name','$age','$sex','$wpm')"; $qry = mysql_query($query) or die(mysql_error()); $a="SELECT `ae_name`, `ae_age`, `ae_sex`, `ae_wpm` FROM `ajax_example`"; $qry_result=mysql_query($a) or die(mysql_error()); //Build Result String $display_string = "<table>"; $display_string .= "<tr>"; $display_string .= "<th>Name</th>"; $display_string .= "<th>Age</th>"; $display_string .= "<th>Sex</th>"; $display_string .= "<th>WPM</th>"; $display_string .= "</tr>"; // Insert a new row in the table for each person returned while($row = mysql_fetch_array($qry_result)){ $display_string .= "<tr>"; $display_string .= "<td>$row[ae_name]</td>"; $display_string .= "<td>$row[ae_age]</td>"; $display_string .= "<td>$row[ae_sex]</td>"; $display_string .= "<td>$row[ae_wpm]</td>"; $display_string .= "</tr>"; } $display_string .= "</table>"; echo $display_string; ?> if u could tell me show good websites to practice javascript. woulg b gr8.. thank u in advances.
  4. I have a html form in which the dropdown box is an array element now I have created a javascript function that get form as parameter . 1)I need to maniulate the values of the array present in the form in the below code sendmail is the form sname is the field array function addit(sendmail) { var x=document.sendmail.sname.length; //alert(x); while( x>0 ) { var skill=document.getElementById("sname[x]").value; //alert(skill); var anOption = document.createElement("OPTION"); anOption.innerText = skill; anOption.Value = skill; document.form.snames.options.add(anOption); x--; } }
  5. Hi everyone, I have problem with my accordion menu. Instead of sliding down, content from menu overlap each other...Cut me a little slack because i am new to javascript. This is code for menu. <?php include("script/dblib.php"); connectToDB(); header("Content-Type: text/html; charset=UTF-8"); ?> <HTML> <HEAD> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript" src="script/script.js"></script> <STYLE> #accordion { list-style: none; padding: 0 0 0 0; width: 230px; } #accordion li{ height:45px; line-height:45px; display: block; background-image:url('images/for_css/menu_bg.jpg'); background-repeat:repeat-x repeat-y; font-weight: bold; padding-left: 5px; cursor: pointer; list-style: circle; -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; } #accordion ul { list-style: none; padding: 0 0 0 0; display: none; } #accordion li:hover{ background-image:url('images/for_css/bgMenu.png'); } #accordion ul li{ height:30px; text-align: center; font-size: 12px; font-weight: normal; cursor: auto; background-image:url('images/for_css/bc_bg.gif'); line-height:30px; padding: 0 0 0 7px; } #accordion ul li:hover { background-image:url('images/for_css/bgMenu.png'); } #accordion a { text-decoration: none; } </STYLE> </HEAD> <BODY> <?php // Select all entries from the menu table $result=mysql_query("SELECT * FROM parents ORDER BY id_roditelja"); // Create a multidimensional array to conatin a list of items and parents $menu = array( 'items' => array(), 'parents' => array() ); // Builds the array lists with data from the menu table while ($items = mysql_fetch_assoc($result)) { // Creates entry into items array with current menu item id ie. $menu['items'][1] $menu['items'][$items['id_roditelja']] = $items; // Creates entry into parents array. Parents array contains a list of all items with children $menu['parents'][$items['parent_id']][] = $items['id_roditelja']; } // Menu builder function, parentId 0 is the root function buildMenu($parent, $menu) { $html = ""; if (isset($menu['parents'][$parent])) { $html .= " <ul id='accordion'>\n"; foreach ($menu['parents'][$parent] as $itemId) { if(!isset($menu['parents'][$itemId])) { $html .= "<li>\n <a >".$menu['items'][$itemId]['naziv']."</a>\n</li> \n"; } if(isset($menu['parents'][$itemId])) { $html .= " <li>\n <a >".$menu['items'][$itemId]['naziv']."</a> \n"; $html .= buildMenu($itemId, $menu); $html .= "</li> \n"; } } $html .= "</ul> \n"; } return $html; } echo buildMenu(0, $menu); ?> </BODY> </HTML> javascript part: $(document).ready(function(){ $('#accordion > li ul') .click(function(event){ event.stopPropagation(); }) .filter(':not(:first)') .hide(); $('#accordion > li, #accordion > li > ul > li').click(function(){ var selfClick = $(this).find('ul:first').is(':visible'); if(!selfClick) { $(this) .parent() .find('> li ul:visible') .slideToggle(); } $(this) .find('ul:first') .stop(true, true) .slideToggle(); }); }); This is image of what is happening
  6. I'm writing code to validate a form and I'd like to be able to set the position of the cursor to the field of my choice when I detect an error. I'm getting the strong impression that I have to use Javascript to set the position of the cursor via the focus() function. But how do I pass information from my PHP code to Javascript to tell it which field I want the focus on? For example, let's say I've got a simple form contain Name, Email address, Subject and Message. I check for bad data in all of those fields and I want to put the cursor (or focus) on the first field that has an error. How does my PHP code tell Javascript that the first field in error is the Email Address or the Message or whatever? An example showing what happens in PHP and what happens in Javascript would be very handy if someone can point me to one or throw one together....
  7. so is there any way to fetch what array to fetch the data from in the Function input? this is what i got so far function onHoverCounter( ChampID ) { var show1 = ChampID[1]; $("#"+show1).addClass('counter'); } ChampID is fetched from <a href="?champion=ahri"><div class="champion apcarry mid" id="ahri" onmouseover="onHoverCounter(this.id);" onmouseout="onmouseoutCounter(this.id);"><img src="img/champions/ahri.jpg"> Ahri </div></a>
  8. I'm trying to load a listbox named Doggie with this script. It's in the header of my webpage. Can anyone see what I am doing wrong? Thank you. switch(n){ case "Place": $(".Doggie").load(function() $.ajax({ type: "POST", url: "place_place.php", cache: false, success: function (html) { $(".Doggie").html(html); } }); }); break;
  9. I have code that is working. $('.Kitty').live("change",function(){ var LocationString = 'Lid='+ $(this).val(); $.ajax({ type: "POST", url: "ajax_area.php", data: LocationString, cache: false, success: function (html) { $(".Pig").html(html); However; I need two values. Lid (LocationString) and Cid (CityString) How would I do this? I tried this and it doesn't work. $('.Kitty').live("change",function(){ var LocationString = 'Lid='+ $(this).val(); var CityString = 'Cid='+ $(this).val(); $.ajax({ type: "POST", url: "ajax_area.php", data: {Lid: LocationString, Cid:CityString}, cache: false, success: function (html) { $(".Pig").html(html); And this is the ajax_area.php file. Its grabbing Lid successfully, how is Cid added to this mix? <?php require('config.php'); if($_POST['Lid']) { $Lid=$_POST['Lid']; $sql=mysql_query("SELECT tblLocations.RestID as Lid, tblAreas.AreaName as name FROM tblLocations INNER JOIN tblAreas ON tblLocations.AreaID = tblAreas.AreaID WHERE tblLocations.RestID = $Lid GROUP BY tblLocations.RestID, tblAreas.AreaName ORDER BY tblAreas.AreaName ASC"); echo '<option selected="selected">--Select Area--</option>'; while($row=mysql_fetch_array($sql)) { echo '<option value="'.$row['Lid'].'">'.$row['name'].'</option>'; } } ?> Help is appreciated! Thank you!
  10. I made this simple shopping cart where you select quantity from a dropwdown list and these numbers get added and you get a total number for all the products and a total number for the product itself. But i want it write the quantity with price and the name and write it in a div placed on the site so that it is easy for the user to see that he added a product. I made the calculating part by adding the products one by one, as i did not array them. But for this next part i just didn't find a way that suited my needs. This is just from my test page , so i only have a few values , but in the other page i have over 70 listed just like these: <div id="radioAlert"> <script type="text/javascript"> //calculator function updatesum() { document.form.sum.value = (document.form.sum0.value -0) *99 + (document.form.sum1.value -0) *99 + (document.form.sum2.value -0) *99; document.form.smu.value = (document.form.prod0.value -0)*99 + (document.form.prod1.value -0) *99 + (document.form.prod2.value -0) *99 + (document.form.prod3.value -0) *99 + (document.form.prod4.value -0) *99; document.form.totalsum.value = (document.form.sum.value -0) + (document.form.smu.value -0); //not a typo i was just lazy with the name //arrays //This one i did not get to work. var myArray = newArray(); myArray[0]=document.form.sum2.value; myArray[1]=document.form.prod0.value; myArray[2]=document.form.prod1.value; myArray[3]=document.form.prod2.value; myArray[4]=document.form.prod3.value; myArray[5]=document.form.prod4.value; for (var i = 0; i < myArray.length; i++) { alert(myArray[i]); } //this part works but i want it to add its value only once and then replace its value if its updated again, if its 0 i want it to be completely removed. var prod1 = document.form.sum2.value; var prod2 = document.form.sum1.value; var radioAlert = document.getElementById("radioAlert"); var radioAlert2 = document.getElementById("radioAlert"); if (document.form.sum2.value>0) { //document.write("pilotjakke pelsforet small " + prod1 + " stk"); radioAlert.innerHTML += ("pilotjakke pelsforet small " + prod1 + " stk"); alert("pilotjakke pelsforet medium " + prod1 + " stk"); } if (document.form.sum1.value>0) { //document.write("pilotjakke pelsforet small " + prod1 + " stk"); radioAlert2.innerHTML += ("pilotjakke pelsforet medium " + prod2 + " stk"); } } </script> </div>
  11. *I wasnt quite sure what forum to put this at, so since im coding in PHP i posted it here* I am currently creating a League of Legends Champion site where i want it to when i hover over a Champion (Character) i want its counters to get a red/green border (depending on if the champion is good against it or the champion itself is good vs it) So i started using the CSS:hover way, but looking at this i cant help but to notice that it will require a whole lot of code, so im kinda wondering if theres another way of doing it with like Jquery or plain javascript (Maybe even a PHP Function?) I got all the counters stored in a Database Built up as following: CREATE TABLE `counters` ( `Name` TEXT NULL, `Counter 1` TEXT NULL, `Counter 2` TEXT NULL, `Counter 3` TEXT NULL, `Counter 4` TEXT NULL, `Counter 5` TEXT NULL, `Counters 1` TEXT NULL, `Counters 2` TEXT NULL, `Counters 3` TEXT NULL, `Counters 4` TEXT NULL, `Counters 5` TEXT NULL, `Good With 1` TEXT NULL, `Good With 2` TEXT NULL, `Good With 3` TEXT NULL, `Good With 4` TEXT NULL, `Good With 5` TEXT NULL ) i already know how to fetch the data and such, so thats not the problem (just included this if it would be usefull in anyway) But ye, to summarize it im asking if theres another way to do it with Javascript/PHP or anything like that, and also if you would be kind enough to give me a hint about how to do that (i dont need you to write the whole code since i enjoy that myself) but simply a hint on how to do it. And also once again i apologize if this is the wrong part of the forum to put it (move it if needed)
  12. Hello guys, I'm building a website for tablets and i want o add the ability for the user to swipe down to another div. I've found some jquery plugins for this but only for left/right, and from some blogs that jquery doesn't support this ? Is that true and how can i overcome this ? I don't know javascript/jquery and i'd like some help.
  13. Hi, In my project I am calling ul and li data in Iframe and when I click on link then it move fucus on top instead of selected item. Following is the example of the problem. testFrame.htm <!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>Tree Frame</title> </head> <body> <table width="50%" border="0"> <tr id="frameRow"> <td> <iframe id="treeFrame" src="treeFrame2.htm" width="50%" height="100%" scrolling="yes" frameborder="0"> </iframe> <td> </tr> </table> </body> </html> testFrame2.htm <!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>Test Frame2</title> <script language="javascript" type="text/javascript"> function focusMe(id) { documentBygetelementsbyid(id).focus(); } </script> </head> <body> <ul> <li><a href="#" id="1" onclick="javascript:focusMe('1');">menu1</a></li> <li><a href="#" id="2" onclick="javascript:focusMe('2');">menu2</a></li> <li><a href="#" id="3" onclick="javascript:focusMe('3');">memnu3</a></li> <li><a href="#" id="4" onclick="javascript:focusMe('4');">menu4</a></li> <li><a href="#" id="5" onclick="javascript:focusMe('5');">menu5</a></li> <li><a href="#" id="6" onclick="javascript:focusMe('6');">menu6</a></li> <li><a href="#" id="7" onclick="javascript:focusMe('7');">menu7</a></li> <li><a href="#" id="8" onclick="javascript:focusMe('8');">menu8</a></li> <li><a href="#" id="9" onclick="javascript:focusMe('9');">menu9</a></li> <li><a href="#" id="10" onclick="javascript:focusMe('10');">menu10</a></li> <li><a href="#" id="11" onclick="javascript:focusMe('11');">menu11</a></li> <li><a href="#" id="12" onclick="javascript:focusMe('12');">menu12</a></li> <li><a href="#" id="13" onclick="javascript:focusMe('13');">menu13</a></li> <li><a href="#" id="14" onclick="javascript:focusMe('14');">menu14</a></li> <li><a href="#" id="15" onclick="javascript:focusMe('15');">menu15</a></li> </ul> </body> </html> Any solution? - Thanks Zohaib.
  14. hi i am new to php and i am working on a form which has to generate a table row on the button click , but my problem is that i don't have any idea to how do i save that incremented textbox value in my databasa . Can anyone help me out please it would be a huge favor. i have attached my my php script and html script along with this message here is my code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[url="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd%22>"]http://www.w3.org/TR...nsitional.dtd">[/url] <html xmlns="[url="http://www.w3.org/1999/xhtml%22>"]http://www.w3.org/1999/xhtml">[/url] <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Makhtab</title> <link rel="stylesheet" type="text/css" href="form2/view.css" media="all"> <script type="text/javascript" src="form2/view.js"></script> <script type="text/javascript" src="form2/calendar.js"></script> <meta http-equiv="Content-Script-Type" content="text/javascript"> <script type="text/javascript"> function deleteRow(row) { var i=row.parentNode.parentNode.rowIndex; document.getElementById('POITable').deleteRow(i); } function insRow() { console.log( 'hi'); var x=document.getElementById('POITable'); var new_row = x.rows[1].cloneNode(true); var len = x.rows.length; new_row.cells[0].innerHTML = len; var inp1 = new_row.cells[1].getElementsByTagName('input')[0]; inp1.id += len; inp1.value = ''; var inp2 = new_row.cells[2].getElementsByTagName('input')[0]; inp2.id += len; inp2.value = ''; x.appendChild( new_row ); } </script> <script type="text/javascript"> function deletezimRow(row) { var i=row.parentNode.parentNode.rowIndex; document.getElementById('zimtable').deleteRow(i); } function inszimRow() { console.log( 'hi'); var x=document.getElementById('zimtable'); var new_row = x.rows[1].cloneNode(true); var len = x.rows.length; new_row.cells[0].innerHTML = len; var inp1 = new_row.cells[1].getElementsByTagName('input')[0]; inp1.id += len; inp1.value = ''; var inp2 = new_row.cells[2].getElementsByTagName('input')[0]; inp2.id += len; inp2.value = ''; x.appendChild( new_row ); } </script> <!--<style type="text/css" title="currentStyle"> @import "tran/css/layout-styles.css"; @import "tran/css/themes/smoothness/jquery-ui-1.8.4.custom.css"; </style>--> <script type="text/javascript" src="tran/js/jquery-1.6.1.min.js"></script> <script type="text/javascript" src="tran/js/jquery-ui-1.8.14.custom.min.js"></script> <script type="text/javascript" src="tran/js/jq-ac-script.js"></script> </head> <body id="main_body" > <img id="top" src="form2/top.png" alt=""> <div id="form_container"> <h1><a>Untitled Form</a></h1> <form id="makhtab" class="appnitro" enctype="multipart/form-data" method="post" action="makhproc.php"> <div class="form_description"> <h2>Makhtab Details</h2> <!--<p>This is your form description. Click here to edit.</p>--> </div> <table border="0px" width="100%"> <tr> <td><label class="description" for="element_1">Code</label></td><td><input id="element_1" name="code" class="element text small" type="text" maxlength="6" value=""/></td> </tr> <tr> <td><label class="description" for="element_1">Name</label></td><td><input id="element_1" name="name" class="element text large" type="text" maxlength="40" value=""/> </td> </tr> <tr> <td><label class="description" for="element_1">Address</label></td><td><input id="element_4_1" name="add1" class="element text large" value="" type="text"></td> </tr> <tr> <td></td><td><input id="element_4_1" name="add2" class="element text large" value="" type="text"></td> </tr> <tr> <td></td><td><input id="element_4_1" name="add3" class="element text large" value="" type="text"></td> </tr> <tr> <td><label class="description" for="element_1">City</label></td><td><select name="cmbcity" class="element text medium" style="font-size:18px;"/> <option value=""></option> <?php mysql_connect("localhost", "root", '') or die(mysql_error()); mysql_select_db("webapp") or die(mysql_error()); $result = mysql_query("SELECT `name` from city ") or die(mysql_error()); while ($year = mysql_fetch_array($result)) { echo "<option value='$year[name]'>$year[name]</option>"; } ?> </select> </tr> <tr> <td><label class="description" for="element_1">State</label></td><td><select name="cmbstate" class="element text medium" style="font-size:18px;"/> <option value=""></option> <?php mysql_connect("localhost", "root", '') or die(mysql_error()); mysql_select_db("webapp") or die(mysql_error()); $result = mysql_query("SELECT `name` from state ") or die(mysql_error()); while ($year = mysql_fetch_array($result)) { echo "<option value='$year[name]'>$year[name]</option>"; } ?> </select> </tr> </tr> <tr> <td><label class="description" for="element_1">Country</label></td><td><select name="cmbcountry" class="element text medium" style="font-size:18px;"/> <option value=""></option> <?php mysql_connect("localhost", "root", '') or die(mysql_error()); mysql_select_db("webapp") or die(mysql_error()); $result = mysql_query("SELECT `name` from country ") or die(mysql_error()); while ($year = mysql_fetch_array($result)) { echo "<option value='$year[name]'>$year[name]</option>"; } ?> </select> <tr> <td><label class="description" for="element_1">Telephone</label></td><td><input id="element_1" name="country" class="element text medium" type="text" maxlength="255" value=""/></td> </tr> <tr> <td><label class="description" for="element_1">Mobile</label></td><td><input id="element_1" name="country" class="element text medium" type="text" maxlength="10" value=""/></td> </tr> <tr> <br /> </tr> </table> <tr> <br /><p style="border-bottom: 1px dotted #ccc;"></p><br /> <div class="form_description"> <h2>Zimmedar Details</h2> <!--<p>This is your form description. Click here to edit.</p>--> </div> </tr> <input type="button" id="addmorezimbutton" value="Add zimmedar" onclick="insRow()"/><br/><br/> <table id="zimtable" border="0px" size="100px" cellspacing="0" cellpadding="2"> <tr> <td width="10" align="center"><label class="description">Srno. </label></td> <td width="118"><label class="description">Zimmedar Name</label></td> <td width="118"><label class="description">Mobile</label></td> <td width="10"></td> <td width="10" align="center"></td> </tr> <tr> <td>1</td> <td width="210"><input size="40" maxlenght="40" type="text" id="zimame[]"/></td> <td width="80"><input size="10" maxlenght="10" type="text" id="zimmob[]"/></td> <!--<td><input size="45" maxlenght="10" type="text" id="momob"/> </td>--> <td><input type="button" id="addzimmore" value="+" onclick="inszimRow()"/></td> <td align="center"><input type="button" id="delzimbutton" value="-" onclick="deletezimRow(this)"/></td> </tr> </table> <tr> <br /><p style="border-bottom: 1px dotted #ccc;"></p><br /> <div class="form_description"> <h2>Muallim Details</h2> <!--<p>This is your form description. Click here to edit.</p>--> </div> </tr> <input type="button" id="addmorePOIbutton" value="Add Muallims" onclick="insRow()"/><br/><br/> <table id="POITable" border="0px" size="100px" cellspacing="0" cellpadding="2"> <tr> <td width="10" align="center"><label class="description">Srno. </label></td> <td width="118"><label class="description">Moallim Name</label></td> <td width="118"><label class="description">Mobile</label></td> <td width="118"><label class="description">Qabiliyat</label></td> <td width="10"></td> <td width="10" align="center"></td> </tr> <tr> <td>1</td> <td width="210"><input size="40" maxlenght="40" type="text" id="moname[]"/></td> <td width="80"><input size="10" maxlenght="10" type="text" id="momob[]"/></td> <td><select name="cmbmuallim[]" class="element text large" style="font-size:18px;"/> <option value=""></option> <?php mysql_connect("localhost", "root", '') or die(mysql_error()); mysql_select_db("webapp") or die(mysql_error()); $result = mysql_query("SELECT `name` from qabiliyat ") or die(mysql_error()); while ($year = mysql_fetch_array($result)) { echo "<option value='$year[name]'>$year[name]</option>"; } ?> </select></td> <!--<td><input size="45" maxlenght="10" type="text" id="momob"/> </td>--> <td><input type="button" id="addmore" value="+" onclick="insRow()"/></td> <td align="center"><input type="button" id="delPOIbutton" value="-" onclick="deleteRow(this)"/></td> </tr> </table> <br /><p style="border-bottom: 1px dotted #ccc;"></p><br /> <table border="0px" width="85%"> <tbody><tr> <td width="105"><label class="description">No. of Students</label></td> <td width="65"><input type="text" name=stu" size="5" maxlength="5"></input></td> <td width="105"><label class="description">No. of Batches</label></td><td width="14"><input type="text" name="batch" size="5" maxlength="3"></input></td> </tr> <tr> <input type="submit" name="submit" value="Save"></input> </tr> </tbody> </table> </div> </div> </table> </form> </body> </html> makhtab.php makhproc.php
  15. I am sorry, If I am asking a basic question.. I am working for a project where I need to give a upload and submit option for client. In that client will browse the local path and selects required "EXCEL" file and if they click to submit, then the content should be displayed in the webpage.. these are few codes I went through, but I thought I am not in the right way.. <HTML> <HEAD> <TITLE> PHP File Upload Script </TITLE> </HEAD> <BODY> <?php if( isset($_POST['submit1'])) { // $_FILES is the array auto filled when you upload a file and submit a form. $userfile_name = $_FILES['file1']['name']; // file name $userfile_tmp = $_FILES['file1']['tmp_name']; // actual location $userfile_size = $_FILES['file1']['size']; // file size $userfile_type = $_FILES['file1']['type']; // mime type of file sent by browser. PHP doesn't check it. $userfile_error = $_FILES['file1']['error']; // any error!. get from here // Content uploading. $file_data = ''; if ( !empty($userfile_tmp)) { // We encode the data just to make it more database friendly $file_data = base64_encode(@fread(fopen($userfile_tmp, 'r'), filesize($userfile_tmp))); } switch (true) { // Check error if any case ($userfile_error == UPLOAD_ERR_NO_FILE): case empty($file_data): echo 'You must select a document to upload before you can save this page.'; exit; break; case ($userfile_error == UPLOAD_ERR_INI_SIZE): case ($userfile_error == UPLOAD_ERR_FORM_SIZE): echo 'The document you have attempted to upload is too large.'; break; case ($userfile_error == UPLOAD_ERR_PARTIAL): echo 'An error occured while trying to recieve the file. Please try again.'; break; } if( !empty($userfile_tmp)) { // only MS office and text file is accepted. if( !(($userfile_type=="application/msword") || ($userfile_type=="text/plain") || ($userfile_type=="application/vnd.ms-excel")) ) {echo 'Your File Type is:'. $userfile_type; echo '<br>File type must be text(.txt) or msword(.doc).'; exit; } } echo filesize($userfile_tmp); } echo ?> <form name="profile" method="POST" action="<?php echo $_SERVER['PHP_SELF'] ?>" target="_self" enctype="multipart/form-data" > <P align ="center"><input type="hidden" name="MAX_FILE_SIZE" value="1000000"> <input type="file" name="file1" value="AttachFile" device="files" accept="text/*" tabindex=18 > <input type="submit" name="submit1" value="Submit" /> </P> </form> </BODY> </HTML> from the above code I am getting only file size.. This code will displays the content of excel file but it is a hard coded one, but I need client should select that file and content get displayed in the webpage itself... <?php error_reporting(E_ALL ^ E_NOTICE); require_once 'excel_reader2.php'; $data = new Spreadsheet_Excel_Reader("test.xls"); php echo $data->dump(true,true); ?> Thanks in advance...
  16. I have a search bar attached with html datalist.html datalist updated with php file. when any word is typed it show the related result like as google when you enter any keyword it show the datalist related to this word and you can easily select any vaule for pressing DOWN ARROW KEY but in my search bar when any keyword is enter is show result like google but when press DOWN ARROW KEY it will not select any value because I m using onkeyup javascript event so when you press DOWN ARROW KEY it is also a key and due to onkeyup event datalist show again due to this reason any value does not select. what did I do,can i cannot use onkeyup event if not then what event I use.
  17. I am working on a website with my project mates, in which I need to add a filter dropdown box. When I select one of the option in it, the table being displayed in that webpage will display a different set of data based on the type of data I selected to filter. Also this webpage can only be seen by logging in as a valid user. I am very new to javascript and php programming and after going through several forums, I added the following code as a start to do the filtering, by which the webpage will be able to get the dropdown box option that was selected and display it: <script> function formSubmit() { document.getElementById("report_filter").submit(); } </script> <form method="POST" id="report_filter" action="" > <select name="try" onchange="formSubmit();"> <option value="all">All</option> <option value="Windows">Windows</option> <option value="Win 2008">Win 2008</option> <option value="Win 7">Win 7</option> <option value="Win Vista">Win Vista</option> <option value ="Linux">Linux</option> <option value = "Win 7/Linux">Win 7/Linux</option> </select> </form> <?php if(!(isset($_POST["try"]))) { echo "none"; } else echo $_POST["try"]; ?> The code above works ok when i run that individually in a separate php page, i.e., it ehoes the option that i select in the drop down box. But not so when I add it to the webpage that I am working on, cause when I select an option in the dropdown box the page goes blank and nothing else happens.
  18. I have a site that contains an internal messaging system. I've had users complain that they lost a message they were typing because the navigated away from the page. When this occurs, I'd like to display a custom popup box that I have built (with options, Save, Delete, and Cancel). If save is clicked, it would save a draft then continue to the link the user clicked. If Delete is clicked, it would not save a draft, then continue to the link. If Cancel is clicked, it would go back to the message and allow the user to continue typing. I've played with this option, but it displays the default alert option box. Not desireable. window.onbeforeunload = saveCurrentMessage; My only other thought is to do something like $('a').click(function(){ //cancel the href/onclick from the tag and store in a variable. //display my box. //depending on what the user clicks, Save/Delete would take that action then fire the href and/or onclick, Cancel would just cancel }); NOTE: I don't want to change the a tags on any other page than this, so modifying every link is not an option. Has anyone done this or have any thoughts in this direction? Thanks, Ryan
  19. I don't know the syntax , couldn't find anything similar on the net please help : Code: <script type="text/javascript"> var u=$('#2').find('tbody > tr').size(); <%section name='i' start=0 loop=u%> alert('in loop'); <%/section%> </script>
  20. I have two columns in a table , first column has a select and the second has a list of checkboxes I'm using smarty to get the number of rows of the table from php , then I use a loop in script code to generate onchange event for every select cell in the table , I'm lost with syntax ! what I want that when I change the select options the checkboxes in the second cloumn become readonly or not . depeanding on the select option which has been chosen . when I open the source of the page I find that there's no code generated in the script at all , it's like the smarty code is ignored need your help to fing the error . the script : <script type="text/javascript"> $(document).ready(function() { <%section name='i' start=0 loop=$rows_number%> $('col_order<%$smarty.section.i.index%>').change(function(){ if( $('col_order<%$smarty.section.i.index%>').val=='first') { $("col_list<%$smarty.section.i.index%>_0").attr('selected','y'); $("col_list<%$smarty.section.i.index%>_0").attr('disabled',false); $("col_list<%$smarty.section.i.index%>_1").attr('selected','y'); $("col_list<%$smarty.section.i.index%>_1").attr('disabled',false); } else if( $('col_order<%$smarty.section.i.index%>').val=='second') { $("col_list<%$smarty.section.i.index%>_0").attr('selected','n'); $("col_list<%$smarty.section.i.index%>_0").attr('disabled',true); $("col_list<%$smarty.section.i.index%>_1").attr('selected','n'); $("col_list<%$smarty.section.i.index%>_1").attr('disabled',true); } }); }); <%/section%> </script>
  21. I'm working on a five star voting system for a website and I have very limited knowledge of cookies and javascript for that matter. I'm attempting to limit users to only one vote per instance so I'm guessing I'll need some sort of count and a cookie tracking system that could delete after a couple days. I'm not necessarily worried about people clearing cache as the votes aren't incredibly important but I definitely don't want the ability to keep voting via click. Here is what I've accomplished so far: <script> $(document).ready(function() { $('.rate_widget').each(function(i) { var widget = this; var out_data = { widget_id : $(widget).attr('id'), fetch: 1 }; $.post( 'ratings.php', out_data, function(INFO) { $(widget).data( 'fsr', INFO ); set_votes(widget); }, 'json' ); }); $('.ratings_stars').hover( function() { $(this).prevAll().andSelf().addClass('ratings_over'); $(this).nextAll().removeClass('ratings_vote'); }, function() { $(this).prevAll().andSelf().removeClass('ratings_over'); // can't use 'this' because it wont contain the updated data set_votes($(this).parent()); } ); $('.ratings_stars').bind('click', function() { var star = this; var widget = $(this).parent(); var clicked_data = { clicked_on : $(star).attr('class'), widget_id : $(star).parent().attr('id') }; $.post( 'ratings.php', clicked_data, function(INFO) { widget.data( 'fsr', INFO ); set_votes(widget); }, 'json' ); }); }); function set_votes(widget) { var avg = $(widget).data('fsr').whole_avg; var votes = $(widget).data('fsr').number_votes; var exact = $(widget).data('fsr').dec_avg; window.console && console.log('and now in set_votes, it thinks the fsr is ' + $(widget).data('fsr').number_votes); $(widget).find('.star_' + avg).prevAll().andSelf().addClass('ratings_vote'); $(widget).find('.star_' + avg).nextAll().removeClass('ratings_vote'); $(widget).find('.total_votes').text( votes + ' votes recorded (' + exact + ' rating)' ); } </script>
  22. Hi, I'm working on a new site. And i can't get my code to work properly. I have already made a site with this script and it works just fine, but it will not work on my new site (wordpress with PHP enable). What I need is an alternative to this code (the delete button command): <td><a onclick="return confirmSubmit()" <a href="?slettID=<?php echo $row_persondata2['id']; ?>"><img src="images/Delete-button.bmp" name="Image3" width="45" height="20" border="0" id="Image3" /></a><a href="?slettID=<?php echo $row_persondata2['id']; ?>"></a> <script LANGUAGE="Javascript"> <!-- // Skript for Confirmasjon-delete function confirmSubmit() { var agree=confirm("Er du sikker på at du vil slette denne hendelsen?"); if (agree) return true ; else return false ; } // --> </script> <a href="update.php?oppdaterID=<?php echo $row_persondata2['id']; ?>"><img src="images/Update-button.bmp" width="45" height="20" border="0" /></a></td> </tr> <?php } while ($row_persondata2 = mysql_fetch_assoc($persondata2)); ?> </table> Take a look at my attachment. What i want is a delete button that is asking "are you sure?" and then if i click yes it delete that row from the database. Is there an easy alternative? Thanks!
  23. Guest

    Code Help Requested

    I have some php code that supervisors use to assign work to employees. I've added a field named clerks. There are 10 clerk names in the phpmyadmin database..clerk1, clerk2, clerk3, and so on to clerk10. I need for the clerk names to be automatically added to the clerk field in the form when it is opened..for instance, if the form is opened clerk1 is automatically inserted. And the next time it is opened, clerk2 is inserted until it reaches clerk10 & then starts over by inserting clerk1....is this possible?Like I said, I have a table in the database named clerk_names & the clerk's name is listed in this table. The database name is named flow. Any help will be greatly appreciated. Thanks
  24. Having issue trying to sum list/menu selected values to show on a textbox <!DOCTYPE html> <html> <head> <script type="text/javascript" src="js/jquery.js"></script> <script type="text/javascript" src="js/jquery-1.4.2.js"></script> <style> p { color:red; margin:4px; } b { color:blue; } </style> </head> <body> <p><input name="wal" id="wal" type="text"></p> <p><input type="text" id="total" value="0"></p> <select size="7" multiple="multiple" id="multiple"> <option value="1" selected="selected">Item 1</option> <option value="2">Item 2</option> <option value="3">Item 3</option> <option value="4">Item 4</option> </select> <script> function displayVals() { var multipleValues = $("#multiple").val() || []; $("#wal").val( multipleValues.join("+ ")); var total =($('#wal').val()); // Update the total var postid=total.split("+"); var sum = 0; //iterate through each textboxes and add the values $("#wal").each(function() { //add only if the value is number if(!isNaN(this.value) && this.value.length!=0) { sum += parseFloat(this.value); } }); //.toFixed() method will roundoff the final sum to 2 decimal places $("#total").html(sum.toFixed(2)); } $("select").change(displayVals); displayVals(); </script> </body> </html> Can anyone help with this please
  25. I am having an issue getting the values checked in the check-box. I have tried to clean up the code. I can get the all the selected check-boxes selected (but not per row) or i can get the check-box id per row but not the selected value. I am pretty sure I can transfer the values to the another page but do not know how to get them. Any assistance here would greatly be appreciated! //php variables used $pages = 2 $size = 4 < form id="form" name="cb"> < div style=" width:800px; height:500px; overflow:auto"> < h2>Select Editions</h2> < table id='table' name='table' border=1 cellpadding=7 width=50% height=50% align='center'>\n for($x = 1; $x <= $pages; $x++) : print "<td id='page_$x' class='page_button' align='center' custom='0' >Page $x - "; for($i = 1; $i <= $size; $i++) : print "<input type='checkbox' class='ebutton' id='etype_$x' name='checks[]' value='$i' /> $i"; endfor; </td> </tr> endfor; with this as the Javascript $(document).ready(function() { $(".ebutton").change(function() { var idp = $(this).attr("id").split("_"); var page_num = idp[1]; // I need to find out how to get the checkboxes that are checked per row. Ex: 01,02 //var editions = ?; //alert(editions); var hidden_id = "#etype_page_" + page_num; if($(hidden_id).length < 1) { $("#base").append('<input type="hidden" id="etype_page_'+ page_num +'" name="'+ page_num +'" value="'+ editions +'" class="hidden_edtype" custom="' + editions +'">'); } else { $(hidden_id).val($(this).val()); } update_eShow(); }); }); function update_eShow() { $("#eShow").html(''); $(".hidden_edtype").each(function() { var page = $(this).attr("name"); var value = $(this).attr("custom"); $("#eShow").append('page:' + page + ' values:' + value +'<br>'); }); } page looks like this: | Page 1 - []1 []2 []3 []4 | | Page 2 - []1 []2 []3 []4 | Here is what I have been able to get, but its not right: I select both 01 and 02 for page 1 and only 01 for page 2. My results are: Page:1 Values: 01 Page:2 Values: 01,02,01
×
×
  • 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.