JavaScript - Passing Form Input Data From One Page To Another W/o Control Of The Receiving Pag
Hey guys,
I've been searching for a few hours and haven't been able to find a code snippet to see if this is available. I'm attempting to pass text from my website to another website that has a form setup on it. I'd like to fill in the pertinent data for my users on the page that I load for them. I cannot make any changes to the receiving page as it is run by another company. I've pasted some of the code that is available on the receiving form. Thanks for any help. Code: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) { theForm = document.form1; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </script> <input name="txtBranch" type="text" maxlength="4" id="txtBranch" tabindex="1" style="height:14px;width:35px;" /> <input name="txtClient" type="text" maxlength="11" size="11" id="txtClient" tabindex="2" style="height:14px;" /> Im trying to fill in the data in these 2 input fields. Similar Tutorialshi there, i'm new here and pretty new to js. i'm making a page for my daughter's school - or trying to. they are having a silent auction and i'm trying to make a very simple bidding page. where i'm running into problems is passing the bid to a text box (read only) where it can be updated when a new bid is entered. I would like this to be in the upper part of the page with the listings of the auction items, i just can't wrap my head around how to do this. I've gotten as far as the form for entering the bod and contact info. I have the php code to submit. i still have to get the validation js to make it more secure. thanks for any help. Code: <html> <body> <h1 id="logo"></h1> <div id="main"> <p> <h4>Silent Auction</h4> <form name="auction" method="post" action="send_form_email.php" > <label for="item1">Item 1</label> <br /> <label for="curr_bid_item_1">Current Bid = </label><br /> Your Bid = <input type="text" name="item1" maxlength="15" size="10" /> <br /> <br /> <label for="item2">Item 2</label><br /> <label for="curr_bid_item_2">Current Bid = </label><br /> Your Bid = <input type="text" name="item2" maxlength=="15" size="10" /> <br /> <br /> <label for="item3">Item 3</label><br /> <label for="curr_bid_item_3">Current Bid = </label><br /> Your Bid = <input type="text" name="item3" maxlength="15" size="10" /> <br /> <br /><br /><br /> <form name="contactform" method="post" action="send_form_email.php" onsubmit="document.getElementById('myButton').disabled=true; document.getElementById('myButton').value='Submitting, please wait...';"> <label for="first_name">First Name *</label> <input type="text" name="first_name" maxlength="50" size="30"><br /><br /> <label for="last_name">Last Name *</label> <input type="text" name="last_name" maxlength="50" size="30"><br /><br /> <label for="email">Email Address *</label> <input type="text" name="email" maxlength="80" size="30"><br /><br /> <label for="telephone">Telephone Number</label> <input type="text" name="telephone" maxlength="30" size="30"><br /><br /> <label for="comments">Comments</label><br /> <textarea name="comments" maxlength="1000" cols="40" rows="6"></textarea><br /><br /> <input type="submit" value="Submit" id="myButton" /> </form> </form> </div> </body> </html> I have a "pre-order" opt-in page disguised as a "step 1" in the order process of a clickbank product I'm ready to launch. I'm wanting to pass the user's first name, last name, and email address (built into the optin form) over to the clickbank order page upon submit. Clickbank gives me the data strings you can pass along, but I'm not sure how to properly configure this function or where to place it in my page code. This is the only step I have remaining before I can go live, and it's holding me back. Any suggestions would be extremely helpful. I can provide any code needed for review to assist in getting this wrapped up. Thanks in advance I'm fairly new at this. I'm trying to build a store locator and trying to figure out how to pass an input value from one page to another page. User would input their zipcode or address in a form on one page and the map and locations would be called on another page using the input. I'm using ehound store locator platform (sample - here -> http://www.ehoundplatform.com/api/1....nd-google.html) The map/locator script is this Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Store Locator Demo using FreeHound and Google Maps V.3</title> <style type="text/css"> #map_canvas { height: 400px; width:710px; margin-bottom: 10px; } .addressBox { margin-bottom:10px; } </style> <script type="text/javascript" src="http://www.ehoundplatform.com/api/1.0/proximity.js?key=xz396aw1qe432q1"></script> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false®ion=AU"></script> <script type="text/javascript"> var geocoder; var map; var bounds; var markersArray = []; var infoWindow; var mapCenterLat = '-28.1594'; var mapCenterLon = '135.6456'; function initialize() { geocoder = new google.maps.Geocoder(); var myOptions = { zoom: 4, center: new google.maps.LatLng(mapCenterLat, mapCenterLon), mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); //initialise single info window to show only one at a time infoWindow = new google.maps.InfoWindow(); //improve usability by centering map around search point on zoom in/out google.maps.event.addListener(map, 'zoom_changed', function() { if(mapCenterLat && mapCenterLon) { setTimeout('centerMap(mapCenterLat, mapCenterLon)', 300); } }); } function addMarkerOverlay(location, title, infoBox, image) { var marker = new google.maps.Marker({ position: location, map: map, icon: image }); marker.setTitle(title); google.maps.event.addListener(marker, 'click', function() { infoWindow.setContent(infoBox); infoWindow.open(map, marker); }); markersArray.push(marker); } function deleteOverlays() { if (markersArray) { for (i in markersArray) { markersArray[i].setMap(null); } markersArray.length = 0; } } function searchAroundMe() { deleteOverlays(); bounds = new google.maps.LatLngBounds(); var address = document.getElementById("address").value; geocoder.geocode( { 'address': address}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.setCenter(results[0].geometry.location); //custom marker to mark initial search location var image = new google.maps.MarkerImage('search_location.png', // This marker is 32 pixels wide by 32 pixels tall. new google.maps.Size(32, 32), // The origin for this image is 0,0. new google.maps.Point(0,0), // The anchor for this image is the center of the red circle at 16,16. new google.maps.Point(16, 16) ); addMarkerOverlay(results[0].geometry.location, 'search spot', 'search initiated from here', image); bounds.extend(results[0].geometry.location); var searchLatitude = results[0].geometry.location.lat(); var searchLongitude = results[0].geometry.location.lng(); mapCenterLat = searchLatitude; mapCenterLon = searchLongitude; freeHound = new FreeHound( 'showLocs' ); search = new FH_Search(); search.count = 10; //number of locations to be returned in the result set search.max_distance = 0; //distance limit for proximity search in km, 0 for unlimited //search from a specific point using latitude and longitude of that point search.point = new FH_Location( new FH_LatLon( searchLatitude,searchLongitude ) ); //search.filters = new Array(); //search.filters.push( new FH_SearchFilter('cat_id', 'eq', '177') ); search.create_log = false; freeHound.proximitySearch( search ); } else { alert("Geocode was not successful for the following reason: " + status); } }); } function showLocs(response){ if ( response.error_code ) { alert(response.error_message); } if ( response.record_set ) { //show results in a table var resultsTable = '<table border="1" cellspacing="0" cellpadding="3" summary="">'; resultsTable += '<tr>'; resultsTable += '<td>#<\/td>'; resultsTable += '<td>Street Address<\/td>'; resultsTable += '<td>Town/Suburb/City<\/td>'; resultsTable += '<td>Postal Code<\/td>'; resultsTable += '<td>State/Province<\/td>'; resultsTable += '<td>Distance<\/td>'; resultsTable += '<td>Longitude<\/td>'; resultsTable += '<td>Latitude<\/td>'; resultsTable += '<\/tr>'; for (var record_count = 0, rl = response.record_set.length; record_count < rl; record_count++ ) { var record = response.record_set[record_count]; var title = record.details.location_name; var infoBoxContent = '<strong>Location #'+(record_count+1).toString()+'<\/strong>'; infoBoxContent += '<br \/>'+record.address.street_address+'<br \/>'+record.address.town + ', ' + record.address.postal_code +'<br \/>'; infoBoxContent += 'Distance: '+record.distance.km+'km<br \/>'; addMarkerOverlay(new google.maps.LatLng(record.latitude, record.longitude), title, infoBoxContent, null); if (record_count < 6) { bounds.extend(new google.maps.LatLng(record.latitude, record.longitude)); } resultsTable += '<tr>'; resultsTable += '<td>'+(record_count+1).toString()+'<\/td>'; resultsTable += '<td>'+record.address.street_address+'<\/td>'; resultsTable += '<td>'+record.address.town+'<\/td>'; resultsTable += '<td>'+record.address.postal_code+'<\/td>'; resultsTable += '<td>'+record.address.state+'<\/td>'; resultsTable += '<td>'+record.distance.km+'KM<\/td>'; resultsTable += '<td>'+record.longitude+'<\/td>'; resultsTable += '<td>'+record.latitude+'<\/td>'; resultsTable += '<\/tr>'; } map.fitBounds(bounds); resultsTable += '<\/table>'; var resultSet = document.getElementById('resultSet'); resultSet.innerHTML = resultsTable; } } function centerMap(lat,lon) { var centrePoint = new google.maps.LatLng(lat,lon); map.setCenter(centrePoint); } </script> </head> <body onload="initialize()"> <div class="addressBox"> <form action="" onsubmit="searchAroundMe(); return false;"> <input id="address" type="textbox" value=""> <input type="submit" name="search" value="Address Search"> </form> </div> <div id="map_canvas"></div> <div id="resultSet"></div> </body> </html> and the form itself would be on another page. Trying to pull the address input over. This obviously doesn't work Code: <!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>Store Locator</title> </head> <body> <div> <form action="ehound.html" method="post"> <input id="address" name="address" type="textbox"> <input type="submit" name="search" value="Address Search"> </form> </div> </body> </html> I've looked around on passing inputs via php and such, but this script seems to call on javascript as well and I'm having trouble implementing anything that works. Any help would be greatly appreciated. I inherited a calculator form using javascript that passes the form field data to a "lead mailbox" .asp page on a different site, and that site would then email/forward the salesman the data. The calculator also passes the calculated data to the next page for the user and gives them their calculated loan range. What I would like to do is not send this data to the "lead mailbox" site but instead send the data via Gmail (if possible) to the salesman as he wants to generate leads outside the company and not use the "lead mailbox". There are two lines of code that specify where to send the data (to the "lead mailbox" site) but I don't know how the receiving page is setup to receive the form data fields as it is https: (SSL) and I don't have access to that code. Everything works perfect with the code...I just want to send the data to a new location...but not sure how or if I can pass the data fields to a Gmail account like the salesman would like. Thanks for any help you can provide!! Normally sending form data is easy...but I inherited this and it was custom written javascript. Code: {document.contact.action = "https://www.othersitemailbox.com/post.aspx?account=EXN01&source=PTPPC-QQ"; document.contact.landing.value = "http://www.best-mortgage-programs.com/QQ.html?"+link} I have "blurred/changed" out the actual landing page value and actual URL of the https: address for privacy reasons... Thanks!! Hey all, I'm trying to email this form to myself using jQuery.ajax script but for some reason I'm not getting the emails. Here is my html for where the jquery exists on: Code: <!DOCTYPE html> <html> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <title>Form</title> <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css"/> <link rel="stylesheet" href="css/template.css" type="text/css"/> <script src="js/jquery-1.6.min.js" type="text/javascript"> </script> <script src="js/languages/jquery.validationEngine-en.js" type="text/javascript" charset="utf-8"> </script> <script src="js/jquery.validationEngine.js" type="text/javascript" charset="utf-8"> </script> <script src="js/formcalculations.js" type="text/javascript" charset="utf-8"> </script> <script> var result = new Array(); result[4400]= "<h3>Category One - $4,400/Year</h3><ul><li>Allergy & Immunology</li><li>Endocrinology</li><li>Pathology</li><li>Dermatology</li><li>Geriatrics</li><li>Physical Rehabilitation</li></ul>"; result[6900]= "<h3>Category Two - $6,900/Year</h3><ul><li>Family Practice</li><li>General Practice</li><li>Internal Medicine</li><li>Onconlogy</li><li>Oral Surgrey</li><li>Radiology</li><li>Gastroenterology</li><li>Infectious Disease</li><li>Nephrology</li><li>Ophthalmology</li><li>Pediatrics</li><li>Urology</li></ul>"; result[9000]= "<h3>Category Three - $9,000/Year</h3><ul><li>Anesthesiology</li><li>Cosmetic Surgrey</li><li>General Surgrey</li><li>Neurology</li><li>Otolaryngology</li><li>Plastic Surgery</li><li>Vascular Surgery</li><li>Cardiology</li><li>Emergency Medicine</li><li>Gynecology</li><li>Orthopedic Surgery</li><li>Pain Management</li><li>Pulmonary Surgery</li></ul>"; result[9900]= "<h3>Category Four - $9,900/Year</h3><ul><li>Neurological Surgery</li><li>Obstetrics</li></ul>"; function sendForm() { var user = jQuery("#username").val(); var address = jQuery("#address").val(); var phone = jQuery("#phone").val(); var practice= jQuery("#practice").val(); var society= jQuery("#society").val(); var phone = jQuery("#phone").val(); var bare = jQuery("#baredefense"); var insured = jQuery("#insureddefense"); var interested = ""; if( bare.attr("checked") == "checked" && insured.attr("checked") == "checked" ) { interested = "Bare Defense And Insured Defense"; }else if(bare.attr("checked") == "checked") { interested = "Bare Defense"; }else if(insured .attr("checked") == "checked") { interested = "Insured Defense"; }else { interested = "";} var titleSociety = jQuery('#society option:selected').text(); var fdata = "username="+name+"&address="+address+"&phone="+phone+"&practice="+practice+"&society="+titleSociety+"&interested="+interested; var content = "Practice Field: "+practice+"<br />Medical Society: "+titleSociety+"<br />Interested in: "+interested; var res = calculateTotal(); jQuery("#CalculationResult").html(content+"<br /><br />"+res); jQuery.ajax({ url: "js/ajax.php", data: fdata, method: "GET", success: function(r) { // setTimeout("clearForm()", 2000); } }); return false; } jQuery(document).ready(function(){ // binds form submission and fields to the validation engine //jQuery("#quoteform").validationEngine(); jQuery("#quoteform").validationEngine('attach', { onValidationComplete: function(form, status){ if(status == true) { sendForm(); } return false; } }); }); function clearForm(){ //jQuery("#quoteform").hide(); document.getElementById('quoteform').reset(); jQuery("#quoteform").validationEngine('hideAll'); return false; } </script> </head> <body> <form id="quoteform" class="formular" method="post"> <fieldset> <legend> How Much Will My Pre-Paid Legal Defense Cost? </legend> <div class="FormContainer"> <label> <span>Name *: </span> <input value="" class="validate[required] text-input" type="text" name="username" id="username" /> </label> <label> <span>Address *: </span> <input value="" class="validate[required] text-input" type="text" name="address" id="address" /> </label> <label> <span>Phone number *: </span> <input value="" class="validate[required,custom[phone]] text-input" type="text" name="phone" id="phone" /> </label> <label> <span>Choose Your Practice Field *:</span> <select name="practice" id="practice" class="validate[required]"> <option value="">--Select Field--</option> <option value="Allergy and Immunology">Allergy and Immunology</option> <option value="Endocrinology">Endocrinology</option> <option value="Pathology">Pathology</option> <option value="Dermatology">Dermatology</option> <option value="Geriatrics">Geriatrics</option> <option value="Physical Rehabilitation">Physical Rehabilitation</option> <option value="Family Practice">Family Practice</option> <option value="General Practice">General Practice</option> <option value="Internal Medicine">Internal Medicine</option> <option value="Oncology">Oncology</option> <option value="Oral Surgery">Oral Surgery</option> <option value="Radiology">Radiology</option> <option value="Gastroenterology">Gastroenterology</option> <option value="Infectious Disease">Infectious Disease</option> <option value="Nephrology">Nephrology</option> <option value="Ophthalmology">Ophthalmology</option> <option value="Pediatrics">Pediatrics</option> <option value="Urology">Urology</option> <option value="Anesthesiology">Anesthesiology</option> <option value="Cosmetic Surgery">Cosmetic Surgery</option> <option value="General Surgery">General Surgery</option> <option value="Neurology">Neurology</option> <option value="Otolaryngology">Otolaryngology</option> <option value="Plastic Surgery">Plastic Surgery</option> <option value="Vascular Surgery">Vascular Surgery</option> <option value="Cardiology">Cardiology</option> <option value="Emergency Medicine">Emergency Medicine</option> <option value="Gynecology">Gynecology</option> <option value="Orthopedic Surgery">Orthopedic Surgery</option> <option value="90Pain Management00">Pain Management</option> <option value="Pulmonary Surgery">Pulmonary Surgery</option> <option value="Neurological Surgery">Neurological Surgery</option> <option value="Obstetrics">Obstetrics</option> </option> </select> </label> <label> <span>Are You Affiliated With Any of the Following Medical Societies *:</span> <select name="society" id="society" class="validate[required]"> <option value="">--Select Society--</option> <option value="0">No, I am not</option> <option value="BCMA">Broward County Medical Association</option> <option value="DCMA">Dade County Medical Association</option> <option value="FOGS">Florida Obstetrics & Gynecology Society</option> <option value="FNS">Florida Neurological Society</option><option value="PBCMS">Palm Beach County Medical Society</option><option value="FSPS">Florida Society of Plastic Surgeons</option> </select> </label> <label> <span>What Type of Defense Are You Interested In? *:</span><br /> Bare Defense <input type="checkbox" value="5" id="baredefense" name="baredefense" class="d"><br />Insured Defense <input type="checkbox" value="5" id="insureddefense" name="insureddefense" class=""> </label> <input class="submit" onclick="clearForm();" type="reset" value="Reset!"/> <input class="submit" type="submit" value="Submit!"/><hr/> </div> <div class="CalculationContainer"> <div id="CalculationResult"> Please select.... </div> </div> </fieldset> <!-- <fieldset> <legend> Equals </legend> <label> <span>Password : </span> <input value="karnius" class="validate[required] text-input" type="password" name="password" id="password" /> </label> <label> <span>Confirm password : </span> <input value="kaniusBAD" class="validate[required,equals[password]] text-input" type="password" name="password2" id="password2" /> </label> </fieldset> --> </form> </body> </html> Hello, i'm working on a 3 page survey. When hitting next, previous, or submit it passes the values of all the questions to the next page. I've got the whole thing working correcting except for one thing: When the box is "not" checked it passes no value. I'm needing it to have a value of "1" when checked and a value of "0" when not checked, and currently when its not checked and i pass the info it leaves it blank. I'd post the whole code to one of the pages but it's long , so i'll post the snipits of the code. Code: <script type="text/javascript"> /* <![CDATA[ */ function processQueryString() { var formData = location.search; formData = formData.substring(1, formData.length); while (formData.indexOf("+") != -1) { formData = formData.replace("+", " "); } formData = unescape(formData); var formArray = formData.split("&"); for (var i=0; i < formArray.length; ++i) { //document.writeln(formArray[i] + "<br />"); var sDataName = formArray[i].split("=") switch (sDataName[0]) { case ".lib_use": for (var j=0; j < document.getElementsByName(".lib_use").length; ++j) { if (document.getElementsByName(".lib_use").item(j).value == sDataName[1]) { document.getElementsByName(".lib_use").item(j).checked = true; //alert("lib_use set"); } } break; case ".lib_comp": if (sDataName[1] == 1) { document.getElementsByName(".lib_comp").checked = true; document.getElementsByName(".lib_comp").value= 1; } else { document.getElementsByName(".lib_comp").checked = false; document.getElementsByName(".lib_comp").value= 0; } break; default: alert("not caught = " + sDataName[0]); continue; } } } /* ]]> */ </script> <input type="checkbox" name=".lib_comp" id="lib_comp" value="1" /> The first case that i showed in my code is a radio button, and it passes correctly, i just wanted to show the "format" i was using in a working sense. The 2nd case is an example of the check boxes. Thanks for looking at this, and giving any suggestions you might have! Hi I have a problem with a form in my site he http://www.21centuryanswers.com/submit.php if no field is filled and you click submit, an alert will be shown, yet the next page will still load! How do I fix it? the code for the form is: <form action="privacy.php" method="post" onsubmit="return checkform(this);"> <fieldset> <center> E-mail: <input type="textfield" name="email" size="60" value="" /><br/></br> Question: <input type="textfield" name="question" size="70" value="" /><br/><br/> <input type="submit" value = "Submit"/> </center> </fieldset> </form> and here is the validation script: <script language="JavaScript" type="text/javascript"> <!-- function checkform ( form ) { // ** START ** if (form.email.value == "") { alert( "Please enter your email." ); form.author.focus(); return false ; } if (form.question.value == "") { alert( "Please enter the question." ); form.title.focus(); return false ; } // ** END ** return true ; } //--> </script> Please help! Hello I am trying to call a javascript autocomplete function but I want to use a variable instead of an input field ID So this is my fuction: Code: $(function() { $("#tags").autocomplete({ source: "search.php?field=field1" }); }); <p><b>Field:</b><input type="text" input id = "tags" name="field1" size="60" ><br> Basically I want to use the same function for numerous input fields, so how can I pass a var instead of the input id ? Any help would be appreciated I want to use Javascript to submit a form - without filling the form in physically Is this possible? Let's say a web page has a form that submit First Name and Last Name to the next page Instead of filling in the form and hitting submit, can I submit the data in variables and call the next page somehow using Javascript? Thanks OM Hi, I want my page to jump to a different page based on data collected in the form input fields. I can jump to a new page alright, using the following javascript: 1. javascript code in form_a.html document.forms["form_A"].action = "page_x.html"l; document.forms["form_A"].submit(); 2. document.forms[0].action = "page_x.html"l; 3. window.locaton = "page_x.html"; 4. window.location.href = "page_x.html"; The problem is, I can see the new page was jumped to, but immediately it return back to the page that trigger the jump. Any idea? I need to finish the project before Christmas. Any help is greatly appreciated! Jeff Hello Friends In my jsp,Struts project i am using the javascript calendar control for selecting the date and by using function calcage() i am calculating the age of the user but problem occurs when the page refreshes OR when user updated the other values such as name ,contact no. Then the value of the age is set as 0 in the textfield as 0 So can you please tell me why this problem occurs And please give me solution Thanks Hi all, I'm having some trouble with the this... I have a PHP based calendar where the cells will change color depending on the number of clicks.. this all works fine, but is pointless if I can't send the outcome along in an email. I can do this with PHP but first need to get the values into a hidden field. This is what I have: Code: <script type="text/javascript"> function countClicks (obj){ if (!obj.count) { obj.count = 0; } obj.count++; if (obj.count > 4) {obj.count = 1}; if(obj.count == 1){ obj.style.color='#FFFFFF'; obj.style.backgroundColor='#66CC33'; obj.parentNode.style.backgroundColor='#66CC33'; document.getElementById("availability").value='Available'; } if (obj.count == 2){ obj.style.color='#FFFFFF'; obj.style.backgroundColor='#FF0000'; obj.parentNode.style.backgroundColor='#FF0000'; document.getElementById("availability").value='Not Available'; } if (obj.count == 3){ obj.style.color='#FFFFFF'; obj.style.backgroundColor='#FFCC33'; obj.parentNode.style.backgroundColor='#FFCC33'; document.getElementById("availability").value='Working'; } if (obj.count == 4){ obj.style.color='#000000'; obj.style.backgroundColor='#FFFFFF'; obj.parentNode.style.backgroundColor='#FFFFFF'; document.getElementById("availability").value='Not Set'; } } </script> and... Code: echo "<input type=\"hidden\" name=\"availability\" id=\"availability\" value=\"\">"; All I'm trying to do is populate value with either 'available', 'not available', 'working' or 'not set'... however, it is worth noting that each cell may have a different value, e.g. 1 cell might be working while the other is not available... so i need to pass the values of all the cells. Can anyone help me out here. Many thanks, Greens85 My java skill are rudimentary at best. I have an email which has some values attached to a link in the email that get passed to an online form on a website when clicked. Problem is the value is a price and the string includes a "$" which I need to remove. I've read through many examples and everyone seems to have an opinion (surprise). One suggests something like this: Code: text2.value=text1.value.replace(/\$/g,""); While someone else says its better to remove what you don't want. I am also scratching my head over should I place the value into a hidden field, scrub it then copy that into the proper field? and I imagine the best way would be to run it with an "onload" command instead or a event handler like a keystroke since the field is not typed? Roundtable discussion would be appreciated to help me solve this simple problem and help expand my knowledge of java... thanks. I've been trying to get a form to control iframes, but new to javascript I basically want to input the url from a form & display it in an iframe, but cant figure out how to link the url from the form to the iframe The code im using atm Code: <html> <head> <title> SearchLite v2 - search multiple sites at once</title> <STYLE TYPE="text/css"> .txt { BACKGROUND-COLOR: lavender; BORDER-BOTTOM-COLOR: lavender; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-COLOR: lavender; BORDER-LEFT-WIDTH: 0px; BORDER-RIGHT-COLOR: lavender; BORDER-RIGHT-WIDTH: 0px; BORDER-TOP-COLOR: lavender; BORDER-TOP-WIDTH: 0px; HEIGHT: 22px; WIDTH: 599px; } .cellht { HEIGHT: 50px; } .cell { BACKGROUND-COLOR: lavender; } </STYLE> <script> function win() { frmlen = document.myform.elements.length; idiv=1; for (var icnt=0;icnt<frmlen;icnt++) { //loop thru all FORM elements and look for checkboxes which have been checked if (document.myform.elements[icnt].type=="checkbox" && document.myform.elements[icnt].checked) { //make IFRAME visible document.getElementById("f"+idiv).style.visibility = 'visible'; //make textbox that shows heading with name of site being searched, visible document.getElementById("t"+idiv).style.visibility = 'visible'; //build the URL strSite = document.myform.elements[icnt].value; strSearch= escape(document.myform.mytext.value); url = strSite + strSearch; //set SRC property of IFRAME to dynamically built URL document.getElementById("f"+idiv).src = url; //show only the domain name part of the URL dmn=url.substring(7); document.getElementById("t"+idiv).value= dmn.substring(0,dmn.indexOf("/")); idiv+=1; } } } function hide() { for (var icnt=1;icnt<13;icnt++) { //hide all IFRAME s document.getElementById("f"+icnt).style.visibility = 'hidden'; //hide all the camouflaged textboxes that display the title document.getElementById("t"+icnt).style.visibility = 'hidden'; } } </script> </head> //Form1 i want to use for the url ........... <form> Enter URL1: <input type="text" name="Enter Url" /> </form> //Form2 i want to use for the url ........... <form> Enter URL2: <input type="text" name="Enter Url" /> </form> <body onload="hide()"> <form method=post action="" name="myform"> <table border=0 align='center'> <tr><td colspan=3 height='30%'><font size="5">SEARCH</font><i><font size="5" color="blue">LITE</font></i> v2 -search multiple sites at once and view results on a single page </td><td colspan=2> </td></tr> <tr > <td COLSPAN=3 ><input type="text" name="mytext" size="55"></td> <td COLSPAN=3><input type="button" value="Find" onClick="win()"> <input type="reset" value="Reset" onclick="hide()"> <a href="mailto:dotnut@hotmail.com">Feedback</a></td> </tr> <tr > //Want to change the value= replaced by the value in the form <td class="cell"><input type="checkbox" name="1" value="http://www.google.com/search?hl=en&btnG=Google+Search&q=">Google</td> <td class="cell"><input type="checkbox" name="2" value="http://www.dictionary.com/search?q=">Dictionary</td> <tr><td COLSPAN=5 HEIGHT='50' CLASS='cellht'><input type='text' id='t1' class='txt'></td></tr> <tr><td COLSPAN=5><IFRAME id='f1' FRAMEBORDER=1 SCROLLING='yes' WIDTH=600 HEIGHT=360></IFRAME><br></td></tr> <tr><td COLSPAN=5 CLASS='cellht'><input type='text' id='t2' class='txt' ></td></tr> <tr><td COLSPAN=5><IFRAME id='f2' FRAMEBORDER=1 SCROLLING='yes' WIDTH=600 HEIGHT=360></IFRAME><br></td></tr> </table> </form> </body> </html> thnx I have three buttons on a typical page (sample page: http://jimoberst.com/paintings/p18.html). One goes to the previous page, one to the next, and one up a level. Can I link these buttons to 3 arrow keys to simplify navigation for the user? I thought this would be a common task, but I cannot find any canned code on the web to do it. I can code simple html, but don't know javascript. Thanks!
I am thinking this should be fairly easy but yet I am not getting far. I want to have a form with a single text imput field for a zip code. Depending on which zip code the user enters will determine which url they will be sent to. If they enter a zip code which is not in the script, they would be sent to a default url. I am also assuming this can be accomplished with javascript. Any help is greatly appreciated. Hi, I am trying to pass data from one page to the next using a search. I have a search engine and im trying to get it to pass the data of the search to the search results page. im using this code
Code: <script type="text/javascript"> window.onload = function (){ try{document.getElementById('q').focus();}catch(e){} } function search() { var search_text = document.getElementById('q').value; window.location = '/search/'+encodeURI(search_text)+'/'; return false; } </script> and I am using this for the search Code: <form action="/search/" method="post" onSubmit="return search();"> <input type="text" id="q" name="q" value="" class="searc" style="width:350px; height:30px; font-size:18px; color:#C19051" /> <input type="submit" style="height:30px;" value="Search" class="submit"/> </form> Can anybody help me with this? Thanks Help will be greatly appreciated! Situation: I have a very long page divided into many sections vertical-wise marked by bookmarks, say pageX.html#s1 to s10. I need to show the section inside an iframe (iFrame1) on the mainpage (mainpage.html). I am thinking of having 4 buttons, sitting on the mainpage, to help navigate between these sections on pageX, namely NEXT, PREVIOUS, TOP, END. condition of the frame, fixed width/height, no scroll, no border. Very new to javascript but need this code to make a page work for BIZ. Thank you in advance for anyone kind enough to point the right direction! Hi! I have a script that opens up another window and a task gets executed, all of that is fine, but is there anyway that the parent window (the window that gets open) can pass data to the window that opened it? (I pretty much want to enable a button on that page) Thanks... - Matt I'm stuck! - I have a search form, that when data is entered and submitted, the data is sent to another page! - this works well see eg below. http://www.nctfleetlist.co.uk/normal.php My problem is, I have a piece of javascript called "greybox", it basically loads an external page, dimming the first page and focusing on the external - see eg below. http://www.nctfleetlist.co.uk/div4.php The new window can be called via either a href "rel" link or an "onclick" command. I have tried implementing the the two together but when I use the javascript to call the new window the data from the original form is not passed over! - this is what I have so far... example 1 - using onclick command (http://www.nctfleetlist.co.uk/eg1.php) Code: <script> GB_show(caption, url, /*optional*/ height, width, callback_fn) </script> <form name="form1" action="test_script.php" method="post"> <input type="text" name="var1" value=""> <input type="submit" name="submit" value="submit" onclick="return GB_show('Search', 'http://www.nctfleetlist.co.uk/test_script.php', this.href)"> </form> example 2 - using onsubmit within the form tag (http://www.nctfleetlist.co.uk/eg2.php) Code: <script> GB_show(caption, url, /*optional*/ height, width, callback_fn) </script> <form name="form1" action="test_script.php" method="post" onSubmit="return GB_show('Search', 'http://www.nctfleetlist.co.uk/test_script.php', this.href)"> <input type="text" name="var1" value=""> <input type="submit" name="submit" value="submit"> </form> example 3 - using a javascript link to submit the form, adding a "rel" tag (http://www.nctfleetlist.co.uk/eg3.php) Code: <script> GB_show(caption, url, /*optional*/ height, width, callback_fn) </script> <form name="form1" action="test_script.php" method="post"> <input type="text" name="var1" value=""> <a href="#" onclick="document.forms[0].submit()" rel="gb_page_center[720, 300]">Search</a> </form> Any help is appreciated! |