JavaScript - Passing Input Value From One Page To Another
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. Similar TutorialsHey 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. 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 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. hello guys the idea is to make "offline" bill of lading i used to do php thing and well this time i only need to kinda make bill of lading generator so i want to pass value from page 1 to page 2 and to page . all offline without web server interaction i was never fluent in javascript and i wanted to get a quick start from you guys how do i pass the form ( javascript variable from 1 page to another page ) i am googling this as well right now and hoping answer from codingforums thanks I want to pass 2 variables from a html page and collecting in another html page using javascript. say i pass xyz and abc to a page 2.html from 1.html without using cookies. In 1.html page i have many links. each link should be able to pass different variable to 2.html. when some one clicks on a link the variables should be passed to 2.html I want to know how to collect them and use them. please provide me code snippet. Hi guys, how do I use a query string to pass a image that a user selects from a number of images to a second page where the selected images will be displayed as a slideshow? Thanks all
Good Morning all I have a code that worked and i messed something up trying to add on to it and i cant figure out what i did I have a form for gift certificates (giftcerticate.html)user enters to: amount: from: then can choose a gift card to include with it. to do so they click a link that sends them to another page (giftcards.html) with a group of radio buttons. they choose a radio button where the result is to be sent back to the first page (giftcerticate.html) and place the result in a text box with a sample of the giftcard image. My issue is that when i go back to the first page it does not pass any of the values to the textboxes. it does show the the text box id's in the URL but no values or place them in the boxes. here is what it sends in the url: http://www.allyscandle.com/index/GIF....html?product1[]2=&product1[]=&price1=&giftcardstocknumber=BBA+-+003&submit=CARD+STYLE+CHOOSEN here is the script: <script type="text/javascript"> function getURI(string,parm) { var url = location.href; // Get the current URL var gsn = (location.href.split('giftcardstocknumber=')[1].split('&')[0]).replace(/\+/g,' '); var img = (location.href.split('img=')[1]).replace(/\+/g,' '); document.getElementById('gsn').value = gsn; document.getElementById('gsn-img').src = 'GIFTCARDS/'+img; } window.addEventListener?window.addEventListener('load',getURI,false):window.attachEvent('onload',get URI); </script> here are the two forms http://www.allyscandle.com/index/GIFTCERTIFICATES.html http://www.allyscandle.com/index/GIFTCARDS.html any help would be great i have been at this for a week now Hi all: This script and code works great, but in order for me to finish, I need a way of passing to the next PHP page which check box is checked. Currently, it is just passing a single value (1, 2, 3, 4, 5, or 6) depending on the last box checked. I need a way to record which check boxes are selected. Code: <html> <head> <script type="text/javascript"> var majors = { "001 - Exchange" : [ 2, 6 ], "003 - Academic Foundations" : [ 2, 6 ], "005 - Pre-Engineering" : [ 2, 6 ], "006 - Pre-Business" : [ 2, 6 ], "008 - Pre-Nursing" : [ 2, 6 ], "010 - Accounting" : [ 3, 4 ], "014 - Afro-American Studies" : [ 2, 6 ], "050 - American Studies" : [ 2, 6 ], "070 - Anthropology" : [ 2, 6 ], "080 - Art" : [ 2, 6 ], "082 - Art History" : [ 2, 6 ], "090 - Arts and Sciences" : [ 2, 6 ], "100 - Astronomy" : [ 2, 6 ], "115 - Biochemistry" : [ 2, 6 ], "120 - Biology" : [ 2, 5, 6 ], "124 - Biomedical Technology" : [ 2, 6 ], "130 - Botany" : [ 2, 6 ], "135 - Business Administration" : [ 3, 4 ], "140 - Business Law" : [ 3, 4 ], "160 - Chemistry" : [ 2, 5, 6 ], "163 - Childhood Studies" : [ 2, 5, 6 ], "190 - Classics" : [ 2, 6 ], "198 - Computer Science" : [ 2, 5, 6 ], "200 - Creative Writing" : [ 5 ], "202 - Criminal Justice" : [ 2, 5, 6 ], "203 - Dance" : [ 2, 6 ], "220 - Economics" : [ 2, 6 ], "300 - Education" : [ 2, 6 ], "350 - English" : [ 2, 5, 6 ], "352 - English - American Literature" : [ 2, 5, 6 ], "354 - English - Film Studies" : [ 2, 5, 6 ], "360 - European Studies" : [ 2, 6 ], "387 - Film Studies" : [ 2, 6 ], "390 - Finance" : [ 3, 4 ], "415 - Foreign Languages" : [ 2, 6 ], "420 - French" : [ 2, 6 ], "460 - Geological Sciences" : [ 2, 6 ], "470 - German" : [ 2, 6 ], "490 - Greek" : [ 2, 6 ], "500 - Hebraic Studies" : [ 2, 6 ], "509 - Historical Methods and Skills" : [ 2, 6 ], "510 - History, General" : [ 2, 6 ], "512 - History, American" : [ 2, 5, 6 ], "516 - African Asian Latin American and World Hist" : [ 2, 6 ], "520 - Home Economics" : [ 2, 6 ], "525 - Honors Program" : [ 2, 6 ], "533 - Human Resource Development" : [ 3 ], "537 - Hospitality Management" : [ 3 ], "549 - International Studies" : [ 2, 6 ], "555 - Student Proposed Major" : [ 2, 6 ], "560 - Italian" : [ 2, 6 ], "565 - Japanese" : [ 2, 6 ], "570 - Journalism" : [ 2, 6 ], "580 - Latin" : [ 2, 6 ], "590 - Latin American Studies" : [ 2, 6 ], "601 - Law - Day Student" : [ 1 ], "602 - Law - Evening Student" : [ 1 ], "606 - Liberal Studies" : [ 2, 5, 6 ], "615 - Linguistics" : [ 2, 5, 6 ], "620 - Management" : [ 3, 4 ], "623 - Management Science and Info Systems" : [ 3, 4 ], "626 - Managerial Economics" : [ 4 ], "630 - Marketing" : [ 3, 4 ], "640 - Mathematics" : [ 2, 6 ], "645 - Mathematical Science" : [ 5 ], "660 - Medical Technology" : [ 2, 6 ], "680 - Microbiology" : [ 2, 6 ], "698 - Museum Studies" : [ 2, 6 ], "700 - Music" : [ 2, 6 ], "701 - Music, Applied" : [ 2, 6 ], "705 - Nursing" : [ 2, 6 ], "730 - Philosophy" : [ 2, 6 ], "740 - Physical Education" : [ 2, 6 ], "742 - Physical Therapy" : [ 5 ], "750 - Physics" : [ 2, 6 ], "760 - Physiology" : [ 2, 6 ], "780 - Plant Physiology" : [ 2, 6 ], "790 - Political Science" : [ 2, 6 ], "830 - Psychology" : [ 2, 5, 6 ], "834 - Public Administration" : [ 5 ], "840 - Religon" : [ 2, 6 ], "842 - Rhetoric" : [ 5 ], "860 - Russian" : [ 2, 6 ], "890 - General Science" : [ 2, 6 ], "910 - Social Work" : [ 2, 6 ], "920 - Sociology" : [ 2, 6 ], "940 - Spanish" : [ 2, 6 ], "950 - Speech" : [ 2, 6 ], "960 - Statistics" : [ 2, 6 ], "964 - Teacher Preparation" : [ 2, 6 ], "965 - Theater Arts" : [ 2, 6 ], "975 - Urban Studies and Community Development" : [ 2, 6 ], "976 - Urban Planning" : [ 2, 6 ], "981 - Volunteer Organization and Leadership" : [ 2, 6 ], "988 - Womens & Gender Studies" : [ 2, 6 ], "989 - Writing" : [ 2, 6 ], "990 - Zoology" : [ 2, 6 ] }; Array.prototype.isMember = function( find ) { for ( var i = 0; i < this.length; ++i ) { if ( this[i] == find ) return true; } return false; } function resetOptions( ) { var form = document.theForm; var sel = form.Majors; for ( var s = sel.options.length-1; s > 0; --s ) { sel.options[s] = null; } var checked = [ ]; for ( var cb = 0; cb < form.schools.length; ++cb ) { if ( form.schools[cb].checked ) checked.push( form.schools[cb].value ); } for( major in majors ) { var mschools = majors[major]; for ( var c = 0; c < checked.length; ++c ) { if ( mschools.isMember( checked[c] ) ) { sel.options[sel.options.length] = new Option( major, major ); break; } } } } </script> </head> <title>Search</title> <body bgcolor="99CCFF"> <center> <br> <center>Search:<table border='1'> <form name='theForm' action='display.php' method='post'> <tr><td>ID: </td><td><input type="text" name="ID"/></td></tr> <tr><td>Last Name: </td><td><input type="text" name="NAME_LAST"/></td></tr> <tr><td>First Name: </td><td><input type="text" name="NAME_FIRST"/></td></tr> <tr><td valign="top">School: </td> <td> <input type="checkbox" name="schools" value="1" onClick="resetOptions()"> Law School<br/> <input type="checkbox" name="schools" value="2" onClick="resetOptions()"> College of Arts and Sciences<br/> <input type="checkbox" name="schools" value="3" onClick="resetOptions()"> School of Business (Undergraduate)<br/> <input type="checkbox" name="schools" value="4" onClick="resetOptions()"> School of Business (Graduate)<br/> <input type="checkbox" name="schools" value="5" onClick="resetOptions()"> Graduate School<br/> <input type="checkbox" name="schools" value="6" onClick="resetOptions()"> University College </td> </tr> <tr><td>Major: </td><td><select name="Majors"> <option value="" selected>Select a major</option> </select></td></tr> <tr><td>Order By: </td><td> <select name="ORDER_BY"> <option value = "" selected> Select One </option> <option name="NAME_LAST" value = "NAME_LAST ASC"> Last Name </option> <option name="CURRIC_CD" value = "CURRIC_CD ASC"> Major </option> <option name="ID" value = "ID ASC"> RUID </option> <option name="UNIT_OF_REG_CD" value = "UNIT_OF_REG_CD ASC"> School </option> <option name="EMAIL_ADDR" value = "EMAIL_ADDR ASC"> Email Address </option> </select></td> </tr> </table> <br><br> <input type='submit'/> </form><br><br> </center> </body> </html> Thanks in advance. I'm new to javascript and have come across what I'm sure its a really easy problem to solve. I want a page with a hyperlink that passes a variable to another 'pop-up' page (in this case a name, its just an example) and new pop-up page prints a message followed by the variable thats passed. Here is the code as it is right now Code: <html> <head> <script language="javascript" type="text/javascript"> function popitup(a) { var reply = 'a'; newwindow=window.open('','name','height=200,width=150'); var tmp = newwindow.document; tmp.write('<html><head><title>popup</title>'); tmp.write('</head><body><p>"Hello there" + reply </p>'); tmp.write('<p><a href="javascript:self.close()">close</a> the popup.</p>'); tmp.write('</body></html>'); tmp.close(); } </script> </head> <body> <a href="testpopup.html" onclick="popitup('Toby')" >Link to popup</a> </body> </html> In short, I just want the pop-up page to print 'Hello there Toby' or whatever name I choose to pass across. Any help much appreciated!! The 'testpopup.html' url is just the initial webpage. I am passing parameters from one page (actually from a frame within a frameset) to another using Javascript. Typically the code is as follows, taking values from a Form. Code: parent.titleFrame.location="frm_right_demo_title.html?MyDateEvent.value='"+ytt+ "'&MyParam_spec.value='"+parent.mainFrame.document.forms.myForm.MyParam_spec.value+"'"; This has worked fine in all browsers including IE, Chrome and Firefox version 2.0.0.2. However, I have now found that it doesn't work with Firefox version 3.6.12. This is because when retrieving the parameters in the new loaded page, the character ' (quote) has been converted to %27 (percent twenty seven). I can write code to replace %27 with the quote character. However, this is lengthy and time-consuming (as I need to have cyclic code as the javascript replace command seems to work only on the first occurrence within a string). Can someone please help me to understand why this is happening and how to overcome it? Hi, I am trying to pass a video id value from one javascript page to another, extract the video id, append it to a utube url and then pass it to a html page for immediate display. I have managed to extract the video id value and append it to the url but cannot get it into the html section of the code. My code is posted below <html> <head> <script type="text/javascript"> function getParams() { var idx = document.URL.indexOf('?'); var urlId; var params = new Array(); if (idx != -1) { var url = document.URL.substring(idx+1, document.URL.length).split('&'); for (var i=0; i<url.length; i++) { videoVal = url[i].split('='); urlId = "http://www.youtube.com/v/" + videoVal[1]; } } document.getrElementById('UrlId').value=urlId; } params = getParams(); </script> </head> <body> <object width="425" height="344"> <param name="UrlId" value=urlId; </param><embed src=urlId type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"> </embed> </object> </p> </body> </html> I need to get it to appear as a complete url in the following lines in the html code <param name="UrlId" value=urlId; <embed src=urlId type="application/x-shockwave-flash"></embed> Can someone please help with this. Thanks hi 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 Hi there, I have a problem that I've been scouring the internet for an answer but have been unable to find a solution and wondered if anyone could offer their assistance here? I'll try to explain my problem: On my homepage (index.html), I have a search field which fires the users input (text) parameters off to another website to perform the search (ie. results.html). What I'm now trying to do is create an iframe on index.html which shows the search results on the same page (without the user having to visit the other website. Does anyone know if this is possible using javascript? The reason behind this is so that we can use the search on our old website on our new one... without having to re-invent the wheel. Any help would be greatly appreciated! Craig 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! I'm working in iWeb (I had to say that first). I need to create (using JAVASCRIPT) a text box with a button. When the button is clicked, the contents of the box are added to the URL (the url is in the code, probably a variable, for this example it is mydomain.wordpress.com/) and the url produced loads. For example, if the text "Hello" was printed in the text box once the button is clicked the page mydomain.wordpress.com/Hello is loaded.
I want to use javasript to create a new html page named from a text field in a form. Then I want to use javasript to copy all of the form fields to the new html page that was created using javascripting. I am creating a user are using a Javascript password login. With most of them the page is the user name or password. So this is why I am looking to do this. I use web 1000 a free host and they will only let me use javascripting. Any info or help would be great thank you
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! Dear all, I'm passing the variables myTitle and myLink to form.php using javascript. This is the way I'm doing it: Code: <a href='form.php?title=" + myTitle +"&link="+myLink+">Click me</a> It's working great but sometimes myTitle and myLink contain the plus character (+). When this happens it's not passed. In the case of the title, it's just a problem of looks but in the case of the link, well, the link won't work without the character. As an example if the title is: Laptop + Accessories What is passed is: Laptop Accessories What can I do to pass also the plus character?? Thanks a lot!! |