JavaScript - Trying To Store User Entered Info Please Help
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.. Similar TutorialsI 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"> It will be best to use server side scripting like php for it , because user can disable his javascript in that condition your code won't work
I have a JavaScript application that needs to preserve double quote marks and apostrophes (" and ') that are entered into form fields by the user. The form data is passed through several screens using hidden fields. Right now, apostrophes work because I have the input fields coded as value="". I have not found a way for JavaScript to retrieve the field's value if double quotes are entered by the user. If I change the parameter to value='' (single quotes) then the apostrophes probably won't work. Is there a straightforward way for JavaScript to retrieve the field value containing quotes, so that I can manipulate it into a different string that can be easily passed between HTML pages? Hey everyone - I am having some trouble with creating cookies and getting them to work for an onclick event. What I am trying to do is create a button to store cookies containing all user information with an alert message and set the expiration date one day after the visit. (This is just a project I am working on to help me understand how to create cookies.) Below is the cookies code I came up with but it doesn't seem to be functioning at all. Any help would be greatly appreciated. Thanks Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <!-- Brooks Rogalski December 6, 2010 --> <title>ABC Outdoor Sports</title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" /> <script type = "text/javascript"> /* <![CDATA[ */ //cookie button function function cookieForm() { var equipment = document.forms[0].equipment.value; var pDate = document.forms[0].pickupDate.value; var pHour = document.forms[0].pickupHours.value; var pMin = document.forms[0].pickupMinutes.value; var rDate = document.forms[0].returnDate.value; var rHour = document.forms[0].returnHours.value; var rMin = document.forms[0].returnMinutes.value; var first = document.forms[0].firstName.value; var last = document.forms[0].lastName.value; var street = document.forms[0].street.value; var city = document.forms[0].city.value; var zip = document.forms[0].zip.value; var DoBYear = document.forms[0].date.value; var myDate = new Date(); myDate.setDay(myDate.getDay() +1) ; document.cookie = "equipment" + encodeURIComponent(equipment) + "; expires=" + mydate.toUTCString(); document.cookie = "pDate" + encodeURIComponent(pDate) + "; expires=" + mydate.toUTCString(); document.cookie = "pHour" + encodeURIComponent(pHour) + "; expires=" + mydate.toUTCString(); document.cookie = "pMin" + encodeURIComponent(pMin) + "; expires=" + mydate.toUTCString(); document.cookie = "rDate" + encodeURIComponent(rDate) + "; expires=" + mydate.toUTCString(); document.cookie = "rHour" + encodeURIComponent(rHour) + "; expires=" + mydate.toUTCString(); document.cookie = "rMin" + encodeURIComponent(rMin) + "; expires=" + mydate.toUTCString(); document.cookie = "first" + encodeURIComponent(first) + "; expires=" + mydate.toUTCString(); document.cookie = "last" + encodeURIComponent(last) + "; expires=" + mydate.toUTCString(); document.cookie = "street" + encodeURIComponent(street) + "; expires=" + mydate.toUTCString(); document.cookie = "city" + encodeURIComponent(city) + "; expires=" + mydate.toUTCString(); document.cookie = "zip" + encodeURIComponent(zip) + "; expires=" + mydate.toUTCString(); document.cookie = "DoBYear" + encodeURIComponent(DoBYear) + "; expires=" + mydate.toUTCString(); /* ]] */ </script> </head> <body onload = "rotateImage('rImage')"> <h1> ABC Outdoor Sports Equipment </h1> <img src="fishing.jpg" id="rImage" width="250" height="200" onmouseover = "pause=true;" onmouseout = "pause=false;"> <br/> <br/> <form onsubmit = "return validateForm();" action = "mailto:rogalskibf@gmail.com?subject=ABC Customer Reservation" method="post" enctype="text/plain"> <table border = "0"> <tr> <td> Equipment:<br/> <select name = "equipment"> <option value="unselected">Select Equipment Type</option> <option value = 20>Fishing Boat</option> <option value = 15>Kayak</option> <option value = 2>Mountain Bike</option> <option value = 10>Scuba Gear</option> </select> </td> </tr> <tr> <td> Pick-up Date: <br/> <input type = "text" name = "pickupDate" value = "(mm/dd/yyyy)"/> </td> <td> Pick-up Time: <br/> <select name = "pickupHours"> <option value="unselected">hr</option> <option value = 7>07</option> <option value = 8>08</option> <option value = 9>09</option> <option value = 10>10</option> <option value = 11>11</option> <option value = 12>12</option> <option value = 13>13</option> <option value = 14>14</option> <option value = 15>15</option> <option value = 16>16</option> <option value = 17>17</option> </select> <select name = "pickupMinutes"> <option value="unselected">min</option> <option value = 0>00</option> <option value = .5>30</option> </select> </td> </tr> <tr> <td> Return Date: <br/> <input type = "text" name = "returnDate" value = "(mm/dd/yyyy)"/> </td> <td> Return Time: <br/> <select name = "returnHours"> <option value="unselected">hr</option> <option value = 7>07</option> <option value = 8>08</option> <option value = 9>09</option> <option value = 10>10</option> <option value = 11>11</option> <option value = 12>12</option> <option value = 13>13</option> <option value = 14>14</option> <option value = 15>15</option> <option value = 16>16</option> <option value = 17>17</option> </select> <select name = "returnMinutes"> <option value="unselected">min</option> <option value = 0>00</option> <option value = .5>30</option> </select> </td> </tr> <tr> <td> First Name: <br/> <input type = "text" name = "firstName"/> </td> <td> Last Name: <br/> <input type = "text" name = "lastName"/> </td> </tr> <tr> <td> Street: <br/> <input type = "text" name = "street"/> </td> <td> City: <br/> <input type = "text" name = "city"/> </td> <td> Zip:<br/> <input type = "text" name = "zip" maxlength = "5"/> </td> </tr> <tr> <td> Date of Birth: <br/> <input type = "text" name = "date" value = "(mm/dd/yyyy)"/> </td> </tr> <tr> <td colspan = "3" align = "center"> <input type = "submit" name = "submit" value = "Submit Reservation"/> <input type = "button" name = "cookies" value = "Store User Information"/> </td> </tr> </table> </form> </body> </html> 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! I have a form where users will be making a selection in a drop down box. I need, essentially, to store two values: the first value is the actual value assigned with each drop down item (their label, basically), and the second value being a completely separate value that will change based on what they chose from the drop down box to begin with. Example: Drop down box contains selections A, B, C, D. User selects A, I need to keep the original dropdown box's A value in tact for the dropdown box's value, and then store a 1 in a hidden textbox. User selects B, a 2 is stored, etc. Both of these values will be e-mailed, hence the reason I chose a hidden textbox to store the second value. Additionally, I don't want the user to see the second value on the form itself. If there's a better way to accomplish this, please let me know. 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, I am following the tutorial on Windows Live App API from he http://isdk.dev.live.com/ISDK.aspx?c...ncepts&index=0 and I have added my Client ID got a login system working and allowing information to be passed through but I cannot display the user that's currently logged in, here is my page: link: http://www.trialsevolution.co.uk/app/ code: 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>Greeting the User Test page</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script src="https://js.live.net/v5.0/wl.js" type="text/javascript"></script> <script type="text/javascript"> var APPLICATION_CLIENT_ID = "000000004805DA23", REDIRECT_URL = "http://www.trialsevolution.co.uk/app/home.html"; WL.Event.subscribe("auth.login", onLogin); WL.init({ client_id: 00000000000000, redirect_uri: "http://www.trialsevolution.co.uk/app/home.html", response_type: "token" }); WL.ui({ name: "signin", element: "signInButton" }); function greetUser(session) { var strGreeting = "welcome"; WL.api( { path: "me", method: "GET" }, function (response) { if (!response.error) { strGreeting = "Hi, " + response.first_name + "!" document.getElementById("greeting").innerHTML = strGreeting; } }); } function setMeImage(token) { var imgHolder = document.getElementById("meimg"), imgTagString = ""; if (token != null) { var url = "https://apis.live.net/v5.0/me/picture?oauth_token=" + escape(token); imgTagString = "<img src='" + url + "' />"; } imgHolder.innerHTML = imgTagString; } function onLogin() { var session = WL.getSession(); if (session){ greetUser(session); setMeImage(session.access_token); } } </script> </head> <body> <p>Sign in to display a welcome greeting.</p> <div id="meimg"></div> <div id="greeting"></div> <div id="signInButton"></div> </body> </html> Hello Everyone, I am inexperienced in JavaScript. I have an html page with several numeric input fields which are an array. At the bottom of the screen is a running total of the numbers entered. The html is like: <INPUT TYPE=TEXT NAME='array[0]' onchange='addup()'> <INPUT TYPE=TEXT NAME='array[1]' onchange='addup()'> etc..... <INPUT TYPE=TEXT NAME='array[9]' onchange='addup()'> <INPUT TYPE=TEXT NAME='arraytotal'> The javascript is: function addup() { var total = 0; for (var i=0; i<=10; i++) { total += Number(document.forms["formname"]["array["+i+"]"].value); } document.forms["formname"]["arraytotal"].value = total; } This works ok, but I don't want the field arraytotal to be an input field. How can I do this please? Hey friends, I'm writing a program but I'm having issues. I need to write a program that asks for 3 different numbers (prompt boxes) and determine which number entered was the highest and the 2nd highest. I know what to do for the input and output but I don't know what to do during the processing.
Hi Friends, i have a smal task i.e i have textbox1 ,botton,textbox2 when i enter 21 value then i click button its get in sama row values in textbox2. i have xml file like this <DATAPACKET > <ROWDATA> <R_ID>101</R_ID> <R_NAME>R-12</R_NAME> <R_TEMP>4.266</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>20</R_ID> <R_NAME>R-22</R_NAME> <R_TEMP>4.266</R_TEMP> <R_COLOR>Green</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>21</R_ID> <R_NAME>R-32</R_NAME> <R_TEMP>4.266</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>104</R_ID> <R_NAME>R-134A</R_NAME> <R_TEMP>4.246</R_TEMP> <R_COLOR>Light Blue</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>21</R_ID> <R_NAME>R-290</R_NAME> <R_TEMP>4.246</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>31</R_ID> <R_NAME>R-401A</R_NAME> <R_TEMP>4.246</R_TEMP> <R_COLOR>Pink</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>32</R_ID> <R_NAME>R-401B</R_NAME> <R_TEMP>4.264</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>108</R_ID> <R_NAME>R-402A</R_NAME> <R_TEMP>4.426</R_TEMP> <R_COLOR>Light Greem</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>129</R_ID> <R_NAME>R-402B</R_NAME> <R_TEMP>4.266</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>110</R_ID> <R_NAME>R-404A</R_NAME> <R_TEMP>4.246</R_TEMP> <R_COLOR>Orange</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>121</R_ID> <R_NAME>R-407A</R_NAME> <R_TEMP>4.267</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>122</R_ID> <R_NAME>R-408A</R_NAME> <R_TEMP>4.267</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>113</R_ID> <R_NAME>R-409A</R_NAME> <R_TEMP>4.267</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>134</R_ID> <R_NAME>R-407C</R_NAME> <R_TEMP>4.264</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> <ROWDATA> <R_ID>115</R_ID> <R_NAME>R-410A</R_NAME> <R_TEMP>4.426</R_TEMP> <R_COLOR>White</R_COLOR> </ROWDATA> </DATAPACKET > then i try this hear i get all values function gettxt() { results = new Array; var searchterm = document.getElementById("searchme").value; if (searchterm == null || searchterm == "") { alert("Enter textbox value"); return false; } var istrlen1 = searchterm.length; var tempname1; if (istrlen1 == 1) { tempname1 = searchterm; } if (istrlen1 == 2) { tempname1 = searchterm; } if (istrlen1 == 3) { tempname1 = searchterm; } if (istrlen1 == 4) { tempname1 = searchterm; } for (i = 0; i < x.length; i++) { var name = x[i].getElementsByTagName("R_ID")[0].firstChild.nodeValue; var name1 = x[i].getElementsByTagName("R_NAME")[0].firstChild.nodeValue; var exp = new RegExp(tempname1, "i"); if (name.match(exp) != null) { y = y + 1; results.push(name1); } } textbox2.value = results; } i try the above code hear small problom when i enter 21 and click button its display 21,121,123... related values i dont want like that for example textbox1=21 buttonclick textbox2=R-32,r-407A,r-408A like that i dont want like that i want textbox1=21 buttonclick textbox2=R-32 only in same row value please any one knows well in js please resolve my problom I have the following code that I wrote myself (except for the function isNumberKey). However, I don't know how to actually add the numbers together. My plan is to store the value entered in the forms as a variable, then manipulate the variables to get my final number. The final number would be stored in variable named Total and would be displayed after Total: at the bottom of my page. Could anyone help me? I can provide additional information if you need it. Code: <HTML> <TITLE>Magazine Prices </TITLE> <BODY> <SCRIPT language=Javascript> <!-- Price = oForm.elements["price"].value; Quantity = oForm.elements["quantity"].value; Subtotal = oForm.elements["subtotal"].value; Shipping = oForm.elements["shipping"].value; function isNumberKey(evt) { var charCode = (evt.which) ? evt.which : event.keyCode if (charCode > 31 && (charCode < 48 || charCode > 57)) return false; return true; } //--> </SCRIPT> <!-- Price * Quantity = Subtotal. Subtotal value should fill in automatically in the Subtotal input field. Subtotal * Shipping = Total. //--> <TABLE> <TR><TD>Price: </TD><TD><INPUT id="Price" name="Price" onkeypress="return isNumberKey(event)" type="text" name="txtChar"> </TD></TR> <TR><TD>Quantity:</TD> <TD><INPUT id="Quantity" name="Quantity" onkeypress="return isNumberKey(event)" type="text" name="txtChar"> </TD></TR> <TR><TD>Subtotal:</TD> <TD><INPUT id="Subtotal" name="Subtotal" onkeypress="return isNumberKey(event)" type="text" readonly="readonly" name="txtChar"> </TD></TR> <TR><TD>Shipping:</TD> <TD><INPUT id="Shipping" name="Shipping" onkeypress="return isNumberKey(event)" type="text" value="10%" readonly="readonly" name="txtChar"> </TD></TR> </TABLE> <b>Total: </b> </BODY> </HTML> Hello! First off, please excuse my ignorance. I am a bit new to the coding world. I want users to be able to enter data into a textbox on my site, and the data then be placed at the end of a specific url, followed by '.html'. For example, say my website is mysite.com. If someone enters in the word "John" in the textbox and clicks the 'Submit' button, the URL should now be: mysite.com/John.html Thanks in advance! Brand new to the forum, so first off... Hello all!! I have been working on a project which randomly changes the text font of a word submitted (Color and Size). At present the code works fine, using the below Javascript. Code: <SCRIPT LANGUAGE="JavaScript"> function randomise(){ var words=document.myform.wordlist.value; var spacer=""; words=words.split(document.myform.randomiseby.value) document.myform.code.value=" "; var colourscheme=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F") for(var time=0;time<=(words.length-1);time++){ {var c1=Math.round(Math.random()*(colourscheme.length-1)); var c2=Math.round(Math.random()*(colourscheme.length-1)); var c3=Math.round(Math.random()*(colourscheme.length-1)); var c4=Math.round(Math.random()*(colourscheme.length-1)); var c5=Math.round(Math.random()*(colourscheme.length-1)); var c6=Math.round(Math.random()*(colourscheme.length-1)); var size=1+Math.round(Math.random()*6); document.myform.code.value+="<font color=\"#"+colourscheme[c1]+colourscheme[c2]+colourscheme[c3]+colourscheme[c4]+colourscheme[c5]+colourscheme[c6]+"\" size=\""+size+"\">"+words[time]+"</font>"+spacer+" "; } } looks_like.innerHTML=document.myform.code.value; } </script> To really highlight the text i would like to keep the font white and change the background colour but i don't have a clue how to do it... Please note: i am a complete noob to Javascript and the above code has been bodged together from a number of tutorials. Can anyone help? Hello, I have a form that works out some basic math questions e.g. area etc. I run a function when a form field is updated to do the calculations, however I'd like to run a different calculation depending on which form element was updated. Is there a way to say something like: if (area1 was updated) { work out this calculation } if(area2 was updated) { work out this calculation } and so on? Thanks, Nicola I have a page with textarea where user can enter html code for link exchange I need to verify whether the code entered contains url in anchor's href tag having same url as that of reciprocal link how can i do this Hi everyone, new here. I'm trying to write a program that displays what a user has entered, it processes it, and displays it backwards This is what I have so far, Code: <script type="text/javascript"> var input ("Please enter a sentance","") So really this is what it needs to display. "The sentance you entered are "Hi people"" "The sentance in REVERSE order are "elpoep iH" If anyone can help, it would be awesome, since I'm a noob at this. Hello, I am not well-versed with javascript. Actually i have some calculations has to be displayed in total (textbox) as soon as i enter the values in other text box. I have done that. But if multiple rows added (its dynamically added ) that code doesn't work for 2nd row or 3rd row... I don't know how to do it. Here is my form where i am entering data and displaying result Code: <input type="text" class="span2" name="item[]" id="category" value="<?php echo $row1['item'];?>" /> <input type="text" class="span1" name="uom[]" id="category" value="<?php echo $row1['uom'];?>" /> <input type="text" name="description[]" id="category" value="<?php echo $row1['description'];?>" /> <input type="text" class="span1" name="quantity[]" id="qty" onkeyup="getValues(1)" /> <input type="text" class="span1" name="price[]" id="price" value="<?php echo $row1['selling_price'];?>" onkeyup="getValues(2)" /> <input type="text" class="span1" name="discount[]" id="discount" value="<?php echo $row1['discount'];?>" onkeyup="getValues(3)" /> <select name="tax[]" class="span1" id="tax" onkeyup="getValues(4)"> <option value="<?php echo $row1['tax'];?>"><?php echo $row1['tax'];?></option> <?php $l1 = mysql_query("select * from taxes") or die (mysql_error()); while($l2 = mysql_fetch_array($l1)) { ?> <option value="<?php echo $l2['rate']; ?>"> <?php echo $l2['name'];?> - <?php echo $l2['rate'];?>% </option> <?php } ?> </select> <input type="text" class="span1" name="freight[]" id="freight" onkeyup="getValues(5)" placeholder="Freight" /> <!--<input type="text" class="span1" name="freight_tax[]" id="frtax" placeholder="Frt Tax" /> --> <input type="text" class="span2" name="total[]" id="total" /> And java script Code: <script language="javascript"> function getValues(val){ var numVal1=parseInt(document.getElementById("qty").value); var numVal2=parseInt(document.getElementById("price").value); var numVal3=parseInt(document.getElementById("discount").value); var numVal4=parseFloat(document.getElementById("tax").value); var numVal5=parseFloat(document.getElementById("freight").value); var sub_total = (numVal1 * numVal2) - numVal3; var subt_tax = sub_total * (numVal4/100); var total = parseFloat(sub_total + subt_tax); var totalValue = parseFloat(total + numVal5); document.getElementById("total").value = totalValue; } </script> Heres a link to the code in question http://www.scccs.ca/~W0049698/JavaTe...erlocktxt.htm# when the leftPos variable is used in the moveSlide() it somehow turns into Nan. Cant figure out why and have been racking my brain over this for a long time now.. Any help would be greatly appreciated the problem is at the end of the code(scroll to the bottom) ======================================================= Code: window.onload = makeMenus; var currentSlide = null; var timeID = null; function makeMenus(){ var slideMenus = new Array(); var allElems = document.getElementsByTagName("*"); for(var i=0 ; i < allElems.length ; i++){ if(allElems[i].className == "slideMenu") slideMenus.push(allElems[i]) } for(var i=0 ; i < slideMenus.length ; i++){ // alert(slideMenus.length) slideMenus[i].onclick = showSlide; slideMenus[i].getElementsByTagName("ul")[0].style.left = "0px"; } document.getElementById("head").onClick = closeSlide; document.getElementById("main").onClick = closeSlide; } function showSlide(){ slideList = this.getElementsByTagName("ul")[0]; if(currentSlide && currentSlide.id == slideList.id) {closeSlide()} else{ closeSlide(); currentSlide = slideList; currentSlide.style.display = "block"; timeID = setInterval("moveSlide()", 1); } } function closeSlide(){ if(currentSlide){ clearInterval(timeID); currentSlide.style.left="0px"; currentSlide.style.display="none"; currenSlide = null; } } Code: |