JavaScript - Making An Array Lowercase
Hi, just a quick question.
Is it possible to make an array lowercase at all? or can you only do this with a string? Thanks. Similar TutorialsI have a document list of several hundred drug names where some are lower case and some are all caps. I want to bold only the lower case drug names but don't want to do it manually. Is there a java script that I can apply where it automatically does that for me?
Hi there, I would like to sort the items regardless of uppercase/lowercase after moving them to another listbox. Here is my code, and I cannot figure out what is wrong with it. 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>Untitled Page</title> <script language="javascript" type="text/javascript"> function MoveItem(unselectedLst, selectedLst) { var unselectedEmail = document.getElementById(unselectedLst); var selectedEmail = document.getElementById(selectedLst); var uValue = unselectedEmail.value; var sValue = selectedEmail.value; if ((uValue != null) && (sValue != null)) { if( unselectedEmail.options.selectedIndex >= 0 ) { var newOption = new Option(); // Create a new instance of ListItem newOption.text = unselectedEmail.options[unselectedEmail.options.selectedIndex].text; newOption.value = unselectedEmail.options[unselectedEmail.options.selectedIndex].value; selectedEmail.options[selectedEmail.length] = newOption; //Append the item in selectedEmail unselectedEmail.remove(unselectedEmail.options.selectedIndex); //Remove the item from unselectedEmail //sort items in listbox in alpha order arrTexts = new Array(); for(i=0; i<unselectedEmail.length; i++) { arrTexts[i] = unselectedEmail.options[i].text; } arrTexts.sort(); for(i=0; i<unselectedEmail.length; i++) { unselectedEmail.options[i].text = arrTexts[i]; unselectedEmail.options[i].value = arrTexts[i]; } //sort items in listbox in alpha order arrayTexts = new Array(); for(i=0; i<selectedEmail.length; i++) { arrayTexts[i] = selectedEmail.options[i].text; } arrayTexts.sort(); for(i=0; i<selectedEmail.length; i++) { selectedEmail.options[i].text = arrayTexts[i]; selectedEmail.options[i].value = arrayTexts[i]; } } } else { alert('Select Item From The List. '); } } </script> </head> <body> <table width="300"> <tr> <td> <select id="ListBox1" name="ListBox1" size="6"> <option>One</option> <option>Two</option> <option>Three</option> </select> </td> <td> <p> <input onclick="MoveItem('ListBox1', 'ListBox2');" type="button" value="->" /> </p> <p> <input onclick="MoveItem('ListBox2', 'ListBox1');" type="button" value="<-" /> </p> </td> <td> <select id="ListBox2" name="ListBox2" size="6"> <option>allalong@msn.com</option> <option>boys@hotmail.com</option> <option>cy@yahoo.com</option> <option>bread@hotmail.com</option> <option>eetApple@ymail.com</option> <option>applepie@gmail.com</option> </select> </td> </tr> </table> </body> </html> I'm a newbie...please! html lists making javascript array I need help with a HTML UL I have ul inside ul but all I want to get when I select a certain list is the children of that list but remove the ul inside that list so they dont show at all http://pastebin.com/m98deaff any help would be great , current selecting code is http://pastebin.com/m6f4b886f Code: <div class="demo" id="demo_1"> <ul> <li id="1" class="open"><a id="1" href="#"><ins> </ins>Root node 1</a> <ul> <li id="2"><a id="2" href="#"><ins> </ins>Child node 1</a></li> <li id="3"><a id="3" href="#"><ins> </ins>Child node 2</a></li> <li id="4"><a id="4" href="#"><ins> </ins>Some other child node with longer text</a></li> <li id="6"><a id="6" href="#"><ins> </ins>Root node 222</a> //SHOUL NOT BE IN MY ARRAY <ul> <li id="7"><a id="7" href="#"><ins> </ins>Child node 222a</a></li> <li id="8"><a id="8" href="#"><ins> </ins>Child node 222b</a></li> <li id="9"><a id="9" href="#"><ins> </ins>Some other child node with longer text 222</a></li> </ul> //END OF UL ELEMENT N OT NEEDED THERE COULD BE more than 1 </li> </ul> </li> <li id="5"><a id="5" href="#"><ins> </ins>Root node 2</a></li> </ul> Hello, Im hoping someone can help me, Im trying to pass fields to a javascript function that will check the value of each field and it its empty then it will turn the field color red which is what its doing at the moment, but i want to be able to use this function globaly through out my project, so is there a way of not saying how many fields go in to that array, it will just deal with the amount of fields it gets passed? Thanks Okay so to be short, I'm trying to make a script similar to a link checker but instead of having to input each link in one by one and click a button (A button saying Validate, for instance), I was looking for something that would do it automatically? Example - 1. First I input the link http://www.example.com/posts.php?do=1000000000 and click Start or Validate. 2. After clicking Start or Validate, the validator or script would begin checking links, modifying the http://www.example.com/posts.php?do=1000000000 to http://www.example.com/posts.php?do=1000000001 and so on and so on, until it reached all 9's. 3. After the scanning, every existent link (Meaning links that didn't give the 404, or re-direct to another page) would be displayed in the page below or a log file. I really appreciate the help everyone, since I'm still into learning about Javascript. Thanks in advance! I am working on a page where the user will select a location from a dynamically generated dropdown list. I was able to create the php multidimensional array (tested and working) from a MySql database using the users information at login, but I'm having problems converting it to a javascript multidimensional array. I need to be able to access variables that I can pass to a number of text fields within an html form. For instance, if a user belongs to a company with multiple addresses, I need to be able to let them select the address they need to prepopulate specific text fields. php array creation: Code: if ($row_locations) { while ($row_locations = mysql_fetch_assoc($locations)) { $mail[$row_locations['comp_id']]=array('mailto'=>$row_locations['mailto'], 'madd'=>$row_locations['madd'], 'madd2'=>$row_locations['madd2'], 'mcity'=>$row_locations['mcity'], 'mstate'=>$row_locations['mstate'], 'mzip'=>$row_locations['mzip'], 'billto'=>$row_locations['billto'], 'badd'=>$row_locations['badd'], 'badd2'=>$row_locations['badd2'], 'bcity'=>$row_locations['bcity'], 'bstate'=>$row_locations['bstate'], 'bzip'=>$row_locations['bzip']); } } javascript function - this should create the array and send variables to text fields. Code: function updateAddress() { var mail = $.parseJSON(<?php print json_encode(json_encode($mail)); ?>); { if (comp_id in mail) { document.getElementById('mailto').value=mail.comp_id.mailto.value; document.getElementById('madd').value=mail.comp_id.madd.value; document.getElementById('madd2').value=mail.comp_id.madd2.value; document.getElementById('mcity').value=mail.comp_id.mcity.value; document.getElementById('mstate').value=mail.comp_id.mstate.value; document.getElementById('mzip').value=mail.comp_id.mzip.value; } else { document.getElementById('mailto').value=''; document.getElementById('madd').value=''; document.getElementById('madd2').value=''; document.getElementById('mcity').value=''; document.getElementById('mstate').value=''; document.getElementById('mzip').value=''; } } } Where is this breaking? Thanks in advance. I'm working on making a searchable javascript and DOM reference...A chm like what php has. I mainly need it for myself because I don't always have access to the net. I was wondering if anyone would like to contribute? Hello, I'm un-sure on what I should have called this topic so sorry for the possibly mis-leading topic name. Firstly, my menu bar is attached to the top of the clients screen as seen here. Secondly, I've been wondering how could I make it so when a button is pressed another div around 40px in height would appear above it(that div is also attached to the clients screen). For example I saw http://9gag.com/, when you click on search button in the top right hand corner the search bar appears ontop of the menu bar. My JavaScript knowledge is very limited, I know how to make a div appear with the click of a button, but how can I make it be attached to the top of the clients browser and the menu bar in under it? Codes Menu bar Code: <ul id="menu"> <li><a href="index.php">Home</a></li> <li><a href="Online.php">Server</a> <ul> <li><a href="Online.php">Server</a></li> <li><a href="Bans.php">Bans</a></li> <li><a href="Search.php">Search</a></li> <li><a href="rules.php">Rules</a></li> </ul> </li> <li><a href="http://thepilotslife.com/forums">Forums</a></li> <li><a href="Donate.php">Support Us</a> <ul> <li><a href="Donate.php">Support Us</a></li> <li><a href="Donate.php">Donate</a></li> <li><a href="Ad.php">Advertising</a></li> </ul> </li> <li><a href="Highscores.php">Highscores</a></li> <li><a href="Airlines.php">Airlines</a></li> <li><a href="Forms.php">Forms</a> <ul> <li><a href="">Forms</a></li> <li><a href="">Report Player</a></li> <li><a href="BanAppeals.php">Appeal Ban</a></li> </ul> </li> <?php echo "<li><a href='Help.php'>Help</a>"; echo "<ul>"; echo "<li><a href='Help.php'>Help</a></li>"; echo "<li><a href='Help.php'>Topics</a></li>"; echo "<li><a href='Help.php?submit=1'>Submit</a></li>"; if(isset($_SESSION['username'])) { if($_SESSION['Admin'] == 5) { echo "<li><a href='ViewHelp.php'>New Topics</a></li>"; } } echo "</ul>"; echo "</li>"; if(isset($_SESSION['username'])) { echo "<li><a href='user.php?user=$_SESSION[username]'>$_SESSION[username]</a>"; echo "<ul>"; echo "<li><a href='user.php?user=$_SESSION[username]'>$_SESSION[username]</a></li>"; echo "<li><a href='logout.php'>Logout</a></li>"; echo "</ul>"; } else { $path = $_SERVER['SCRIPT_NAME']; echo "<li><a href='login.php?path=$path'>Login</a></li>\n"; } ?> </ul> Menu bar CSS code. Code: #menu { height: 34px; position: fixed; width: 100%; z-index: 15; top: 0; } #menubar { color: #B4B4B4; border-top: 1px solid #363636; border-bottom: 1px solid #363636; background: #292929; background-image: -moz-linear-gradient(top, #292929, #333, #232323); background-image: -webkit-gradient(linear, left top, left bottom, from(#292929), to(#232323), color-stop(0.5, #333)); background-repeat: repeat; filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr=#292929, endColorStr=#232323); } #menubarcont { width: 900px; height: 34px; } #menubarcont ul { margin: 0; padding: 0; list-style: none; } #menubarcont ul li { display: block; position: relative; float: left; } #menubarcont li ul { display: none; } #menubarcont ul li a { display: block; text-decoration: none; white-space: nowrap; } #menubarcont li:hover ul { display: block; position: absolute; } #menubarcont li:hover li { float: none; font-size: 11px; } #menubar ul li { display: inline; } #menubar ul li a { float:left; line-height: 34px; font-size: 12px; width: 100px; margin: 0 0 0 0px; text-decoration: none; font-family: 0.75em/1.5 'Lucida Grande', sans-serif; color: #B4B4B4; background: #292929; background-image: -moz-linear-gradient(top, #292929, #333, #232323); background-image: -webkit-gradient(linear, left top, left bottom, from(#292929), to(#232323), color-stop(0.5, #333)); background-repeat: repeat; filter: progid:DXImageTransform.Microsoft.Gradient(startColorStr=#292929, endColorStr=#232323); } #menubar ul li a:hover { color: #FFFFFF; background: #222; } Thanks for reading and hopefully somebody can point me in the right direction. I'm decent at JavaScript but I have no idea how I should go about making a calculator. So far I'll drop a bunch of buttons down that all onclick to a function (a,b) and then it will add or w/e then return. How would I incorporate multiple methods such as subtraction or multiplication though? Basically I'm confident I the ability to code or learn to make this calculator, just have no idea how to set this up, thanks. Right now I am using the following method to show/hide divs containing videos. html Code: <div class="vidPop" id="vidPop"> <div class="vidFrame" id="vidFrame"> <iframe id="Iframe1" src="http://player.vimeo.com/video/xxxxxxx1" width="640" height="360" frameborder="0"></iframe> <div class="vidClose"><a href="#" onclick="vidPopdown()"><img src="images/closeban.png" width="52" height="52" alt="close" /></a></div> </div> </div> <div class="vidPop2" id="vidPop2"> <div class="vidFrame2" id="vidFrame2"> <iframe id="Iframe2" src="http://player.vimeo.com/video/xxxxxxx2" width="640" height="360" frameborder="0"></iframe> <div class="vidClose"><a href="#" onclick="vidPopdown2()"><img src="images/closeban.png" width="52" height="52" alt="close" /></a></div> </div> </div> js Code: function vidPopup() { var o = document.getElementById('vidPop'); o.style.visibility = 'visible'; o = document.getElementById('vidFrame'); o.style.visibility = 'visible'; } function vidPopdown() { var o = document.getElementById('vidPop'); o.style.visibility = 'hidden'; o = document.getElementById('vidFrame'); o.style.visibility = 'hidden'; document.getElementById('Iframe1').src = document.getElementById('Iframe1').src } function vidPopup2() { var o = document.getElementById('vidPop2'); o.style.visibility = 'visible'; o = document.getElementById('vidFrame2'); o.style.visibility = 'visible'; } function vidPopdown2() { var o = document.getElementById('vidPop2'); o.style.visibility = 'hidden'; o = document.getElementById('vidFrame2'); o.style.visibility = 'hidden'; document.getElementById('Iframe2').src = document.getElementById('Iframe2').src } all of this works just fine, but now I am adding yet another video, and I know that this isn't the best way to go about doing this. I ought to be able to use 1 function and tell it which iframe to load, however I dont really know javascript. Any and all help on this would be greatly appreciated. Hi all, I have a client who wants a gallery of images to pop up on her enter page similar to this site, http://bit.ly/mUscmo . It won't be identical, but she likes the way the images all pop up and then just stay there. I know how to function JavaScript, but I don't know how to write it from scratch. Is there any where I could find a code that does something similar to this? Or, does anyone know the basic coding that I'd need for this? Thanks! Q Hello, To start I want to say I'm a newbie at coding/programming and all that so I would appreciate a lot if the explanations would be more thorough. I have a wordpress website (so i guess it can run javascript) and I want to create these tables where certain rows could be clicked and would expand for more information, I made an image for an illustration http://i44.tinypic.com/hurdoz.png . I would so appreciate any help that could tell simple steps how to achieve this, I guess this is a trivial problem to some of you but to me.. i don't know where to begin so yeah, I'm waiting for anything :] hey guys, new to the forum here but i think i may be staying here for the long haul i've lurked around here a while but recently i havent been able to find a solution to something i'm having trouble with. i need to create a script that allows me to take an image and a button and apply it to the page the button will have a value of "Start" and when the "onClick" event is triggered the image will begin to reposition itself towards the right side of the page (as if it were panning towards the right, like if it were on wheels). once it reaches the end of the window i have get it to come back to the starting position and just keep on looping. the trickiest part (imo) is getting the value of the button to change to "stop" and onClick it needs to reset everything back to neutral. now i am a HUGE javascript "nub" and i dont want someone to do the code for me, i just want some help. i need to learn this. i'll post what i have so far in post #2. if anyone can help with this ASAP i would love you forever. thanks! Hello, I'm trying to make sure that my email field contains at least 5 characters and the @ symbol. I've been trying to do this using an if...else loop, but so far I've only been running into brick walls. I think my problem is I don't know what to use when it comes to document.form1.email.value This is the latest script I tried: Code: <html> <head> <title>Form Example</title> <script language="JavaScript" type="text/javascript"> function validate() { if (document.form1.yourname.value.length < 1) { alert("Please enter your full name."); return false; } if (document.form1.address.value.length < 3) { alert("Please enter your address."); return false; } if (document.form1.phone.value.length < 3) { alert("Please enter your phone number."); return false; } if (document.form1.email.value.length < 5) alert("Please enter at least 5 characters."); else if (document.form1.email.value.match(@)) alert("Please enter an @ symbol."); return false; return true; } </script> </head> <body> <h1>Form Example</h1> <p>Enter the following information. When you press the Submit button, the data you entered will be validated, then sent by email.</p> <form name="form1" action="mailto:user@host.com" enctype="text/plain" method="POST" onSubmit="return validate();"> <p><b>Name:</b> <input type="TEXT" size="20" name="yourname"> </p> <p><b>Address:</b> <input type="TEXT" size="30" name="address"> </p> <p><b>Phone: </b> <input type="TEXT" size="15" name="phone"> </p> <p><b>Email Address: </b> <input type="TEXT" size="30" name="email"> </p> <p><input type="SUBMIT" value="Submit"></p> </form> </body> </html> Hi all, I'll get it out their early, I am somewhat of a javascript novice. Here is the code I am working with: Code: <script type="application/javascript"> $(document).ready(function() { var numitems = $("#foo6 > li").length; var secondstartpoint = numitems -3; }); </script> <script type="text/javascript" language="javascript"> $(function() { $("#foo6").carouFredSel({ width : 136, height: 822, scroll : { items:1 }, items : { visible: 6, start: secondstartpoint }, easing:"swing", auto : false, prev : "#next3", next : "#prev4", direction:"down", align:"left" }); }); </script> As you can probably see I am trying to set the start point of a jquery carousel to equal a variable that I have created. You can see I have tried " start: secondstartpoint", but this isn't working. I think possibly because the way the plugin is formatted so that the "start" option can only equal a number. Can anyone shed some light on this issue and perhaps even suggest a solution? Thanks in advance guys Dan dear all i have some read only text box which i want to get in write mode the code i am trying is.. function f2(txt1,txt2,txt3) { document.form1.txt1.readOnly=false; document.form1.txt2.readOnly=false; document.form1.txt3.readOnly=false; } <input type="text" value="<%=rset.getString(1)%>" readonly id="tex" class="tb2" name="u_name_0"></td> <td><input type="text" value="<%=rset.getString(2)%>" readonly class="tb2" name="u_pass_0"></td> <td><input type="text" value="<%=rset.getString(3)%>" readonly class="tb2" name="u_role_0"></td> <td><input type="submit" value="delete" name="submit_<%= i%>" class="tb3"></td> <td><input type="button" value="update" onClick="f2('u_name_0','u_pass_0','u_role_0')"></td> but its not working.. some body help me out.. I need to set javascript so that if the time is: Less than 11. More than 11.15 but less than 12.50. More than 13.45 but less than 15.30. it will redirect the user to a choosen URL. Here is my general idea: Code: var d = new Date(); var hours = d.getHours(); var minutes = d.getMinutes(); if (hours > ect............) { alert("Alert Here") window.location = "URL HERE"; } So can anyone help me here I would REALLY appreciate it thanks So simply put. You are redirected away from the page UNLESS it is 11.00 -> 11.15 OR 12.55 -> 13.45 OR past 15.30 Hey I'm a beginner so bare with me, don't have much knowledge of Javascript so any help would be great Im trying to write coding for entering a password into a prompt box, Ive got the prompt to work however I only want the password to work if 7 characters are entered, here is what I have: var strPromptBox; var strPasswordLength; function validatePassword() { strPromptBox=prompt ("Please enter your password below") } while (strPasswordLength <char(6) || strPasswordLength >char(6) ) { alert ("Please try again"); } I know its wrong and probably not even on the right lines of what I should be doing so any help would be great Hi! I need to make my own web page with quiz on it! Something like this http://www.javascriptkit.com/script/popquiz.htm The main problem - how to calculate scores? I need to make, for example, pop up box that shows, how many answers are right/wrong. What should I use for that? I'm sure this question has been asked, but I tried searching for this answer using many different keywords, but I don't know the correct terminology for my question, as the search results turn up other topics. I'm wondering if there's simple code for clicking on a thumbnail to have a larger version of the picture appear above, but still within, the same webpage, and the background darkens a little. The larger picture has a "close" button, which you click to get back to the underlying original page. An very simple example of the type I'm looking for is he http://www.salon.com/comics/tomo/200...omo/index.html I'm assuming this is a java script that does this. I'm using DreamWeaver. Does Adobe have this type of coding in their "Spry" coding? If not, is there a simple template of the code out there? Thank you for any help. |