JavaScript - Help With Sending Data Via Showprompt Function
I m trying to send data to my database (Mysql). When I enter things in the prompt box it doesn t go to my database.
Can someone tell me why, please? Here is my code: <script type="text/javascript"> function show_prompt() { var name=prompt("question"); if (name!=null && name!="") { //set the hidden input value to the value entered in the prompt document.input.purpose.value = name; //document.input referring to the form named 'input' document.input.submit(); //submit the form } } </script> <form id="propose" name="input" action="insertpropose.php" method="post"><br/> <input type="submit" onclick="show_prompt()" value="propose" /> <input type="hidden" name="propose" value=""> </form> and the insertpropose.php form is: $propose=$_POST['propose']; mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query = "INSERT INTO propose VALUES ('','$propose')"; mysql_query($query); mysql_close(); Similar TutorialsHi there How to send data from a text feild in GET method using an AJAX call... I already have codes working Code: to = "interfaces/add_department.jsp"; parm = "name="+name.value+ "&name2="+name2.value; alert(parm) post(to,parm,callBackFunctionForAddDepartment); Here the variable name may have "me&you" or "me you" like that.... so how do i encode it so that it reaches properly? All, Trying to append data from an API to the frame source; not loading. master page: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" language="javascript" name="mm_scormRTI" > <!-- Inserted by: // SCORM Runtime Wrapper // version 1.2.6 09/09/02 // Copyright 2000, 2001, 2002 Macromedia, Inc. All rights reserved. // ---------------------------------------------------- // define global var as handle to API object var mm_adl_API = null; // mm_getAPI, which calls findAPI as needed function mm_getAPI() {blah} // returns LMS API object (or null if not found) function findAPI(win) {bleh } // call LMSInitialize() function mm_adlOnload() {do api stuff- this is where i get ny value } // get the API, launch it mm_getAPI(); // --> </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DCB Document</title> </head> <body onLoad="mm_adlOnload()">this is a test;</p></p></p> <iframe src="blank.htm" width="100%" height="800" id="qualtrics" name="qualtrics"> <p>Your browser does not support iframes.</p> </iframe> </p></p> <input type="button" name="mm_finishBtn" value="Finish Lesson" onClick="mm_adlOnunload()" /> </body> </html> blank.htm: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" language="javascript"> //test function loadit(){ var stud = window.opener.mm_adl_API.LMSGetValue("cmi.core.student_id"); var newlink = "https://mylink.com/stud_id=" + stud; parent.document.getElementById("qualtrics").src=newlink; } // --> </script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>DCB meta Document</title> </head> <body onLoad="loadit()">this is a test iframe</p></p></p> </body> </html> help? i'm kind of dizzy right now since i've tried X different versions...still working on it. the new URL doesnt load i want to get the stud_id from the API and append it to the url that i launch in the iframe Hey All, I've been fighting this one for a few months now, and it is causing me to have to create multiple functions that basically do the same thing. I am using the three functions below to replace text between two div tags on a page, based on a link that is clicked: Code: <td><a href=\"javascript:void(0)\" onclick=\"htmlData('ajax/loginContent.php', 'view=1','data=2','displayField=txtResult')\">Active Jobs</a></td>\n"; Then further down the page: Code: <div id="txtResult">replace this content</div> For some reason, I CANNOT send the div id name as a js variable. When I do it errors out. BUT if I replace displayField in the js functions below with "txtResult" it works fine. I am fairly new to js, so it is definitely possible that I am doing something incorrectly. Anyone have any ideas for me? Code: function GetXmlHttpObject(handler) { var objXMLHttp=null if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest() } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP") } return objXMLHttp } function stateChanged(displayField){ if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") { document.getElementById(displayField).innerHTML= xmlHttp.responseText; } else { //alert(xmlHttp.status); } } // Will populate data based on input function htmlData(url, qStr, qStr2,displayField){ if (url.length==0) { document.getElementById(displayField).innerHTML=""; return; } xmlHttp=GetXmlHttpObject() if (xmlHttp==null) { alert ("Browser does not support HTTP Request"); return; } url=url+"?"+qStr; if(qStr2) url=url+"&"+qStr2; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged(displayField); xmlHttp.open("GET",url,true) ; xmlHttp.send(null); } Hi, I have a problem with sending data from a form to a php script with AJAX. To test if it works, I try to send data from the form, print it in the php with "echo", and then put it back in the initial html file. My Javascript code is: Code: function registerPrivateUser() { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support AJAX!"); return; } var postData="firstName="+ document.getElementById("txtFirstName").value; var url="classes/users/checkRegistration.php"; xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("POST",url,true); //xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8"); xmlhttp.send(postData); } The function stateChanged, basically says: Code: if (xmlhttp.readyState==4) { var strResponse; strResponse=xmlhttp.responseText; alert('Response:' + xmlhttp.responseText); } checkRegistration.php looks like this: PHP Code: <? session_start(); $firstName=$_POST['firstName']; echo($firstName); ?> The problem is that the response is empty, but I don't know why. I have checked the input data and the postData variable says "firstName="+input (e.g. "firstName=Robert"), so that's not the error. I have read several forum posts here, but still haven't figured out what I'm doing wrong. If anyone could please tell me, I would appreciate it alot. You've probably seen this many times with two dynamic linking select boxes that deals in form or another deal with countries and then cities for the second one or something similar well I have another question about that. I've looked at a few others and well their coding is so different then mine that I don't want to use code for my own project that I don't understand in case I need to reuse it for some other reason down the road. The user selects a country and with the users selection it passes the countryid as a variable through jquery's ajax fuction as a post parameter to a php process page in which it goes to a table and matches the country id with the db field called country_id in the arenas table. With all the records that matches that countryid it selects the arena name and city that the arena is in and displays it as an option tag now I'm trying to figure out with muliple entries how can I pass the results back to the form page and insert it into the arenas dropdown box. Following is my coding separated out for you. I only included the necessary parts. All help would be greatly appreciated. form page Code: $('#countryid').change(function() { var countryid = $("select#countryid").val(); var dataString = 'countryid='+ countryid; $.ajax({ type: "POST", url: "processes/booking.php", data: dataString, success: function() { } }); }); <div class="field required"> <label for="countryid">Country</label> <select class="dropdown" name="countryid" id="countryid" title="Country"> <option value="0">- Select -</option> <?php $query = 'SELECT id, countryname FROM countries'; $result = mysqli_query ( $dbc, $query ); // Run The Query while ( $row = mysqli_fetch_array ( $result, MYSQL_ASSOC ) ) { print "<option value=\"".$row['id']."\">".$row['countryname']."</option>\r"; } ?> </select> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <div class="field required"> <label for="arena">Arenas</label> <select class="dropdown" name="arenas" id="arenas" title="Arenas"> </select> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> php process page PHP Code: $countryid = (int)$_GET['countryid']; $query = "SELECT * FROM `arenas` WHERE `country_id` = '$countryid'"; $result = mysqli_query ($dbc, $query); while ($row = mysqli_fetch_array($dbc, $result)) { echo '<option value="'.$row['arena'].'">'.$row['arena'].' - '.$row['city'].'</option>\n'; } Hi, Can anyone tell me How to send values from application resources.properties file to a java script function in a jsp Thanks in Advance, John Ven Hi, Any one help me In one variable i have some data ex: var data = document.getElementById("imageId").value; I want to pass this data to another function inside another function ex: var button1 = '<img src="images/Remove-button.gif" width="70" height="15" onclick="removeVerifyImageRow(this),saveLibData('+data+')"/>'; while running the application i am getting an error incase if the data is string ex:if data is 'image1' i am getting an error, but with number there is no problem ex: if data is '1122'. this is very urgent to solve this problem plz any one help me Hi there everybody, I've got this problem which I can't solve myself... I've got a website which has 3 colums and is hosted on domain1.com. in the right column I've got an Iframe which loads content from domain2.com . this content are some textboxes and a datepicker tool. if I press the 'search'-button in this Iframe I would like to refresh the mainpage (from domain1.com) so that another Iframe appears in the middle column. in this column i would like to load a new form from domain2.com which contains the values that I've put in in the form from the right Iframe. Unfortunally I can't get this to work... Will somebody please help me? overview: from my javascript, i call a function in the php block, that function successfully retrieves a value from the database, but when i pass that retrieved value back to the calling function....all is lost somehow. when i test this code by itself, it works fine and gets the correct number. <?php mysql_select_db($database_connFtH, $connFtH); $result = mysql_query("SELECT status_index FROM cpqc_status ORDER BY row_id DESC"); $row_result = mysql_fetch_assoc($result); $index = $row_result['status_index']; echo $row_result['status_index']; echo $index; echo "the value of index is ".$index; ?> however, when i set this same code up as a function to be called upon globally, and to return the value of $index, it all just seems to "not work". <?php function runStatus() { mysql_select_db($database_connFtH, $connFtH); $result = mysql_query("SELECT status_index FROM cpqc_status ORDER BY row_id DESC"); $row_result = mysql_fetch_assoc($result); $index = $row_result['status_index']; return ($index); } //end function runStatus() ?> the calling function, with an alert box to check if the value of $index was passed down accurately <script type="text/javascript"> var x = runStatus(); alert(x); </script> all i want to do is call a server-script function that deals with the database and gets me a value out of the database, and pass that value back to the calling function. can't figure out what is wrong. the "return($index)" should send back the value of $index. the call to that function should receive back a value and assign it to "x". and the alert(x) should spit it out with no problem. but......something is wrong and it won't work. any ideas what is wrong? it is my understanding that a function inside the php determants can be called upon from anywhere and that function can return a value.(?) argh!! i think i know why Einstein's hair was always so messy!! thanks, Paul Williams weather today in Kalispell, MT: 7 deg this morning, got a little snow last night, only about 6 or 8 inches, not much. maybe more later. Hey all i am in need of some help trying to figure out how to pass a string into an array field for a chart. The chart i am using is this [http://www.highcharts.com/] Here is the chart code: Code: function drawChart(theDATA) { var chart = new Highcharts.Chart({ chart: {renderTo: 'container',defaultSeriesType: 'column'}, title: {text: 'March 2010 Confirmed User Visit\'s'}, xAxis: {categories: ['1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31']}, yAxis: {min: 0,title: {text: 'User Visit\'s'}}, legend: {layout: 'vertical',backgroundColor: '#FFFFFF',style: {left: '100px',top: '70px',bottom: 'auto'}}, tooltip: {formatter: function() {return this.y;}}, plotOptions: {column: {pointPadding: 0.2,borderWidth: 0}}, series: [{name: 'Confirmed Users Visit\'s', data: theDATA.split(',') }] }); } With the code above, you would think that theDATA would work but it does not display the data within it. Say that theDATA is '2,5,4,7,8,9'. If i had this: Code: data: [2,5,4,7,8,9] Then it would work just fine. But if i use those same numbers... Code: theData = "2,5,4,7,8,9" data: theDATA.split(',') It does nothing on the chart... So what am i doing wrong???? David Scenario: Client Side : Simple functions that have events tied to different elements. Each time an event is triggered the function begins an Ajax call to an external server side page filled with JS functions. Server Side : Our client side AJAX call sends the name of the function we want to call out on this file. Once called and performed, it returns DOM edits that could be fired once our client side page receives the data back from Ajax. I know that data being returned from Ajax is always a string. But would it be possible? I mean could the server side file send out commands or rather DOM edits that the client side could pick up on and perform? I am almost 100% certain the answer is no due to JS needing to be cached in the browser and what not, but I figured I would ask the experts anyways. BTW: objective is to move sensitive core JS functions to prevent online application theft... without Flex or Air. Hi, i'm having a problem with calling a netbeans function through an URL, that saves data to a postgresql table that has 119 columns. This is the original link: Code: http://www.mirodinero.com:8080/mirodinero-war/setMisDatos?callback=respuestaGuardarMisDatos¶m=%26usuario%3DIsa%20Mirodinero%26nivel%3D109%26gano_sal_neto%3D211113.45%26gano_sal_prof%3D2480%26gano_monet%3D0%26gano_renta_fija%3D0%26gano_renta_vble%3D0%26gano_inmuebles%3D2226.75%26gano_otros%3D2223.73%26gano_otros_ing%3D2411.12%26porc_gano_monet%3D0%26porc_gano_rentaf%3D0%26porc_gano_rentav%3D0%26porc_gano_inm%3D2%26porc_gano_otros%3D2%26porc_gano_otros_ing%3D1%26gasto_casa1%3D1306.46%26gasto_casa2%3D2402.38%26gasto_casa3%3D3999.57%26gasto_prestamo1%3D93475.58%26gasto_prestamo2%3D7325.88%26gasto_prestamo3%3D34090.9%26gasto_tarjetas%3D29443.2%26gasto_ibi%3D5670%26gasto_imp_otros%3D6780%26gasto_seg_inm%3D1320%26gasto_seg_pens%3D3451.22%26gasto_seg_vida%3D2330%26gasto_seg_plan%3D34230%26gasto_seg_medico%3D21220%26gasto_seg_coche%3D220%26gasto_luz%3D620%26gasto_agua%3D4550%26gasto_gas%3D320%26gasto_telef_f%3D22320%26gasto_telef_m%3D2350%26gasto_internet%3D20%26gasto_tv%3D3450%26gasto_hogar%3D20%26gasto_comida%3D20%26gasto_cenas_copas%3D20%26gasto_viajes%3D20%26gasto_vacaciones%3D220%26gasto_mobiliario%3D220%26gasto_ropa%3D2320%26gasto_transp%3D230%26gasto_otros%3D3620%26gasto_colegios%3D240%26gasto_univ%3D340%26gasto_master%3D2230%26gasto_otros_gastos%3D7323433%26porc_gasto_tarjetas%3D0%26porc_gasto_ibi%3D0%26porc_gasto_trib%3D0%26porc_gasto_seg_inm%3D0%26porc_gasto_seg_pens%3D0%26porc_gasto_seg_vida%3D2%26porc_gasto_seg_plan%3D2%26porc_gasto_seg_med%3D0%26porc_gasto_seg_coche%3D0%26porc_gasto_sum_luz%3D2%26porc_gasto_sum_agua%3D2%26porc_gasto_sum_gas%3D0%26porc_gasto_sum_teleff%3D0%26porc_gasto_sum_telefm%3D0%26porc_gasto_sum_int%3D0%26porc_gasto_sum_tv%3D0%26porc_gasto_nivel_hogar%3D0%26porc_gasto_nivel_comida%3D0%26porc_gasto_nivel_cenas%3D0%26porc_gasto_nivel_viajes%3D0%26porc_gasto_nivel_vacac%3D0%26porc_gasto_nivel_mob%3D0%26porc_gasto_nivel_ropa%3D20%26porc_gasto_nivel_transp%3D30%26porc_gasto_nivel_otros%3D30%26porc_gasto_colegios%3D2%26porc_gasto_univ%3D0%26porc_gasto_master%3D0%26porc_gasto_otros_gastos%3D23%26tengo_casa1%3D1231.11%26tengo_casa2%3D10000%26tengo_casa3%3D22240%26tengo_otras%3D23560%26tengo_monetario%3D1212.34%26tengo_planpensiones%3D23230%26tengo_otros%3D23330%26porc_tengo_casa1%3D1%26porc_tengo_casa2%3D0%26porc_tengo_casa3%3D2%26porc_tengo_otras%3D0%26porc_tengo_monet%3D0%26porc_tengo_plan%3D0%26porc_tengo_otros%3D0%26debo_casa1%3D4340%26debo_casa2%3D23450%26debo_casa3%3D23430%26debo_prestamo1%3D23330%26debo_prestamo2%3D6871.11%26debo_prestamo3%3D11340%26debo_tarjetas%3D61340%26porc_debo_casa1%3D30%26porc_debo_casa2%3D10%26porc_debo_casa3%3D12%26porc_debo_prestamo1%3D1%26porc_debo_prestamo2%3D12%26porc_debo_prestamo3%3D1%26porc_debo_tarjetas%3D4%26plazo_debo_casa1%3D230%26plazo_debo_casa2%3D450%26plazo_debo_casa3%3D122%26plazo_debo_prestamo1%3D3%26plazo_debo_prestamo2%3D12%26plazo_debo_prestamo3%3D4 It's 2568 characters long, so i guess that's why i get sometimes a GET undefined method in the web console. The original function does something like this: Code: var param ="&usuario="+usuario+"&nivel="+nivel+gano+porc_gano+gasto+porc_gasto+tengo+porc_tengo+debo+porc_debo+plazo_debo; var s = document.createElement("script"); s.type = "text/javascript"; s.async = true; s.src = server_direction +"setMisDatos?callback=respuestaGuardarMisDatos¶m="+encodeURIComponent(param); var h = document.getElementsByTagName("script")[0]; h.parentNode.insertBefore(s, h); //or h.appendChild(s); and every variable in the param is written like this: Code: var plazo_debo_casa1 = (getValor("plazo_debo_casa1")); var plazo_debo_casa2 = (getValor("plazo_debo_casa2")); var plazo_debo_casa3 = (getValor("plazo_debo_casa3")); var plazo_debo_prestamo1 = (getValor("plazo_debo_prestamo1")); var plazo_debo_prestamo2 = (getValor("plazo_debo_prestamo2")); var plazo_debo_prestamo3 = (getValor("plazo_debo_prestamo3")); var plazo_debo ="&plazo_debo_casa1="+plazo_debo_casa1+"&plazo_debo_casa2="+plazo_debo_casa2+"&plazo_debo_casa3="+plazo_debo_casa3+"&plazo_debo_prestamo1="+plazo_debo_prestamo1+"&plazo_debo_prestamo2="+plazo_debo_prestamo2+"&plazo_debo_prestamo3="+plazo_debo_prestamo3; since my webpage has different parts where to put the data, i thought that a good idea would be to create smaller function for parts of variable, for example putting 30 variables and the do the callback. I did like this: Code: function guardaLoQueGano(){ var nivel = parseInt(document.getElementById('progreso_nivel_total').style.marginLeft); /*idUsusario*/ var usuario = miGetElementsByClassName('title', document.getElementById('block-user-1'))[0].innerHTML; /*gano*/ var gano_sal_neto = getValor("gano_sal_neto"); var gano_sal_prof = getValor("gano_sal_prof"); var gano_monet = getValor("gano_monet"); var gano_renta_fija = (getValor("gano_renta_fija")); var gano_renta_vble = (getValor("gano_renta_vble")); var gano_inmuebles = (getValor("gano_inmuebles")); var gano_otros = (getValor("gano_otros")); var gano_otros_ing = (getValor("gano_otros_ing")); /*gano porcentajes*/ var porc_gano_monet = getValor("porc_gano_monet"); var porc_gano_rentaf = getValor("porc_gano_rentaf"); var porc_gano_rentav = getValor("porc_gano_rentav"); var porc_gano_inm = getValor("porc_gano_inm"); var porc_gano_otros = getValor("porc_gano_otros"); var porc_gano_otros_ing = getValor("porc_gano_otros_ing"); var param = "&usuario=" + usuario + "&nivel=" + nivel + "&gano_sal_neto=" + gano_sal_neto + "&gano_sal_prof=" + gano_sal_prof + "&gano_monet=" + gano_monet + "&gano_renta_fija=" + gano_renta_fija + "&gano_renta_vble=" + gano_renta_vble + "&gano_inmuebles=" + gano_inmuebles + "&gano_otros=" + gano_otros + "&gano_otros_ing=" + gano_otros_ing + "&porc_gano_monet=" + porc_gano_monet + "&porc_gano_rentaf=" + porc_gano_rentaf + "&porc_gano_rentav=" + porc_gano_rentav + "&porc_gano_inm=" + porc_gano_inm + "&porc_gano_otros=" + porc_gano_otros + "&porc_gano_otros_ing=" + porc_gano_otros_ing; var s = document.createElement("script"); s.type = "text/javascript"; s.async = true; s.src = direccion_servidor + "setMisDatos?callback=respuestaGuardarMisDatos¶m=" + encodeURIComponent(param); var h = document.getElementsByTagName("script")[0]; // adesso h.appendChild(s); h.parentNode.insertBefore(s, h); alert("Datos de lo que gano actualizados correctamente"); } This kind of function works perfectly, but has a big problem: it changes the values of the columns of this function, but deletes the remaining ones. How can I create different smaller function, in a way to save only on some columns without changing the others? Shall I write the netbeans function setMisDatos to make it more clear? seems easy yet frustrating trying to learn how. i set up a column in the MySql database that holds an integer, lets call it IMG_INDEX; easy enough. in my prgm.php, i need to use the values stored in IMG_INDEX (in the database) to contol which image is currently displayed in the browser. i need to be able to update to value of IMG_INDEX in the database from the code. i need to be able to retrieve the value of IMG_INDEX from the database with the code. note: this is NOT a user input thing, or a display of database info thing. i'm using IMG_INDEX as a switch to control which image is displayed at different times during a web browing session. ?? so here is the question ?? how do i send a new integer (like 2) to the database and store it in IMG_INDEX ? how do i retrieve the value of IMG_INDEX from the database ? i need to do this all from the javascript area in the head of the php code, and occasionally from the body area of the php code. if you have a tip, i'd really appreciate your help. thank you, Paul Williams todays weather in Kalispell, MT COLD i say again COLD, COLD, COLD. brrrrrrrrrrrr HI All, I am using triple ajax dropdwon in my php file.In my form i have species_scientifc_name & on select I am sending its id to a php file for retriving data for second dependent dropdown box, Here I need to get this id in form action file. How to get this value, Any idea? Thnaks in Advance!! hello, can someone please show me why only one of the following functions work. I have one form with 2 different inputs where the text should at the same time as typing, be automatically be entered into two other divs thx Code: function redundantTextInstall(input,idArr) { var i = 0, val = input.value; while (idArr[i]) { document.getElementById(idArr[i]).innerHTML = val; i++; } } function installtext(input,idArr) { var o = 0, val = input.value; while (idArr[o]) { document.getElementById(idArr[o]).innerHTML = val; o++; } } window.onload = function () { document.someForm.os2.onkeyup = function () { var ids = ['addsx1', 'addsx2', 'addsx3', 'addsx4', 'addsx5', 'addsx6', 'addsx7', 'addsx8', 'addsx9', 'addsx10']; redundantTextInstall(this,ids); }; }; window.onload = function () { document.someForm.os3.onkeyup = function () { var abs = ['addsA', 'addsB', 'addsC', 'addsD', 'addsE', 'addsF', 'addsG', 'addsH', 'addsI', 'addsJ']; installtext(this,abs); }; }; Hi can someone modify this script so the key '1' will send the ENTER command. It's a script for an app to control my computer from my phone. So far the middle button and the number 5 send left click. 0 sends the right click. When you press the left soft key it opens the text input to send to the computer. but as it stands there is no way to then press enter. If someone could do that for me that would be great. Or at least show me how.. thanks var leftDown = false; var rightDown = false; var leftLocked = false; var rightLocked = false; var acceleration_factor = 1; var widget = CreateKeypadScreen( "myKeypad_" ); widget.title = "Mouse Pointing"; if( theTerminal.supportsPen ) { widget.CreateRow("Use the blank area like you'd use a trackpad; use up/down to scroll.", scCenter, scWrap, scSmall); } else { widget.CreateRow("Use the directional controls.", scCenter, scWrap, scSmall); } widget.sendsPenEvents = true; widget.keyRepeatInterval = 0.001; widget.keyRepeatDelay = 0.2; theTerminal.Push(widget); function myKeypad_Exit(theScreen) { if( leftDown ) { leftDown = false; SendMouseEvent(0, 0, 0, 1, 0); } if( rightDown ) { rightDown = false; SendMouseEvent(0, 0, 0, 0, 1); } } function showSearchable() { var textField = CreateTextFieldDialog( "textToPrintOnComputer_"); textField.name = "Text to show on computer"; textField.title = "Text to show on computer"; textField.prompt = "Write text to show on computer:"; textField.value = ""; textField.maxLength = 0; theTerminal.Push(textField); theTerminal.Push(textField) } function textToPrintOnComputer_OK(textField) { convertToUnicodeAndSend(textField.value); } function convertToUnicodeAndSend(incomingText) { var theText = incomingText; var toUnicode = ""; for(var i=0;i<theText.length;i++) { toUnicode = theText.charCodeAt(i); SendUnicodeKeystroke(toUnicode); } } function myKeypad_KeyDown(theScreen, theKey) { if(theKey == "f") { showSearchable(); } else if( theKey == "<") { SendVirtualKeystroke( 0x08, true, false, false, false ) ; } //what does this line actually do? //if( handleKeyMove( theKey ) ) return; else if( theKey == "s" || theKey == "5" ) { if( ! leftDown ) { leftDown = true; SendMouseEvent(0, 0, 0, -1, 0); } if( leftLocked ) { SendMouseEvent(0, 0, 0, 1, 0); leftLocked = false; leftDown = false; ShowMessage("Left button unlocked"); } if( rightLocked ) { SendMouseEvent(0, 0, 0, 1, 0); rightLocked = false; rightDown = false; ShowMessage("Right button unlocked"); } } else if( theKey == ">" || theKey == "0" ) { if( ! rightDown ) { rightDown = true; SendMouseEvent(0, 0, 0, 0, -1); } if( rightLocked ) { SendMouseEvent(0, 0, 0, 1, 0); rightLocked = false; rightDown = false; ShowMessage("Right button unlocked"); } if( leftLocked ) { SendMouseEvent(0, 0, 0, 1, 0); leftLocked = false; leftDown = false; ShowMessage("Left button unlocked"); } } } function myKeypad_KeyRepeat(theScreen, theKey) { if( handleKeyMove( theKey ) ) { acceleration_factor += 0.05; return; } if( theKey == "s" || theKey == "5" ) { if( leftDown && ! leftLocked ) { leftLocked = true; ShowMessage("Left button locked"); } } else if( theKey == ">" || theKey == "0" ) { if( rightDown && ! rightLocked ) { rightLocked = true; ShowMessage("Right button locked"); } } } function myKeypad_KeyUp(theScreen, theKey) { acceleration_factor = 1; if( theKey == "s" || theKey == "5" ) { if( leftDown && ! leftLocked ) { leftDown = false; SendMouseEvent(0, 0, 0, 1, 0); } } else if( theKey == ">" || theKey == "0" ) { if( rightDown && ! rightLocked ) { rightDown = false; SendMouseEvent(0, 0, 0, 0, 1); } } } function myKeypad_PenTap(theScreen) { if( leftLocked ) { SendMouseEvent(0, 0, 0, 1, 0); leftLocked = false; leftDown = false; ShowMessage("Left button unlocked"); } else { if( ! leftDown ) { SendMouseEvent(0, 0, 0, -1, 0); } SendMouseEvent(0, 0, 0, 1, 0); leftDown = false; } } function myKeypad_PenLock(theScreen) { if( ! leftDown && ! leftLocked ) { SendMouseEvent(0, 0, 0, -1, 0); leftDown = true; leftLocked = true; ShowMessage("Left button locked"); } } function accelerate(v) { if( v > 8 || v < -8 ) { return v*4 } else if( v > 4 || v < -4 ) { return v*2 } return v; } function myKeypad_PenMove(theScreen, dx, dy) { dx = accelerate(dx); dy = accelerate(dy); SendMouseEvent(dx, dy, 0, 0, 0); } function handleKeyMove( theKey ) { var dx = 0; var dy = 0; var scroll = 0; if( theTerminal.supportsPen ) { if( theKey == ">" || theKey == "6" ) { dx = 1; } else if( theKey == "<" || theKey == "4" ) { dx = -1; } else if( theKey == "v" || theKey == "d" || theKey == "8" ) { scroll = -1; } else if( theKey == "^" || theKey == "u" || theKey == "2" ) { scroll = 1; } else if( theKey == "1" ) { dx = -1; dy = -1; } else if( theKey == "3" ) { dx = 1; dy = -1; } else if( theKey == "7" ) { dx = -1; dy = 1; } else if( theKey == "9" ) { dx = 1; dy = 1; } else { return false; } } else { if( theKey == ">" || theKey == "6" ) { dx = 1; } else if( theKey == "<" || theKey == "4" ) { dx = -1; } else if( theKey == "v" || theKey == "d" || theKey == "8" ) { dy = 1; } else if( theKey == "^" || theKey == "u" || theKey == "2" ) { dy = -1; } else if( theKey == "1" ) { dx = -1; dy = -1; } else if( theKey == "3" ) { dx = 1; dy = -1; } else if( theKey == "7" ) { dx = -1; dy = 1; } else if( theKey == "9" ) { dx = 1; dy = 1; } else { return false; } } if( dx != 0 || dy != 0 ) { SendMouseEvent(dx*acceleration_factor, dy*acceleration_factor, 0, 0, 0); } if( scroll != 0 ) { SendMouseEvent(0, 0, scroll, 0, 0); } return true; } Hello to all! Can I have 2 variables upon one select? The code below is created dinamicly with php from a database, and displays a dropdown select box, the only thing is that the values: Oliver Franchis, Pedro pastor, Maria China... have unique ID's and when the name is selected I would like the ID allso to be. Code: <!-- Populate list with friends START--> var newTextbox = document.createElement('select'); newTextbox.className = 'fn-select'; newTextbox.name = "opcion"; //First user in the populated select menu is the person Loged in var op1 = new Option("", "Oliver Franchis"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Me | Oliver Franchis'); op1.appendChild(txt1); //Next users are my friends in the database var op1 = new Option("", "Pedro pastor"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Pedro pastor'); op1.appendChild(txt1); var op1 = new Option("", "Maria China"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Maria China'); op1.appendChild(txt1); var op1 = new Option("", "Juan Testing"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Juan Testing'); op1.appendChild(txt1); var op1 = new Option("", "Carmen Hernandez"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Carmen Hernandez'); op1.appendChild(txt1); var op1 = new Option("", "Eduardo Palote"); newTextbox.appendChild(op1); var txt1 = document.createTextNode('Eduardo Pajote'); op1.appendChild(txt1); editAreaText.appendChild(newTextbox); editArea.appendChild(editAreaText); <!-- Populate list with friends END--> This is the function on the index.php page: Code: function saveNote (note) { resetAjax(); var photoId = note.container.element.id; ajax.setVar('action', 'save'); ajax.setVar('photo_id', photoId); ajax.setVar('note_id', note.id); ajax.setVar('left', note.rect.left); ajax.setVar('top', note.rect.top); ajax.setVar('width', note.rect.width); ajax.setVar('height', note.rect.height); ajax.encVar('text', note.gui.TextBox.value); ajax.runAJAX(); var statusDiv = document.getElementById('PhotoNoteStatus'); ajax.onCompletion = function () {statusDiv.innerHTML = "<p>Note saved.</p>"; } return 1; } Hi, I have a script that has a form and i need it to send to an email address. The send button has an onclick with send() as its action, the js file has a send function but no way of inputting an email address, I though of adding .submit() or .post() jquery items but I am having trouble. Basically the script was given to me as is because there was no need for it and i wanted to get it to work. an suggestions or ideas? regards! I cannot figure out how to return the array back to the main method! what am I doing wrong?? import java.util.*; //lab 3 public class Prices { public static void main(String[] args) { double []array; array = new double[10]; double fullPrice; fullPrice = fillPrices(array); System.out.println("testing"); } public static double fillPrices(double []tenValues) { Scanner input = new Scanner(System.in); double prices; System.out.println("Please enter 10 prices: "); for (int i = 0; i < 10; i++) tenValues[i] = input.nextDouble(); return tenValues; } } I thought you return an array by simply return (array name); Am i missing something? Thanks a bunch for whoever takes the time to help me! anyone know a script or way to change images based on radio button on another page or way to send value or src of an image to another page and way to have it show up.
|