JavaScript - Remember Your Selections Autodrop Down
Dear all,
Below the html and java code. After viewing using Internet Explorer, I did a selection from the autodropdown. Then I click on Click here to go to other page . You will see a quite different webpage. Then I click on the back button, in the left upper corner of IE window, so I see the previous webpage but.... the autodropdown does not remember my selection . How can we solve this? <html> <Head> <Script Language=JavaScript> Level1 = new Array("Ceramics","Chemicals") Ceramics = new Array("ELECTRONICS","ENVIRONMENTAL") Chemicals = new Array("METALLIC_SOAPS","OLEOCHEMICAL_DERIVATIVES") ELECTRONICS = new Array("Solder mask") ENVIRONMENTAL = new Array("Catalysts") METALLIC_SOAPS = new Array("Soap","Translucent soaps","Liquid soa[") OLEOCHEMICAL_DERIVATIVES = new Array("FA-pos","FA polfaideriv") function fillSelect(isValue,isNext){ isNext.style.display = ""; isNext.length = 1; curr = eval(isValue); for (each in curr) { isData = new Option(curr[each],curr[each]); isNext.add(isData,isNext.options.length); } } function getValue(isValue){ } </Script> </Head> <body> <center> <h4>Dependent Select List, within a form</h4> <Form name='Categories'> <p>Segment <Select name='List1' onChange="fillSelect(this.value,Categories.List2)"> <option selected>Make a selection</option> </Select> </p> <Select name='List2' onChange="fillSelect(this.value,Categories.List3)"> <option selected>Make a selection</option> </Select> <p></p> <Select name='List3' onChange="getValue(this.value)"> <option selected >Make a selection</option> </Select> </Form> </center> <Script> fillSelect('Level1',Categories.List1) Categories.List2.style.display = "none"; Categories.List3.style.display = "none"; </Script> <p>Click <a href="http://www.hetnet.nl">here</a> to go to other page</p> </body> </html> Similar TutorialsI have a vertical menu in which the sub menu is a box that pops out to the right and the user can click boxes to make selections (input check boxes). I would like some way to indicate to the user after they have left the sub menu, that they have made selections within that sub menu. Perhaps a number after the menu item name, in which the number of sub menu selections are indicated in parenthesis? Is this possible? Hullo again, CF.com, So, now I have a curious question on arrays, selections, options and the like. My current project is available for perusal in order to assist me at: http://www.projectvoid.co.uk/ As you can see, I make it so that once the product type is selected, you can then select a wattage. This dependent drop-down works, however I want it so that when I select a value in the left-hand side (wattage), then the one on the right will offer a pre-defined value that replaces the wattage I have. For example, a GU-10 in 'Type of Lamp' offers a 50, 35 and 20 watt bulb in 'Current Lighting Products'. In 'Energy Efficient Products', it offers 5 and 3. I wish to make a statement somewhere so that if they select 50 on the left, it selects 5 on the right. If they select 35 on the left, it select 3 on the right. I would also like it to do multiple offers, so that if they select say, a 35 of the MR-16, I want the right hand side to offer both 5 and 3. The only way I can think of doing this is via a lot of 'IF' statements. Is there a quicker way to do this? Please assist and, if it's not too much to ask, could you comment the code? Thank you! Hi all, I am in the process of developing a calculator for some of my colleagues to use. One of the variables within the calculations is called PMH. I want to determine the value of PMH based on which checkboxes are ticked. Each checkbox has a different value. If the checkbox is not ticked, then the value of each option is 1 and obviously more than one checkbox may be ticked. I have created the checbox code: Code: <td><input type="checkbox" name="PMH" value="1.6" /> Smoker<br /> <input type="checkbox" name="PMH" value="0.4" /> CCF<br /> <input type="checkbox" name="PMH" value="0.5" /> Pulmonary Oedema / Cirrhosis<br /> <input type="checkbox" name="PMH" value="0.8" /> COAD<br /></td> but I have no idea on how to calculate what I need for var PMH. Can someone guide me as to what I need to do please? Cheers, mads I had a different question that no one seemed to be able to answer here, so I found a different way of approaching the situation. I need to make an element in JS, then display it in a place (preferably in a position right after the selected text on the page using getSelection) or, in a fixed position. For some reason, this code won't work in FF3.5 (Win7) or Chrome although the basic stuff was taken straight from Mozilla's website: Code: function showSelectBox(){ var textlength = text.length; var element = document.createElement('div'); element.setAttribute('id','select'); element.innerHTML = textlength+"/140<div id=\"t-icon\"><a href=\"#\" onclick=\"emptySelection();\"><img src=\"imgs/t-icon.gif\" /></a></div>"; } Hello, I need some help! I have some code that has a comments box and 2 radio buttons that ask if you want to be contacted about your comments. If you select "Yes", you get another set of radio buttons that ask you to choose a method of contact. When you choose a method, that selected methods value is parsed to the top of the textarea field, placing the comment below. I pretty much have it working, however, if I enter a comment in the "Comments" field, select "Yes", then select "email" and change to "Phone Morning", it concatnates the values in the textarea box instead of replacing the contact method value while still retaining the comment entered below. Also, if at all possible, I wanted to clear only the contact method value out of the textarea field and leave only the comment when you go back and click the "No" radio button. Can anyone please help? Thanks in advance! Code: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script type='text/javascript'> function showContactType(obj){ if(document.storeCodeFeedbackForm.contact[1].checked == true){ document.getElementById("contactType").style.display = 'inline'; }else if(document.storeCodeFeedbackForm.contact[0].checked == true){ for(i=0;i<document.storeCodeFeedbackForm.contactType.length;i++){ document.storeCodeFeedbackForm.contactType[i].checked = false; } document.getElementById("contactType").style.display = 'none'; } } function printContactType(src) { if(src.checked) document.storeCodeFeedbackForm.customerMessage.value = src.value + "\n" + "------------------------" + "\n\n" + document.storeCodeFeedbackForm.customerMessage.value; document.storeCodeFeedbackForm.customerMessage.focus(); } </script> </head> <body> <form name="storeCodeFeedbackForm"> <table> <tr> <td>Comments:<br /> <textarea id='textArea' name="customerMessage" cols="30" rows="10"></textarea> <br /> </td> </tr> <tr> <td> Would you like to be contacted about your comments? <span style="color:#990000; font-weight:normal">*</span> <input type="radio" name="contact" value="no" onclick="showContactType(this);disableField(this);"> No <input type="radio" name="contact" value="yes" onclick="showContactType(this)"> Yes </td> </tr> <tr> <td><table cellpadding="0" cellspacing="0" border="0" width="100%" id="contactType" style="display:none"> <tr> <td class="tir" style="border-top:1px dashed #cccccc; padding-top:5px;">(Choose One)<span style="color:#990000">*</span> <input type="radio" name="contactType" value="Contact me by: e-Mail" onClick='printContactType(this);'> e-Mail <input type="radio" name="contactType" value="Contact me by: phone in the morning" onClick='printContactType(this);'> Phone Morning <input type="radio" name="contactType" value="Contact me by: phone in the afternoon" onClick='printContactType(this);'> Phone Afternoon <input type="radio" name="contactType" value="Contact me by: phone in the evening" onClick='printContactType(this);'> Phone Evening</td> </tr> </table></td> </tr> </table> </form> </body> </html> Hi, I'm learning javascript and not sure what the script language is capable of. Is there a way to make radio button selections appear in a second popup window? Example: user selects various options from a page then clicks button to open a second window with select options showing up in list. Thanks for reading this. hello guys! I need help setting up a form, I want to do some pretty neat things: It will say: What countries do you want to visit? [FIELD] Part 1: I want that when a user starts typing into the field, it will suggest under things that match what you have typed so far, sort of like facebook search does. So I would need a list of recognized country names. Now for example imagine I was using this, and I typed in M, it would list under a max of 5 valid entries begining with M, if I typed in Me, it would list the ones begining with Me, if I typed in Mex, it would show Mexico. Now the user would have to click this drop down suggestion to choose it. Part2: I want once a user clicks on a suggestion, it will "pop under" the input box or somewhere, with a "x" beside it to remove it. The user can now type in another country, and when it is clicked it too appears as a sort of "icon" under the input box or somewhere, with an "x" beside it. Clicking the x removes the country from the current list of countries. Once he is done, he goes on to other fields and the selected countries remain visible. Once a user submits the form, I want to get only the countries that were visible to him. **An alternative idea, if this one is too complicated, would be to have a drop list with all countries in it, and once a person clicks one, it will remain and a "+" sign will appear under it. When pressed, another dropdown menu will appear so the person can choose another country from the second drop down, etc. OFC all selected countries can have an X to remove them. Idk how to do this either.. I need help guys I have no clue how to do something like this, where do you recommend I start? Any ideas? I tried searching but I'm not sure what to call this so I couldn't find anything in the search. Thanks for your help so much!! I have the below code i been trying to figure out how to reset the font changes made without having to refresh the website (f5). Currently I have created a button that onClick uses history.go(0) which refreshes the page removing the font changes. I would like help with figuring out a solution to reset (remove font) step1-5 without having to refresh the page. Thanks. Preview of Code Code: <html> <head> <title>My Title Page</title> <script type="text/javascript"> function selectTextArea() { document.FormTextArea.TextAreaBox.select(); document.FormTextArea.TextAreaBox.focus(); } function changeStepColor(id) { document.getElementById(id).style.font="italic bold 15px arial,serif"; } function inputPrompt(String , msg) { String=prompt(msg, ""); if (String!=null && String!="") { document.FormTextArea.TextAreaBox.value=document.FormTextArea.TextAreaBox.value + msg + ' ' + String + '\r' + '----------------------------------' + '\r' } else { document.FormTextArea.TextAreaBox.value=document.FormTextArea.TextAreaBox.value + msg + ' N/A' + '\r' + '----------------------------------' + '\r' } } </script> </head> <body> <table border="1" cellpadding="2" cellspacing="2" width="100%"> <tr> <td width="50%" align="center" valign="top"> <form name="FormTextArea"> <textarea name="TextAreaBox" cols="40" rows="12" wrap="virtual"></textarea> </form> </td> <td width="50%" valign="top"> <font size="2" id="step1">1. Step One</font> <input type="button" value="Input" onclick="inputPrompt('a', 'Step 1:'); changeStepColor('step1');" /><br /> <font size="2" id="step2">2. Step Two</font> <input type="button" value="Input" onclick="inputPrompt('a', 'Step 2:'); changeStepColor('step2');" /><br /> <font size="2" id="step3">3. Step Three</font> <input type="button" value="Input" onclick="inputPrompt('a', 'Step 3:'); changeStepColor('step3');" /><br /> <font size="2" id="step4">4. Step Four</font> <input type="button" value="Input" onclick="inputPrompt('a', 'Step 4:'); changeStepColor('step4');" /><br /> <font size="2" id="step5">5. Step Five</font> <input type="button" value="Input" onclick="inputPrompt('a', 'Step 5:'); changeStepColor('step5');" /> </td> </tr> <tr> <td width="50%" align="center" valign="top"> <input type="button" value="Select Text Area" onClick="selectTextArea()" /> <input type="button" value="Clear Text Area" onClick="document.FormTextArea.TextAreaBox.value=''; history.go(0)" /> </td> <td width="50%" align="center" valign="top">   </td> </tr> </table> </body> </html> Good day. This form is working, but I want to make the "What AIS services are you interested in?" multiple selection a "required field". The other required fields are working, but I can't figure out how to make this field "required". Code: <blockquote><h2>Request More Information:</h2> <script type="text/javascript"> function MM_validateForm() { //v4.0 if (document.getElementById){ var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments; for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=document.getElementById(args[i]); if (val) { nm=val.name; if ((val=val.value)!="") { if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@'); if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n'; } else if (test!='R') { num = parseFloat(val); if (isNaN(val)) errors+='- '+nm+' must contain a number.\n'; if (test.indexOf('inRange') != -1) { p=test.indexOf(':'); min=test.substring(8,p); max=test.substring(p+1); if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n'; } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; } } if (errors) alert('The following error(s) occurred:\n'+errors); document.MM_returnValue = (errors == ''); } } </script> <form action="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST" onsubmit="MM_validateForm('first_name','','R','last_name','','R','email','','RisEmail','company','','R','phone','','RisNum');return document.MM_returnValue"><input type="hidden" name="oid" value="00Dd0000000cnUc" /> <input type="hidden" name="retURL" value="http://aissolutions.ca/thank-you" /> <p style="float:left;width:350px"><label for="first_name">First Name <span style="color:#f00">(required)</span></label><input id="first_name" type="text" name="first_name" size="50" maxlength="40" /></p> <p style="float:left;width:350px"><label for="last_name">Last Name <span style="color:#f00">(required)</span></label><input id="last_name" type="text" name="last_name" size="50" maxlength="80" /></p> <p style="float:left;width:350px"><label for="email">Email <span style="color:#f00">(required)</span></label><input id="email" type="text" name="email" size="50" maxlength="80" /></p> <p style="float:left;width:350px"><label for="company">Company <span style="color:#f00">(required)</span></label><input id="company" type="text" name="company" size="50" maxlength="40" /></p> <p style="float:left;width:350px"><label for="phone">Phone <span style="color:#f00">(required)</span></label><input id="phone" type="text" name="phone" size="50" maxlength="40" /></p> <p style="float:left;width:350px">Best Time To Call:<select style="width:325px" id="00Nd0000004F2Mb" name="00Nd0000004F2Mb" title="Best Time To Call"><option value="">--None--</option><option value="9:00am to 12:00pm">9:00am to 12:00pm</option> <option value="1:00pm to 5:00pm">1:00pm to 5:00pm</option> <option value="6:00pm to 9:00pm">6:00pm to 9:00pm</option> </select></p> <p style="clear:left;float:left;width:350px"><label for="street">Address</label><br> <textarea name="street" cols="47"></textarea></p> <p style="float:left;width:350px">What AIS services are you interested in?:<select style="width:325px" id="00Nd00000043aHr" multiple="multiple" name="00Nd00000043aHr" title="What AIS services are you interested in?"><option value="Bookkeeping">Bookkeeping</option> <option value="Business Incorporation">Business Incorporation</option> <option value="Catch Up/Clean Up Records">Catch Up/Clean Up Records</option> <option value="Job Costing">Job Costing</option> <option value="Part Time CFO">Part Time CFO</option> <option value="Software Conversion">Software Conversion</option> <option value="Software Customization">Software Customization</option> <option value="Software Training">Software Training</option> <option value="Tax Services">Tax Services</option> </select></p> <p style="float:left;width:350px">Anything else you think we should know:<br> <textarea id="00Nd0000004E2rs" name="00Nd0000004E2rs" cols="47"></textarea></p> <p style="clear:left;float:left"><input type="submit" name="submit" /></p> Thanks. Hi everyone, I'm new here, I actually found this site by searching for the code I have a question for. I'm trying to show/hide different drop down selectors, depending on what is chosen in another drop down selector. I modified a script (I found he http://www.codingforums.com/showthread.php?t=98406) in a way that I thought would work, but its not. Can anyone help me with what I'm doing wrong? Here is my page: http://www.leatherexpressonline.com/...er/testing.php Here is my javascript: http://pastie.org/3344253 And my drop downs: http://pastie.org/3344258 Also, I don't want the drop downs (ids: grade1000color, grade1500color, grade2000color, grade2500color, grade3000color, grade5000color) to be shown when the page is first loaded. Only when the correct option is chosen on the drop down. So I'm guessing I should add a display:none style to those drop downs, then have them shown on the javascript? Thanks so much for the help I need help on some code
Code: function makefarm(){ document.getElementById("farms").value ++ ; document.getElementById("pop").value -=2 ; document.getElementById("coin").value -=10 ; document.getElementById("lumber").value -=20 ; document.getElementById("CIfarm").value ++ ; document.getElementById("CIfarm").value ++ ; document.getElementById("CIfarm").value ++ ; document.getElementById("CIfarm").value ++ ; document.getElementById("CIfarm").value ++ ; } function upgradefarm(){ document.getElementById("iron").value -=5 ; document.getElementById("coin").value -=20 ; document.getElementById("farmupgrades").value ++ ; } var food = function () { var f1 = document.getElementById('buttonhere'); var f2 = '<input type="button" value="Make Farm" onclick="makefarm()" /> Farms:<input type="text" id="farms" size="1" value=0 style="background-color:transparent;border:0px solid white;" READONLY/> <input type="button" value="Upgrade Farm" onclick="upgradefarm()" /> Farm Upgrades:<input type="text" id="farmupgrades" size="1" value=0 style="background-color:transparent;border:0px solid white;" READONLY/> <br/><br/><br/> Current Income:<input type="text" id="CIfarm" size="1" value=0 style="background-color:transparent;border:0px solid white;" READONLY/>'; f1.innerHTML = f2; } Code: Coin:<input type="text" id="coin" value=50 size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Lumber:<input type="text" id="lumber" value=100 size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Iron:<input type="text" id="iron" value=25 size="1" style="background-color:transparent;border:0px solid white;" READONLY /> Food:<input type="text" id="food" value=100 size="1" style="background-color:transparent;border:0px solid white;" READONLY /> POP:<input type="text" id="pop" value=10 size="1" style="background-color:transparent;border:0px solid white;" READONLY /> so if i press the makefarm() button it will add to the numbers but if i press it again they will got to zero how could i make it remember the numbers?(the input boxes are the second code) Hello all, I would like to implement a cookie feature on my site that when a user logs in a cookie is stored for him and the next time he comes back, he doesn't have to sign in. I have researched hotscripts and javascripts but the ones I have found have to do with the "remember me" and thats not quite what I want. I tried to manipulate it but with no luck. Any help with either posting code or an article would be greatly appreciated! Thanks a bunch-Dan hi my login form is inside a popup at www.nandahosting.co.uk at the top right have corner if you click "Customer Login" the login form has an remember me. after i have logged in if i go back to the homepage, when i click customer login it asks me for my username and password again, its something to do with the form being inside the popup i think. this is the form Code: <div id="popUpDiv" style="display:none;"> <div id="tbright"> <a href="#" onclick="popup('popUpDiv')"><img src="<%= url_prefix %>./theme-images/xclose.png" alt="close" style="float: right; width: 30px; height:26px;" class="close"/></a> <h4>Customer Login</h4> <form action='login' method='post'> <div id="boxleft"> <p><label for="username2">Username:</label><input name='username' type='text' value='' id='username2'/></p> <p><label for="password">Password:</label><input type='password' name='password' value='' id='password'/></p> <p><label for="permanent">Remember me?</label><input type='checkbox' name='permanent' style="margin: 0 0 20px 10px; width: 13px; float: right; height: 13px;" value='1' id='permanent'/></p> </div> <div id="boxright"> <input name="" type="submit" class="btn" value="Login" style="position: relative;"/> <p class="link"><b>New Customer? - </b><a href="<%= url_prefix %>register">Create an account</a></p> <p class="link"><a href="<%= url_prefix %>password-reminder">Forgotten your Password?</a></p> </div> </form> </div> </div> This is the javascript for the popup Code: function toggle(div_id) { var el = document.getElementById(div_id); if ( el.style.display == 'none' ) { el.style.display = 'block';} else {el.style.display = 'none';} } function blanket_size(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportheight = window.innerHeight; } else { viewportheight = document.documentElement.clientHeight; } if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) { blanket_height = viewportheight; } else { if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) { blanket_height = document.body.parentNode.clientHeight; } else { blanket_height = document.body.parentNode.scrollHeight; } } var blanket = document.getElementById('blanket'); blanket.style.height = blanket_height + 'px'; var popUpDiv = document.getElementById(popUpDivVar); popUpDiv_height=blanket_height/2-150;//150 is half popup's height popUpDiv.style.top = popUpDiv_height + 'px'; } function window_pos(popUpDivVar) { if (typeof window.innerWidth != 'undefined') { viewportwidth = window.innerHeight; } else { viewportwidth = document.documentElement.clientHeight; } if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) { window_width = viewportwidth; } else { if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) { window_width = document.body.parentNode.clientWidth; } else { window_width = document.body.parentNode.scrollWidth; } } var popUpDiv = document.getElementById(popUpDivVar); window_width=window_width/2-150;//150 is half popup's width popUpDiv.style.left = window_width + 'px'; } function popup(windowname) { blanket_size(windowname); window_pos(windowname); toggle('blanket'); toggle(windowname); } i am no good at javascript but could someone please help me, so that if customers has clicked the remember me box, if they go to the homepage then when they click customer login it will redirect them straight away if they have previously ticked the remember me box. thankyou so much. Hello everybody.. I have a problem with my code. I implement different Tabs into a Microsoft Office SharePoint Server 2007 site (.aspx). Now everytime I select a tab and refresh the whole page, IE7 cannot remmember the last session and navigate automatically back to tab1.. Properly I need to set Cookies. Im a beginner in using cookies and coding javascript.. I hope you can help me thanks [CODE] <%@ Page Language="C#" MasterPageFile="~masterurl/default.master" inherits="Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" metarogid="SharePoint.WebPartPage.Document" %> <%@ Register tagprefix="WebPartPages" namespace="Microsoft.SharePoint.WebPartPages" assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <%@ Register tagprefix="WebControls" namespace="Microsoft.SharePoint.Publishing.WebControls" assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %> <asp:Content runat="server" ContentPlaceHolderID="PlaceHolderAdditionalPageHead"> <!-- Tab Page Version 2.0 --> <!-- Questions and comments: peter@theallensite.com --> <!-- Blog: www.bitsofsharepoint.com --> <script type="text/javascript"> if(typeof jQuery=="undefined"){ var jQPath="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/"; document.write("<script src='",jQPath,"jquery.min.js' type='text/javascript'><\/script>"); } </script> <style> #tabs ul.tabNavigation{ margin: 0; padding: 0; list-style: none; height: 20px; /* Push the tabs 1px down to hide the top-border of the tabbedWindow */ position: relative; top: 1px; border-bottom: #998b7d 1px solid; } #tabs ul.tabNavigation li{ float: left; padding: 0; margin: 0 5px 0 0; background: none; } #tabs ul.tabNavigation a{ background-color: #fff; border: 1px solid #bbb; display: block; padding: 4px 0 1px; text-decoration:none } #tabs ul.tabNavigation a.selected{ font-weight: bolder; background-color: #fae8d9; border-bottom: #bbb 1px solid; } #tabs ul.tabNavigation a span{ padding: 0 10px; } #tabs div.tabbedWindow{ background-color: #fff; } #tabs ul.tabNavigation a:hover{ background-color: #F0F0F0 ; } .style1 { border: 0 solid #c0c0c0; background-color: #ffffff; } </style> <script type="text/javascript"> // // Tab Script created by Baris Wanschers // Contact: barisart@gmail.com // blog: www.bariswanschers.com // $(function () { var tabContainers = $('div#tabs > .tabbedWindow'); tabContainers.hide().filter('#tab-1').show(); $('div#tabs ul.tabNavigation a').click(function () { tabContainers.hide(); tabContainers.filter(this.hash).show(); $('div#tabs ul.tabNavigation a').removeClass('ms-topnavselected selected'); $(this).addClass('ms-topnavselected selected'); return false; }).filter('#tab-1').click(); }); </script> </asp:Content> <asp:Content runat="server" ContentPlaceHolderID="PlaceHolderMain"> <WebPartPages:SPProxyWebPartManager runat="server" id="ProxyWebPartManager"></WebPartPages:SPProxyWebPartManager> <div> <WebPartPages:WebPartZone id="g_B58E8EF48D294A6E89B2B1C44C554B4E" runat="server" title="Zone 2"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone><br></div> <table cellpadding="4" cellspacing="0" border="0" > <tr> <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" rowspan="5" style="width: 350px"> <WebPartPages:WebPartZone id="g_3F895C6E6999454A81F47069167554B8" runat="server" title="Zone 1"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" rowspan="5"> </td> <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" style="width: 100%" > <WebPartPages:WebPartZone runat="server" Title="loc:Header" ID="Header" FrameType="TitleBarOnly"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> <tr> <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" style="width: 100%"> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td valign="top"> <WebPartPages:WebPartZone runat="server" Title="loc:Tab" ID="g_E73F3DE86242404C8B54E2684B809633"><ZoneTemplate> <WebPartPages:ContentEditorWebPart runat="server" __MarkupType="xmlmarkup" WebPart="true" __WebPartId="{7D4FD124-D9F3-417C-A0AB-529C4C8E76BF}" > <WebPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.microsoft.com/WebPart/v2"> <Title>Tabs</Title> <FrameType>None</FrameType> <Description>Use for formatted text, tables, and images.</Description> <IsIncluded>true</IsIncluded> <PartOrder>1</PartOrder> <FrameState>Normal</FrameState> <Height /> <Width /> <AllowRemove>true</AllowRemove> <AllowZoneChange>true</AllowZoneChange> <AllowMinimize>true</AllowMinimize> <AllowConnect>true</AllowConnect> <AllowEdit>true</AllowEdit> <AllowHide>true</AllowHide> <IsVisible>true</IsVisible> <DetailLink /> <HelpLink /> <HelpMode>Modeless</HelpMode> <Dir>Default</Dir> <PartImageSmall /> <MissingAssembly>Cannot import this Web Part.</MissingAssembly> <PartImageLarge>/_layouts/images/mscontl.gif</PartImageLarge> <IsIncludedFilter /> <ExportControlledProperties>true</ExportControlledProperties> <ConnectionID>00000000-0000-0000-0000-000000000000</ConnectionID> <ID>g_7d4fd124_d9f3_417c_a0ab_529c4c8e76bf</ID> <ContentLink xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /> <Content xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor"><![CDATA[<script type="text/javascript"> <!-- Code to add Tabs (as "Content Web Part in SharePoint") --> <div id="tabs"> <ul id="tabs" class="tabNavigation ms-WPBody"> <li><a href="#tab-1" class="selected ms-topnavselected"><span>TAB 1</span></a></li> <li><a href="#tab-2" ><span>TAB 2</span></a></li> <li><a href="#tab-3" ><span>TAB 3</span></a></li> <li><a href="#tab-4" ><span>TAB 4</span></a></li> <li><a href="#tab-5" ><span>TAB 5</span></a></li> <li><a href="#tab-6" ><span>TAB 6</span></a></li> <li><a href="#tab-7" ><span>TAB 7</span></a></li> </ul> </div> ]]></Content> <PartStorage xmlns="http://schemas.microsoft.com/WebPart/v2/ContentEditor" /> </WebPart> </WebPartPages:ContentEditorWebPart> </ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </td> </tr> <tr> <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" height="100%" style="width: 100%"> <div id="tabs"> <div class="tabbedWindow" id="tab-1"> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td colspan="3"> <WebPartPages:WebPartZone id="g_D136027997C140AEA0E6325982283B91" runat="server" title="Zone Tab 1"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> <tr> <td valign="top"> <WebPartPages:WebPartZone id="g_42C56BB11DD145109FD6B8B37FE5F418" runat="server" title="Zone Tab 1 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_A7DCA0FC58D949B299E3A8C06A74B90B" runat="server" title="Zone Tab 1 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="tabbedWindow" id="tab-2"> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td colspan="3"> <WebPartPages:WebPartZone id="g_0DD3E4CF951141A58CB427747F47B020" runat="server" title="Zone Tab 2"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> <tr> <td> <WebPartPages:WebPartZone id="g_C728594D0AF244AABC2512C10D4296CD" runat="server" title="Zone Tab 2 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_5D8954458817443ABD45967AEE5937EB" runat="server" title="Zone Tab 2 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="tabbedWindow" id="tab-3"> <WebPartPages:WebPartZone id="ID3" runat="server" title="Zone Tab 3"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td> <WebPartPages:WebPartZone id="g_E66154B9A0F444168B80124928A60AF1" runat="server" title="Zone Tab 3 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_96EE7CAE5037494ABB0F62F67AFACD88" runat="server" title="Zone Tab 3 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="tabbedWindow" id="tab-4"> <WebPartPages:WebPartZone id="ID4" runat="server" title="Zone Tab 4"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td> <WebPartPages:WebPartZone id="g_25E5C41FE1104ACB8E9F6B73D1730F0F" runat="server" title="Zone Tab 4 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_76986E4A98F04D0397A26136C3196545" runat="server" title="Zone Tab 4 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="tabbedWindow" id="tab-5"> <WebPartPages:WebPartZone id="ID5" runat="server" title="Zone Tab 5"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td> <WebPartPages:WebPartZone id="g_182F371C67C0444B842B36F8644B6635" runat="server" title="Zone Tab 5 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_008D3B4587D647D285A758126D40F374" runat="server" title="Zone Tab 5 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="tabbedWindow" id="tab-6"> <WebPartPages:WebPartZone id="ID6" runat="server" title="Zone Tab 6"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td> <WebPartPages:WebPartZone id="g_313569A6112341E4B6628B6649E830A6" runat="server" title="Zone Tab 6 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_9BC67554017E4AE0A2711AC6C2F03040" runat="server" title="Zone Tab 6 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="tabbedWindow" id="tab-7"> <WebPartPages:WebPartZone id="ID7" runat="server" title="Zone Tab 7"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td> <WebPartPages:WebPartZone id="g_6981A4726C7448AC953D55D0A4C5A16C" runat="server" title="Zone Tab 7 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_CE1F6BAE1B75441CABDD536DC155274C" runat="server" title="Zone Tab 7 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="tabbedWindow" id="tab-8"> <WebPartPages:WebPartZone id="ID8" runat="server" title="Zone Tab 8"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> <table style="width: 100%" cellpadding="0" cellspacing="0" class="style1"> <tr> <td> <WebPartPages:WebPartZone id="g_4EB47EF0353A44339413DC9F4FA341CC" runat="server" title="Zone Tab 8 Left"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> <td valign="top"> </td> <td valign="top"> <WebPartPages:WebPartZone id="g_645A1348A1184895BEFFFCD0931C972D" runat="server" title="Zone Tab 8 Right"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> </table> </div> <div class="waste"></div> </div> </td> </tr> <tr> <td id="_invisibleIfEmpty" name="_invisibleIfEmpty" valign="top" style="width: 100%"> <WebPartPages:WebPartZone runat="server" Title="loc:Content_Visible_On_All_Tabs" ID="Footer" FrameType="TitleBarOnly"><ZoneTemplate></ZoneTemplate></WebPartPages:WebPartZone> </td> </tr> <script language="javascript">if(typeof(MSOLayout_MakeInvisibleIfEmpty) == "function") {MSOLayout_MakeInvisibleIfEmpty();}</script> </table> </asp:Content> <asp:Content runat="server" ContentPlaceHolderID="PlaceHolderPageTitle"> Site </asp:Content> [ICODE] Hi, first off I am very green when it comes to this stuff, so it needs to be spelled out for me. First, I was using colorbox on one page for an image gallery, and that works fine. On a different page, I have jcarousellite, which works fine as well. If only I could mix them both on the same page. I couldn't figure that out, so what I did was create a new page each time I clicked a jcarousel image. It opens up a completely different page, but I styled it in such a way that it at least "mimics" how it might look if I were using a lightbox script. So my solution works fine for now EXCEPT that once I close the new page (that mimics lightbox) the jcarousellite slides revert back to starting position. I need the slides to stay at the last clicked position, and not go back to the beginning each time I refresh the page. I searched online and saw some people talk about an "afterEnd" callback, but this is where my ability stops. If anyone could help me here it would be fantastic. Here is my code: Code: $(document).ready(function() { $(".slider").jCarouselLite({ speed: 100, visible: 4, btnPrev: ".previous", btnNext: ".next", circular: true }); }); Please assist, I have the following code to remember form inormation but it does not seem to work. Probably something stupid. 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> <title>Contact Page</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="yorkie.css" type="text/css" /> <script type="text/javascript"> /* <![CDATA[ */ // Confirm resetting of forms. function confirmReset() { var resetForm = confirm("Are you sure you want to reset the form?"); if (resetForm == true) return true; return false; } // If box clicked value within disappears function Focus(element) { if (element.value == element.defaultValue) { element.value = ''; } } // If nothing typed and box onblur the default value is restored within function Blank(element) { if (element.value == '') { element.value = element.defaultValue; } } // Submission of Contact Form Verified function verifySubmission() { var retValue = true; if (document.forms[2].email.value == "Enter Email Address" || document.forms[2].firstname.value == "Enter First Name" || document.forms[2].lastname.value == "Enter Last Name" || document.forms[2].telephone.value == "Enter Contact number") { window.alert("You did not fill in one of the following required fields: First Name, Last Name, Email Address, or Telephone Number."); retValue = false; } return retValue; } // Email address verified as a valid email address function validateEmail(formObject) { var email = formObject.value; var emailCheck = /^[_\w\-]+(\.[_\w\-]+)*@[\w\-]+(\.[\w\-]+)*(\.[\D]{2,3})$/; if (emailCheck.test(email) == false) { window.alert("The e-mail address you entered does not appear to be valid."); formObject.value = formObject.defaultValue; return false; } formObject.value = email.toLowerCase(); return true; } // Telephone number verified as a valid 10 digit number with no alpha characters function verifyPhone(number) { var phone = number.value; var phoneCheck = /^(\d{10})$/; if(phoneCheck.test(phone) == false) { window.alert("The telephone number you entered does not appear to be valid."); number.value = number.defaultValue; return false; } return true; } // Show additional contact form details onclick of yes radio button function showDiv() { document.getElementById('breeders').style.visibility = 'visible'; } // Hide certain contact form info onclick of No radio button function hideDiv() { document.getElementById('breeders').style.visibility = 'hidden'; } // SAVE FORM INFORMATION FOR THE NEXT VISIT function saveSelections(frm) { var setvalue; var fieldType; var index; var formname = frm.name; // CookieExpiry in 30 days. var today = new Date(); var exp = new Date(today.getTime()+30*24*60*60*1000); var string = "formname=" + formname + "|"; var cookieName = formname; var n = frm.length; for (i = 0; i < n; i++) { e = frm[i].name; fieldValue = frm[i].value; fieldType = frm[i].type; // Radio Buttons if (fieldType == "radio") { for (x=0; x < frm.elements[e].length; x++) { if (frm.elements[e][x].checked) { index = x } } string = string + index + "\|"; } // Text, Textarea, and dropdowns if ((fieldType == "text") || (fieldType == "textarea") || (fieldType == "select")) { string = string + frm.elements[e].value + "\|"; } // Checkboxes if (fieldType == "checkbox") { if (frm.elements[e].checked==true) { var setvalue = "1"; } if (frm.elements[e].checked==false) { var setvalue = "0"; } string = string + setvalue + "\|"; } // Hidden field if (fieldType == "hidden") { string = string + frm.elements[e].value + "\|"; } } setCookie(cookieName, string, exp); } // Load Form Fields from saved cookie function loadSelections(frm) { var e; var z; var x; var cookieName; var fieldArray; var fieldValues; var fieldValue; var formname = frm.id; // Retrieve form elements from cookie and split into array. cookieName = formname; fieldValues = getCookie(cookieName); fieldArray = fieldValues.split("\|"); var n = frm.length; for (i = 0; i < n; i++) { e = frm[i].name; z = i; z++; var fieldType = frm[i].type; var fieldValue = fieldArray[z]; // Radio Buttons if (fieldType == "radio") { x = fieldValue; frm.elements[e][x].checked = true; } // Text, Textarea, and dropdowns if ((fieldType == "text") || (fieldType == "textarea") || (fieldType == "select")) { frm.elements[e].value = fieldValue; } // Checkboxes if (fieldType == "checkbox") { var fld_checkbox = fieldValue; if (fld_checkbox == "1") { frm.elements[e].checked = true; } } // Hidden fields if (fieldType == "hidden") { frm.elements[e].value = fieldValue; } } } // COOKIE FUNCTIONS function setCookie(name, value, expires) { document.cookie= name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : ""); } function getCookie(name) { var dc = document.cookie; var prefix = name + "="; var begin = dc.indexOf("; " + prefix); if (begin == -1) { begin = dc.indexOf(prefix); if (begin != 0) return null; } else { begin += 2; } var end = document.cookie.indexOf(";", begin); if (end == -1) { end = dc.length; } return unescape(dc.substring(begin + prefix.length, end)); } /* ]]> */ </script> </head> <body class="contact" onload="var begin=setInterval('changeBanner()',9000); currentClock(); currentDate(); document.getElementById('breeders').style.visibility = 'hidden'; " onunload="saveSelections(document.forms[0])"> <table width="92%"> <form action="mailto:lynette@sayorkies.co.za, subject=Contact Form" method="post" enctype="text/plain" onsubmit="return verifySubmission()" onreset="return confirmReset();"> <table class="center" cellpadding="5" border="1"> <!-- This enters a horizontal line --> <tr><td><hr /></td></tr> <!-- This is for the personal information --> <tr><td><strong>Tell us who you a </strong></td></tr> <tr><td><input type="text" name="firstname" size="25" maxlength="35" value="Enter First Name" onfocus="Focus(this);" onblur="Blank(this);" /> * <input type="text" name="lastname" style="margin-left: 52px;" size="25" maxlength="35" value="Enter Last Name" onfocus="Focus(this);" onblur="Blank(this);" /> *</td></tr> <!-- This is for the contact information --> <tr><td><strong>Your Contact details:</strong></td></tr> <tr><td><input type="text" name="email" size="30" maxlength="60" value="Enter Email Address" onfocus="Focus(this);" onblur="Blank(this); validateEmail(this)" /> * <input type="text" name="telephone" style="margin-left: 20px;" size="20" maxlength="10" value="Enter Contact number" onfocus="Focus(this);" onblur="Blank(this); verifyPhone(this)" /> * </td></tr> <!-- This is where you enter your message also select what type of message--> <tr><td><strong>Your Message:</strong></td></tr> <tr><td align="left">What is your message about?<br /> <input type="radio" name="type" value="compliment" /> Compliment <input type="radio" name="type" value="complaint" /> Complaint <input type="radio" name="type" value="general" checked="checked" /> General <input type="radio" name="type" value="enquiry" /> Enquiry <input type="radio" name="type" value="feedback" /> Feedback</td></tr> <tr><td align="center"><textarea name="message" rows="6" cols="45" onfocus="Focus(this);" onblur="Blank(this)">Enter your message here...</textarea></td></tr> <!-- Additional information --> <tr><td align="left">Are you looking to purchase a Yorkie puppy?<br /> <input type="radio" name="purchase" value="yes" /> Yes <input type="radio" name="purchase" value="no" checked="checked" /> No</td></tr> <tr><td align="left">Do you own a Yorkie?<br /> <input type="radio" name="owner" value="yes" onclick="showDiv()" /> Yes <input type="radio" name="owner" value="no" checked="checked" onclick="hideDiv()" /> No<br /> <!-- If answer is no above the below questions are hidden, if yes then they appear --> <div id="breeders"> How many? <select name="qnty" size="1"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5+</option></select> Are you a breeder? <input type="radio" name="breeder" value="yes" /> Yes <input type="radio" name="breeder" value="no" checked="checked" /> No</div></td></tr> <!-- Subscriptions --> <tr><td align="left">Do you wish to subscribe to the following?<br /> <input type="checkbox" name="subscribe" value="letter" checked="checked" /> Monthly Newsletter<br /> <input type="checkbox" name="subscribe" value="pups" /> Notification of a new litter<br /> <input type="checkbox" name="subscribe" value="updates" /> Notification of site updates<br /> <input type="checkbox" name="subscribe" value="register" /> Registrations</td></tr> <!-- Add a picture file --> <tr><td align="left">Upload your favourite Yorkie photo for the Picture of the Month.<br /> <input type="file" name="upload" accept="image/gif, image/jpeg" size="30" style="margin-left: 15px; margin-top:5px;" /></td></tr> <!-- This enters a horizontal line --> <tr><td><hr /></td></tr> <tr><td align="center">Required fields marked with *</td></tr> <!-- Buttons to clear the form or to submit the form --> <tr><td align="center"><input type="reset" value="Clear the Form" /> <input type="submit" value="Send your message" /></td></tr> </table></form<script type="text/javascript">loadSelections(document.forms[0]);</script> </body> </html> Console Error: Unable to get value of the property 'split': object is null or undefined for this line: Code: fieldArray = fieldValues.split("\|"); I am hitting a brick wall, dont know what to do? My website is: ERBoH.com I have no experience with JS, just general knowledge of html/css. I had someone else write the site for me. They didn't know how to do this and pretty much just stopped talking to me... On my site, I have a video carousel (4 video thumbnails in a row, you press the > arrow, and it shows the next 4 video thumbnails, you click 1 video thumbnail, and it shows you the video above the carousel). The problem is, when you click on one of the thumbnails, it reloads the page, and the video carousel goes back to the beginning. So if you clicked the > arrow 3 times (ur on the 3rd set of thumbnails), then it brings you back to the 1st set. This is pretty annoying, especially if your planning on watching each video. My question is, is it possible to make some type of cookie or something to remember which set of thumbnails you were on in the carousel? So that, if your on the 3rd set, and click a video, instead of resetting to the 1st set, it keeps you on the 3rd set. If it is possible... how hard would it be to do? Is it something where I could just copy/paste a string of code, or would this be a huge project? Thanks for the advice. Hi, I have a website where the user can navigate different categories by tab. The problem is, when they're on a tab other than the default one and they refresh the page or click to another page, it puts them back on the first tab. I know this can be solved by using a session cookie of some type, I just need some help on implementing it into my site. http://www.thatswhyimbroke.com/ - so you can see what i'm talking about. If you look at the different tabs: Price High, price low, food & drink, etc. I want the user to be able to go to one of those, click to page 2 or refresh, and still be on that tab. Any help would be much appreciated! Ok, so if you navigate ovr to my website "http://www.mancunianmacca.co.cc" you will notice that a box pops up asking for your name. When you type it in it adds it to the page. Is there a way I can get this to remember the users input and only ask them once then remember. Like cookie or anything. If you need any extra things. Just ask.
I have a JavaScript that remembers the values of a form by creating cookies for each input element onblur. I cannot figure out though how to exclude one input field from being remember. It would be document.getElementsByTagName('input')[15] Every time I try to add an if/else statement in using that line, the script doesn't work altogether. Code: window.onload = function() { rememberFormInputs('rma', 'input-'); } /** * Set a cookie * @param string cookie name * @param string cookie value * @param string cookie expiration counter in days * @param string cookie path * @param string cookie domain * @param bool secure? */ function setCookie(name, value, expires, path, domain, secure) { var today = new Date(); today.setTime(today.getTime()); if (expires) { expires = expires * 1000 * 60 * 60 * 24; } var expires_date = new Date(today.getTime() + (expires)); document.cookie = name+"="+escape(value) + ((expires) ? ";expires="+expires_date.toGMTString() : "") + ((path) ? ";path=" + path : "") + ((domain) ? ";domain=" + domain : "") + ((secure) ? ";secure" : ""); } /** * Get a cookie value * @param string cookie name */ function getCookie(name) { var start = document.cookie.indexOf(name + "="); var len = start + name.length + 1; if ((!start) && (name != document.cookie.substring(0, name.length))) { return null; } if (start == -1) return null; var end = document.cookie.indexOf(";", len); if (end == -1) end = document.cookie.length; return unescape(document.cookie.substring(len, end)); } /** * Remebers form inputs after you fill them in * @param string form id to remember fields * @param string a prefix to prepend to all cookie names. (prevent naming conflicts) */ function rememberFormInputs(form_id, prefix) { var form = document.getElementById(form_id); var els = document.getElementsByTagName('input'); for (var i = 0; i < els.length; i++) { var el = els.item(i); if (el.type == 'text') { el.onblur = function() { var name = this.name; var value = this.value; setCookie(prefix + name, value, 90); }; var old_value = getCookie(prefix + el.name); if (old_value && old_value != '') { el.value = old_value; } } } } Does anyone have a solution? I would really appreciate it :] |