JavaScript - Script For Bill Same As Ship Info
I have a form & I want the customer to be able to check a box if the bill to information is the same as the ship to information & have the information automaticlly put into the appropriate boxes. I have the following script in the head of my html page:
<script language="JavaScript"> <!-- function shipsame() { var form = document.forms[0]; if(form.sameasbilling.checked){ form.shipname.value = form.shipname.value; form.shipaddress.value = form.billaddress.value; form.shipaddress2.value = form.billaddress2.value; form.shipcity.value = form.billcity.value; form.shipstate.value = form.billstate.value; form.shipzip.value = form.billzip.value; form.shipcontact.value = form.billcontact.value; form.shipphone.value = form.billphone.value; }else{ form.shipname.value = ""; form.shipaddress.value = ""; form.shipaddress2.value = ""; form.shipcity.value = ""; form.shipstate.value = ""; form.shipzip.value = ""; form.shipcontact.value = ""; form.shipbill.value = ""; } } function fixup() { var cb = document.forms[0].sameasbilling; cb.onclick = shipsame; } function MM_callJS(jsStr) { //v2.0 return eval(jsStr) } //--> </script> And I have the following in my form section: <input name="sameasbilling" type="checkbox" onclick="MM_callJS('sameasbilling')" value="yes" onload="fixup()"/> I am not a programmer & have gotten this script from searching the web. I have tried several things but do not know enough to fix the problem. I'm not even sure if the ship or bill should come first in the code. The customer will be filling out the bill to information first on my form. I would appreciate any help but please put it in VERY simple terms that I can understand. Thank you Similar TutorialsHello. I have a script that detects the image size of a url and then shows a resized version of the image if it's necessary to resize. (this script was provided to me by the user bullant, thank you.) (Script will be shown later further down) In order to display the resized image, I must specify the id tag of myImg(and a number) in the img tag and must have an equal number of urls in the script as I do img tags. So, if I have three images I need to do the following to get them to appear. Code: <div><img id="myImg0" src='' alt="" /></div> <div><img id="myImg1" src='' alt="" /></div> <div><img id="myImg2" src='' alt="" /></div> And this is the script (it can go right below the above code and all in the body tag): Code: <script type="text/javascript"> var picUrl = [ 'http://localhost/test/pic1.jpg', 'http://localhost/test/pic2.jpg', 'http://localhost/test/pic3.jpg', ]; //create image objects oPic = new Array(); for(i=0; i < picUrl.length; i++){ oPic[i] = new Image(); oPic[i].src = picUrl[i]; } window.onload=function(){ var maxWidth = 200; var maxHeight = 200; for(i=0; i < oPic.length; i++){ var width = oPic[i].width; //original image width var height = oPic[i].height; //original image height //set the image size to display on the page var newDims = calcNewDimensions(width, height, maxWidth, maxHeight); document.getElementById('myImg'+i).width = newDims['width']; document.getElementById('myImg'+i).height = newDims['height']; document.getElementById('myImg'+i).src = oPic[i].src; } } function calcNewDimensions(width, height, maxWidth, maxHeight){ newDims = new Array(); //scaling factors var xRatio = maxWidth / width; var yRatio = maxHeight / height; //calculate the new width and height if(width <= maxWidth && height <= maxHeight) { //image does not need resizing newDims["width"] = width; newDims["height"] = height; } else if(xRatio * height < maxHeight) { newDims["height"] = Math.round(xRatio * height); newDims["width"] = maxWidth; } else { newDims["width"] = Math.round(yRatio * width); newDims["height"] = maxHeight; } return newDims; } </script> O.k. Now, I have the following I am working with: Code: <!--Image 5--> <img src="http://blahblah.com/images/red2.jpg" alt="Item photo" onmouseover="document.swap.src='http://blahblah.com/images/red2.jpg';" height="80"> in which you can see that onmouseover, a larger image is shown (it's not rescaled). You can also see that the url of an img is specified there. How can I get the rescaled image to show in that spot or the url from the picUrl Array and the image shown in the correct size, in that spot of Code: onmouseover="document.swap.src= ? This is the entire area in which the onmouseover code will be used in case you need it. Code: <html> <head> <meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"> <title>MouseOver-Images</title> <style type="text/css"> td#kdwhdMAINPHOTO { width: 616px; vertical-align: top; } table#kdwhdTHUMB { margin-top: 12px; } td#kdwhdTHUMBNAILS { background-image: url(http://www.sunandfuninoc.com/testingsites/gems4me/images/t_28.jpg); width: 616px; height: 114px; text-align: center; } td#kdwhdTHUMBNAILS img { border: 1px solid #696969; } td#kdwhdTABLE { width: 296px; vertical-align: top; } --> </style> </head> <body> <table style="width: 924px;" border="0" cellpadding="0" cellspacing="0"> <tbody> <tr> <td id="kdwhdMAINPHOTO" style="text-align: center; background-color: white;"> <!--Image 1--> <img src="http://site.gems4me.com/images/red2.jpg" alt="Item photo" name="swap" style="border: 0px solid rgb(105, 105, 105);" height="450" width="450"> <table id="kdwhdTHUMB" border="0" cellpadding="0" cellspacing="0" width="616"> <tbody> <tr> <td><img src="http://www.sunandfuninoc.com/testingsites/gems4me/images/t_26.jpg" alt="Click on the picture below to enlarge" height="25" width="616"></td> </tr> <tr> <td><img src="http://www.sunandfuninoc.com/testingsites/gems4me/images/t_27.jpg" alt="" height="10" width="616"></td> </tr> <tr> <td id="kdwhdTHUMBNAILS"><!--Image 1--><img src="http://site.gems4me.com/images/450by450.jpg" alt="Item photo" onmouseover="document.swap.src='http://site.gems4me.com/images/450by450.jpg';" height="80"> <!--Image 2--> <img src="http://site.gems4me.com/images/450by450-2.jpg" alt="Item photo" onmouseover="document.swap.src='http://site.gems4me.com/images/450by450-2.jpg';" height="80"> <!--Image 3--> <img src="http://site.gems4me.com/images/450by450.jpg" alt="Item photo" onmouseover="document.swap.src='http://site.gems4me.com/images/450by450.jpg';" height="80"> <!--Image 4--> <img src="http://site.gems4me.com/images/450by450-2.jpg" alt="Item photo" onmouseover="document.swap.src='http://site.gems4me.com/images/450by450-2.jpg';" height="80"> <!--Image 5--> <img src="http://site.gems4me.com/images/red2.jpg" alt="Item photo" onmouseover="document.swap.src='http://site.gems4me.com/images/red2.jpg';" height="80"></td> </tr> <tr> <td><img src="http://www.sunandfuninoc.com/testingsites/gems4me/images/t_29.jpg" alt="" height="10" width="616"></td> </tr> </tbody> </table> </td> <td><img src="http://www.sunandfuninoc.com/testingsites/gems4me/images/spacer.gif" alt="" height="1" width="12"></td> <td id="kdwhdTABLE"> <table border="0" cellpadding="5" cellspacing="0" width="296"> <tbody> <tr> <td colspan="2" id="kdwhdTABLETITLE">Stuff</td> </tr> <tr> <td class="kdwhdSPECR1C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR1C2">Stuff</td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff </td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff</td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff</td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff</td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff</td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff</td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff</td> </tr> <tr> <td class="kdwhdSPECR2C1" nowrap="nowrap">Stuff</td> <td class="kdwhdSPECR2C2">Stuff</td> </tr> </tbody> </table> </td> </tr> </tbody> </table> </body> </html> Hello guys, Is there any way I can get the number of 'CPBucks' from this piece of HTML, It's currently at 1 but it will change. Code: <div class="user-info"> <img src="http://illiweb.com/fa/punbb/online.png" id="i_icon_online" alt="Online" title="Online"><br> <span style="white-space:nowrap;"><span style="color:##66666;">Posts</span>: </span>2<br> <span style="white-space:nowrap;"><span style="color:##66666;">CPBucks</span>: </span>1<br> <span style="white-space:nowrap;"><span style="color:##66666;">Join date</span>: </span>2011-10-11<br> </div> Thanks I'm sorry I don't have code for this one. I'm making a fansite for a game called RuneScape and I'm a bit stuck on this part. What I need for my website is, a page that will have the prices (min, middle, and max) of things from this or other items, which will be chosen later on. Here are two example sites that I am wanting to ... do the same thing as them. First Example Second Example I'd really appreciate any information you guys are willing to give. Thanks. Hi everyone! Firstly, im a beginner in Javascript, totally noobie. Much why this is posted! I have found this site: http://www.forswor.com/index.php/data-apis/ And I want to use this to post the server status on my forum/website. How exactly do I do that? I know there are examples and such and I have read and read on that page but I cannot figure out how to do this. I cant just paste: <script type="text/javascript" src="http://www.forswor.com/forswor_services/prod/serverwidget/getSWTORStatusjs.php"> </script> How would I get this to show the information of say for example Bloodworthy server and in text? I tried adding the line document.write(forswor_server_name);, but didnt show up anything - stupid as I am obviously I have no clue what im doing. I can manage html\css and some php but this is new for me, hehe. Thank you so much for reading an idiots post! Most regards, me. Hello everyone I would like to understand how can I do a drop down many exactly as the www.oracle.com webpage. The idea is to build some kind of menu in my web project. I know that this could be a noob question for some, thank you anyeway for any help in advanced. Renzo ++ I am currently working on a project that requires pretty large bits of jQuery (atleast for me) and once I get this function working I can solve more required functions but I have problems getting this to work. Basically what im trying to do is, when a link is clicked (within a certain div) it reads out the class of that link and searches within XML or JSON for the title and then finds the description within that record. I hope someone is able to point to the right direction, Thanks in advance, Mehk. Hey everybody, what regular expression do i have to use to get the 2 last elements of a user agent? eg in firefox how can i get : Mozilla/5.0 (X11; Linux i686; rv:7.0.1) Gecko/20100101 Firefox/7.0.1 Firefox & 7.01 ? thanks! Is it possible to get a entire system configuration information including RAM Size,Type,HD Size,Processor details using JavaScript Or any other Scripting Language. Please Help Me In Getting This. . . Can anyone let me know how can I get the href info dynamically I have 2 different webistes, just want to show those website urls dynamically <html> <body> <a href="http://www.yahoo.com" target="_blank">YAHOO</a> <a href="http://www.Google.com" target="_blank">Google</a> <script type="text/javascript"> document.write(href url of yahoo); document.write('href url of google); </script> </body> </html> thanks for help in advance I have a page where a user can enter info into a text box named (usertext). Below the box I have a link that takes the user to another page. This page is just a test page for proof of concept. I am wondering if there is a way that I can dynamically populate a variable located within the url of my link. The info that will populate the variable will be whatever the user types into the text box. For example my link will be <a href="nextpage.cfm?textvariable='#usertext#'> So when the user clicks this link, it goes to the next page already populated by the value of the info the user typed into the text box. I am thinking javascript will be involved, but I am not really sure. I am using coldfusion 8. I have a Cisco ASA that I use as a proxy server as such. I have a internal site that it will not pass credentials to so I was looking for a way to do that. Not being a site developer the only way I can come up with is to maybe pass it by using a cookie to store the password and ID. Below is the code I am trying to use. I can create the cookie with the code below but it will not change the PATH or the Domain for some reason. Also I do not think it is reading from the cookie not sure why. Basically I need it to set the cookie with the user info and then grab the info from the cookie to auto log the user in to the internal site. <script type="text/javascript" language="JavaScript"> <!-- function writeCookie( ) { var username = document.form.username.value; // Get the user's name var password = document.form.password.value; document.cookie = "UserIDPW=" + username + "=" + password; // Create the cookie } //--> <form name="form" id="unicorn_form" method="POST" onsubmit="writeCookie()" onsubmit="disableButton()" action="/+webvpn+/index.html" onsubmit="return onSubmit();"> <td nowrap id="username_field"> <p align="right"> <span style="font-size: 8pt; font-weight: 700"> <font face="Trebuchet, arial" color="#FFFFFF"> <b>User ID:</b> </font></span></font></td> <td valign="middle"> <input class="formData" size="20" type="password" id="password_input" name="username" value=""> </td> </tr> <tr> <!-- password prompt --> <td nowrap id="password_field"> <p align="right"> <span style="font-size: 8pt; font-weight: 700"> <font face="Trebuchet, arial" color="#FFFFFF"> <b>Password:</b> </font></span></font></td> <td valign="middle"> <input class="formData" size="20" autocomplete="off" id="password_input" name="password" type="password"> </td> </tr> <tr> <td> </td> <td align="center"> <!-- "log in" button --> <input type="submit" name="Login" value="Log In" class="button"> Hello all. I have a script to prompt a user for 4 pieces of information. First name. Last name Area code. & Telephone number. My assignment was to do this, and put the information is as follows. If both, first name & last name are entered, store in object as last name,first name. If only one is entered. display without the comma. Also store telephone number in (XXX) XXX-XXXX format. I was told to use methods to do all of these things. Please take note I am in a VERY basic javascript class. Thanks in advance. CODE I HAVE SO FAR : head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <script type="text/javascript"> last=name=area=num=''; function info ( ) { last = prompt("Please enter your last name",''); name = prompt("Please enter your first name",''); area = prompt("Please enter your area code",''); num = prompt("Please enter your phone number",''); }; function Person (info) { this.name = name this.last = last this.area = area this.num = num } </script> <title></title> </head> <body> <script type="text/javascript"> info ( ); teacher = new Person(); tempString=''; document.writeln ( last ); document.writeln ( name) ; if(area==''||num==''){tempString='';} else{tempString = teacher.area +''+ teacher.num} document.writeln ( tempString); </script> Hi, I currently have a asp.NET page which has a textbox with the ID: "txtbox1" I would like javascript to store the data entered into txtbox1 into a var. I have tried using var jVarName; jVarName = '<%#aVarName%>'; but so far it hasnt worked. Any suggestions would be appreciated ^^ hi On my map, I have several markers, see my code: Code: <script language="JavaScript" type="text/javascript"> function load() { if (GBrowserIsCompatible()) { var map = new GMap2(document.getElementById("map")); map.addControl(new GSmallMapControl()); map.addControl(new GMapTypeControl()); var locationIcon = new GIcon(G_DEFAULT_ICON); //both images must be the same size locationIcon.image = "images/google-pin.png"; locationIcon.shadow = "images/google-pin-shadow.png"; locationIcon.iconSize = new GSize(90, 70); locationIcon.shadowSize = new GSize(90, 70); markerOptions = { icon:locationIcon }; map.setCenter(new GLatLng(51.3992613899243,-1.32983778443008), 8); // center point between the 2 map.addOverlay(new GMarker(new GLatLng(51.4769752333875,-2.53517458867092), markerOptions)); //BS16 3HH map.addOverlay(new GMarker(new GLatLng(50.8391656924497,-0.154312843280554), markerOptions)); // BN1 5PT map.addOverlay(new GMarker(new GLatLng(50.8340528225749,-0.259947032613667), markerOptions)); // BN43 6NZ map.addOverlay(new GMarker(new GLatLng(51.5168824045344,-2.6926718990779), markerOptions)); // BS11 9YQ map.addOverlay(new GMarker(new GLatLng(50.954582894922,-0.145016932400171), markerOptions)); // RH15 9LR } } //51.514925,-0.150118 W1U 1JQ //51.497593,-0.164806 SW3 1NQ </script> I would like to add an info bubble for each of my markers, would I add this piece of code somewhere within my code: Code: GEvent.addListener(marker, "click", function() { marker.openInfoWindowHtml("<table width='215'><tr><td><a rel="nofollow" target='_blank' href='http://www.lcls.org/'>Lewis & Clark Library System</a></td></tr><tr><td><img src='http://www.lcls.org/images/galleries/tour/01-BuildingFromLot.JPG' border='0' width='195px' height='95' /></td></tr><tr><td>425 Goshen Road<br />Edwardsville,IL 62025<br />618-656-3216</td></tr></table><br /><a rel="nofollow" target='_blank' href='http://maps.google.com/maps?q=425 Goshen Road%20Edwardsville,%20IL'>Directions</a>"); }); I'm working on a website for a freelance writer. I've used a lytebox mod to open a modal dialogue box that shows a scan of each magazine article. The code allows for an "info" button at the bottom of the window, which when clicked calls a page info.php, and populates that page with text from an [info] variable on the main page. My question is this. I'd like to use the "info" button to call entire articles in text format from a separate php page. I don't want to insert these long articles into the main page. Is there an easy way to do this in the code? The info.php page code follows: <div class="info"><?php if (isset($_GET['info'])){ $text = $_GET['info']; $text = str_replace('<br/>',"\n",$text); } else { $text = 'This page is showing text from GET "info" variable'; } echo $text; ?></div> The entire info.php page is he http://www.mimiread.com/info.php The main lytebox.js page that I'm using is he http://www.mimiread.com/lytebox.js The code line that calls this from the main page: <a href="images/ttlnob-cover.jpg" rel="lytebox[essays-ttlnob]" rev="[info]ttlnob.html[/info]" title=""><img src="images/essays-ttlnob.jpg" border="0" alt="house beautiful, the trying to leave new orleans blues" /></a> Any help would be appreciated. can I use js to read info (e.g. getElementById('p')) from other web page stored under the same directory of the current webpage? how? e.g. on this website www.mywebsite.com/home.htm, how to use js to read tag 'p' info from www.mywebsite.com/child1.htm ? thx in advance Hi, I am trying to write a small javascript program where I can call the following two functions and store information which a user enters. The problem is if I call the function a second time to add more information the array gets overwritten. info () insert (name, surname, favouriteColour) function info () { name = prompt ("Please enter your name."); surname = prompt ("Please enter your surname."); favouriteColour = prompt ("Please enter your favourite colour."); } function insert (name, surname, favouriteColour) { var info = new Array (); info.name = name; info.surname = surname; info.favouriteColour = favouriteColour; return info }; Help is really appreciated.. Hello, I am having some issues passing information to a text box in a form. Basically, right now, when a date on the calendar is selected, the date is printed in the <div id="date"> field. however i want to put this value in the form text box instead. I've tried document.getElementsByName('date') or getElementById('date') and get either a "Object HTMLDivElement" or "Object NodeName" in the text box. Here is the relevant code... I hope Code: <script type="text/javascript" src="javascripts/prototype.js"></script> <script type="text/javascript" src="javascripts/calendarview.js"></script> <script type="text/javascript"> window.onload = function() { Calendar.setup({ dateField : 'date', parentElement : 'calendar' }) } function writeme(){ document.form1.datebox.value = document.getElementsByName('date').value; } </script> </head> <body style="font-family: calibri;"> <div id="calendar" style="margin: 60px;" onmouseup="writeme()"></div> <div id="date" name="date">Select Date</div> <form name="form1"> <input type="text" name="datebox" id="datebox" size="12" value="" /> <input type="button" name="testbtn" value="test me" /> </form> This is what I have: Code: <script type="text/javascript"> $(document).ready(function(){ $('#add').click(function() { alert ('test') }); $("form#exercise").submit(function() { // we want to store the values from the form input box, then send via ajax below var activity = $('#activity').attr('value'); $.ajax({ type: "POST", url: "newActiveProc.php", data: "activity="+ activity +"&func=search", success: function(msg){ $("span#results").html(msg); } }); return false; }); }); </script> Instead of alerting the user, I want to send their choice to the a table on the same page. Does anyone have any idea of how I might do this. I've posted three threads in the ajax forum with no response. Hi coders, I have a login form which has the following code: Code: <p> Username:<span><input type="text" id="uid" name="uid" size="14"/> </span> Pass:<span><input type="password" id="pwd" name="pwd" size="14"/></span> <a onclick="return loginload()" href="#" class="btn">Enter</a> Here is the loginload script directs me to the following page upon Enter: Code: function loginload() { window.location="step1.asp"; } Now that step1.asp gets the user & pass variables and pass them to step2.asp page that way: Code: <html> <!-- #include file="include/common.asp" --> <!-- #include file="include/security.asp" --> <head> <meta http-equiv="Content-Language" content="tr"> <meta name="GENERATOR" content="Microsoft FrontPage 12.0"> <meta name="ProgId" content="FrontPage.Editor.Document"> <meta http-equiv="Content-Type" content="text/html; charset=windows-1254"> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <META HTTP-EQUIV="Cache-Control" CONTENT="no-cache"> <title>Login</title> </head> <body background="webimages/BGS/Gray.jpg" bgcolor="#D6D6DE" topmargin="2" leftmargin="35" oncontextmenu='return false' ondragstart='return false' onselectstart='return false'> <form name="frm1" method="post" action="step2.asp"> <input type="hidden" name="_uid" id="_uid"> <input type="hidden" name="_pwd" id="_pwd"> </form> <SCRIPT> document.forms[0]._uid.value = document.getElementById("uid").value; document.forms[0]._pwd.value = document.getElementById("pwd").value; document.forms[0].submit(); </script> </body> </html> After clicking on Enter on the login page, I receive the error for the step1.asp page: Line:20 Char:1 Object Required Code:0 Url=step1.asp Line 20 is the beginning of the script. Could not figure it out. Any opinions/advise are wellcome. |