JavaScript - Newbie Need Some Help With A Java Script Array
Hi guys,
i am trying to work with google maps api my issue is with creating an array of markers count the number of marker, and then if it equal two, issue an error msg. i wrote some code, but that doesn't work obviously. and my question is how do i write that code in javascript ? GEvent.addListener(map, 'click', function (overlay, latlng) { if (placeMarker.length < 2) { pendingLatLng = latlng; setTimeout("settleClick()", 225) } else { message("You can only select 2 points."); } }); a sample click event which looks like the line below does work. what am i doing wrong ?: google.maps.event.addListener(map, 'click', function (event) {placeMarker(event.latLng); }) Similar Tutorialshi I'm just new to java and I'm trying to write a script that will shuffle the information in a array with no gaps and no repeats. below is that code that i have so far. thanks ben [CODE] //constants SWAPS_TO_BE_MADE = 30; //variables var myArray = new Array('Ace',2,3,4,5,6,7,8,9,10,'Jack','Queen','King'); // the array that entities will be shuffled from var temp = 0; var outPutArray = new Array (12); var arrayLength = myArray.length; var index = 0; var swapIndex = 0; var self_swaps = 0; var counter = 0; temp=myArray[swapIndex] document.write('<h1>Array shuffling</h1>'); document.write('<p>Before shuffle: '+myArray+'</p>'); //loop while(counter < SWAPS_TO_BE_MADE) { index =Math.floor(Math.random()*arrayLength); swapIndex =Math.floor(Math.random()*arrayLength); var index_value = index; var range = 1; myArray.splice(index_value,range,'spilced'); outPutArray[swapIndex] = index; if(index == swapIndex) { self_swaps++; } counter++; index = (index + 1 % arrayLength); swapIndex= (swapIndex + 1 % arrayLength); } document.write('<p>After shuffle: '+outPutArray+'</p>'); document.write('<p>After shuffle: '+myArray+'</p>'); [ICODE] Not much programming experience, but some C++ and Python. I would like to make a web page that 1. flashes and image for 1 second 2. flashes a a pair of images for 1 second 3. displays an image and waits 4. Wait for a certain correct keystroke to be entered. 5. Repeat 1-4 a few hundred times. ^The above would iterate through a loop, say of 300 counts, and sub-iterate through an array of images, say 30, going through all 30 images 10 times for example. Oh, and the array elements would be displayed in random order. Also, I would like to keep track of errors (wrong keystroke) and time it took to enter correct keystroke. I would prefer that this webpage work on the iphone, even older ones. Java is limited on iphone? I tried playing a Java chess game and had no luck on iphone. So, would I be able to do this using Javascript? If not, Java would be best? As I said, I would prefer iphone compatibility, but it is not required. I just want to know which one I should use before I bury my nose in a book about programming Java or Javascript. I need to assign a key in the javascript to actually make the javascript work,. I have a bookmark in chrome , a javascript , which actually works when clicked on it .,. but how can i edit it so that i can actually make it work on click a key or combination of keys. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. i want to declare the key or keycombo in the script itself .,. the script is for catching the selected text on the webpage and opening a new tab(or window) and doing an exact search search of the selected text using google.com .,., So I want it to work it this way ., select the text press a key and it opens a new tab (or window) with an xact search .,. Thanks in advance ., Nani how to get first 4 digits of mobile number using substing method and then how to check that number in if condition using java script.that is i entered the mobile number 9688786064.i want to check first four digits 9688 .in that same check all the entered number only 9688 started nymber can allow to store data base..how can i develop the program..plz help me var ph1=document.getElementById('ph'); ph1=ph.substring(0,4) is it correct or not .if it is correct then tell further steps.if it wrong tell me the correct code hi i want to implement this java script . This is the Original Java script page . Where you see if i click on the yahoo or | google buttons the new window is loading and the same page is displaying with a tab bar menu and close button. I want to implement the same on one of my documents where i created css and java script based drop down menus. But when i tried to implement the same java script on my own page its not working properly.Please help me fix it . I have changed the code only on Button -4 Link-1 only Hers the Live Demo of the page : Live Demo Of the page Heres the Java Script: Java Script Here's the CSS : Code: html,body { padding:0; margin: 0px; background: #306f80; } #wrapper{ width: 1024px; margin-right: auto; margin-left: auto; background: #FFFFFF; height: 1000px; } #header{ height: 100px; width: 1024px; background: url(../images/header.png) repeat-x; } .icons_hold{ float: right; height: 55px; width: 200px; position: relative; top: 10px; right: 10px; } .navestyle{ width: 1024px; font-weight: bold; margin-right: auto; margin-left: auto; } .navestyle:after{ /*Add margin between menu and rest of content in Firefox*/ content: "."; display: block; height: 0; clear: both; visibility: hidden; } .navestyle ul{ border: 1px solid #BBB; width: 100%; background: url(../images/nav_bg.png) repeat-x center center; /*THEME CHANGE HERE*/ padding: 4px 0; margin: 0; text-align: center; font: 12px Verdana, Arial, Helvetica, sans-serif; } .navestyle ul li{ display: inline; margin-right: 2px; margin-left: 2px; } .navestyle ul li a{ color: #494949; padding: 4px 45px 4px 7px; margin: 0; text-decoration: none; border-right: 1px solid #DADADA; } .navestyle ul li a:hover, .navestyle ul li a.selected{ /*script dynamically adds a class of "selected" to the current active menu item*/ background: url(../images/hover.png) repeat-x center center; /*THEME CHANGE HERE*/ color: #FFFFFF; } /* ######### Style for Drop Down Menu ######### */ .dropmenudiv{ position:absolute; top: 0; border: 1px solid #BBB; /*THEME CHANGE HERE*/ border-bottom-width: 0; font:normal 12px/18px Verdana, Arial, Helvetica, sans-serif; z-index:100; background-color: white; visibility: hidden; width: 200px; } .dropmenudiv a{ width: auto; display: block; text-indent: 3px; border-bottom: 1px solid #BBB; /*THEME CHANGE HERE*/ padding: 2px 0; text-decoration: none; font-weight: bold; color: black; } * html .dropmenudiv a{ /*IE only hack*/ width: 100%; } .dropmenudiv a:hover{ /*THEME CHANGE HERE*/ background-color: #F0F0F0; } img { border: none; } .pagination{ padding: 0px 2px 2px; clear: both; } .pagination ul{ margin: 0; padding: 0; text-align: center; /*Set to "right" to right align pagination interface*/ font-size: 16px; } .pagination li{ list-style-type: none; display: inline; padding-bottom: 1px; } .pagination a, .pagination a:visited{ padding: 0 5px; border: 1px solid #9aafe5; text-decoration: none; color: #2e6ab1; } .pagination a:hover, .pagination a:active{ border: 1px solid #2b66a5; color: #000; background-color: #FFCC33; } .pagination a.currentpage{ background-color: #2e6ab1; color: #FFF !important; border-color: #2b66a5; font-weight: bold; cursor: default; } .pagination a.disablelink, .pagination a.disablelink:hover{ background-color: white; cursor: default; color: #929292; border-color: #929292; font-weight: normal !important; } .pagination a.prevnext{ font-weight: bold; } #demoArea { padding: 10px ; height: 580px ; background: #FFFFFF ; /*border: 1px solid black ;*/ /*display: table ;*/ } #demoLinks { width: 20% ; border-right: 1px dotted blue ; float: left ; } #demoBrowser { position: relative; width: 950px; margin-left: auto; margin-right: auto; } #tabBrowser { position: absolute ; width: 100% ; } /* --------------- TABS -------------------*/ #tabDemo { display: none } #tabContainer { display: block ; } #tabs { cursor: default ; list-style-type: none ; /*width: 560px ;*/ margin: 0 ; padding: 0 ; } #tabs li { background: #FFFBF0 ; border: 1px solid green ; border-bottom: 0 ; -moz-border-radius-topleft: 5px ; -moz-border-radius-topright: 5px ; float: left ; width: 100px ; min-width: 35px ; height: 20px ; margin: 0 2px 3px 0 ; padding-left: 3px ; } .tabTitle { float: left ; width: 80% ; height: 100% ; overflow: hidden ; } .closeTab { text-align: center ; text-transform: uppercase ; margin: 2px 3px 2px 80% ; border: outset 1px #D40000 ; } .closeTab:hover { background: #000000; } /* --------------- BROWSER -------------------*/ #tabContent { position: relative ; clear: both ; width: 100% ; } #tabContent div { position: absolute ; width: 100% ; } Here's the Mark Up : 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" lang="en" xml:lang="en"> <head> <title>Testing page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" type="text/css" href="css/css.css" /> <script type="text/javascript" src="js/tabbed_browser.js"></script> <script type="text/javascript" src="js/chrome.js"> </script> </head> <body> <div id="wrapper"> <div id="header"> <div class="icons_hold"><a href="#"><img src="images/home.png" title="home" /></a> <a href="#"><img src="images/help.png" title="help" /></a> <a href="#"><img src="images/sign_out.png" title="signe out" /></a></div> </div> <div class="navestyle" id="navemenu"> <ul> <li><a href="#" title="chaitnyas testing page">Button-1</a></li> <li><a href="#" title="chaitnyas testing page">Button-2</a></li> <li><a href="#" title="chaitnyas testing page">Button-3</a></li> <li><a href="#" rel="dropmenu1" title="chaitnyas testing page">Button-4</a></li> <li><a href="#" rel="dropmenu2" title="chaitnyas testing page">Button-5</a></li> <li><a href="#" rel="dropmenu3" title="chaitnyas testing page">Button-6</a></li> <li><a href="#" title="chaitnyas testing page">Button-7</a></li> <li><a href="#" title="chaitnyas testing page">Button-8</a></li> </ul> </div> <!--1st drop down menu --> <div id="dropmenu1" class="dropmenudiv"> <a id="link1" onclick="openTab('link1')" href="http://yahoo.com." title="chaitnyas testing page" ><img src = "images/1.gif" /> Link-1</a> <a href="link-2.htm" title="chaitnyas testing page"><img src = "images/2.gif" /> Link-2</a> <a href="link-3.htm" title="chaitnyas testing page"><img src = "images/3.gif" /> Link-3</a> <a href="link-4.htm" title="chaitnyas testing page"><img src = "images/4.gif" /> Link-4</a> <a href="link-5.htm" title="chaitnyas testing page"><img src = "images/5.gif" /> Link-5</a></div> <!--2nd drop down menu --> <div id="dropmenu2" class="dropmenudiv" style="width: 150px;"> <a href="#" title="chaitnyas testing page"><img src = "images/6.gif" /> Link-1</a> <a href="#" title="chaitnyas testing page"><img src = "images/7.gif" /> Link-2</a> <a href="#" title="chaitnyas testing page"><img src = "images/8.gif" /> Link-3</a></div> <!--3rd drop down menu --> <div id="dropmenu3" class="dropmenudiv" style="width: 150px;"> <a href="#" title="chaitnyas testing page"><img src = "images/9.gif" /> Link-1</a> <a href="#" title="chaitnyas testing page"><img src = "images/10.gif" /> Link-2</a> <a href="#" title="chaitnyas testing page"><img src = "images/11.gif" /> Link-3</a></div> <script type="text/javascript"> cssdropdown.startchrome("navemenu") </script> <p><br /> <div id="demoBrowser"> <div id="tabBrowser"> <div id="tabContainer"> <ul id="tabs"><li id="tabDemo"><div class="tabTitle">Google</div><div class="closeTab">x</div></li> </ul> </div> <div id="tabContent"> </div> </div> </div> </div><br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> </p> <div class="pagination"> <ul> <li><a href="products.htm" class="currentpage" title="Products">1</a></li> <li><a href="products1.htm" title="Products">2</a></li> <li><a href="products2.htm" title="Products">3</a></li> </ul> </div><br /> </p> </div> </body> </html> please hekp to sort this out.. .. The price of a ticket to a passenger on AOU-Airways is computed based on the following table: [9] Class Price First Class KD 300 Economy Class (with meal) KD 150 Economy Class (without meal) KD 130 Using nested if statements, write a JavaScript code which will work according to the following specifications: a. Read the class that the passenger wants to travel on. b. If the class is the first class, print the price of ticket. c. If the class is the economy class, ask the user if he/she wants a meal on the flight. Then print the price of the ticket according to the response of the passenger. The program should simply accept one possible strings the user enters; it is not required to work for all possible inputs such as First, first, FIRST or Yes , yes, YES. I was hoping someone could help me fix this javascript code. I have been working for hours and it does not work. <html> <head> <title>Moondoe's Coffee House</title> </head> <script type="text/javascript"> var drink, ounces; prompt( "Enter the drink type:espresso, latte, cappuccino, americano" ); prompt( "Enter the ounce size: 8, 12, 16" ); var shots = prompt ( "Enter the number of shots" ); if ( drink == "espresso") price = 1.40; if ( drink == "latte") || drink == "cappuccino" ) { if ( ounce == 8 ) price = 1.95; else if ( ounce == 12 ) price = 2.35; else if ( ounce == 16 ) price = 2.75; } if ( drink == "americano" ) price = 1.20 + ( ( (ounce/8) -1 ) * .30 ); price = price + ( (shots-1) * .50 ); price = price * 1.055; price = Math.round ( price*100 ) /100; alert ( "Your " + ounce + "oz. " + drink + "with " + shots + "\nshots of espresso costs: $ " + price ); alert( "drink = " + drink + "ounce = "ounce + "shots = "shots ); </script> </html> hi, i have a html form and i have three text boxes named Max Accessories: Accessory SKU: Accessory CPC ID: and i want a javascript functionality like, if the user enters in the max accessories text box value as 1, then the below two text boxes should update like automatically like below, AcceSsory 1 SKU ACCESSORY 1 CPC ID SIMILARLY if user enters Max accessories value as 2 in the text box, then the below two text boxes should update like automatically like below AcceSsory 1 SKU ACCESSORY 1 CPC ID AcceSsory 2 SKU ACCESSORY 2 CPC ID onchange of the key, for accessory it should call some function in the same page and dynamically update. can any one please provide, a solution for this , thanks. Can someone help me with this javascript? It works fine with 10 images, but when I add the 11th it will not rotate the 11th image but still rotate the 1st 10. <br> <script type="text/javascript"> var imgs1 = new Array("/resource/resmgr/Ad_Banner/ad16.jpg","/resource/resmgr/Ad_Banner/ad13.jpg","/resource/resmgr/Ad_Banner/ad14.jpg","/resource/resmgr/Ad_Banner/ad8.jpg","/resource/resmgr/Ad_Banner/ad15.jpg","/resource/resmgr/Ad_Banner/ad18.jpg","/resource/resmgr/Ad_Banner/ad12.jpg","/resource/resmgr/Ad_Banner/ad19.jpg","/resource/resmgr/Ad_Banner/ad20.jpg","/resource/resmgr/Ad_Banner/ad21.jpg","/resource/resmgr/Ad_Banner/ad21.jpg","/resource/resmgr/ad_Banner/ad3.jpg"); var lnks1 = new Array("http://www.adamscollision.com","http://www.huntleyrealty.com","http://www.trinitycpraed.com","http://www.sccah.com/?page=SCFestival","http://www.blazekshomefurnishings.hdspd.com","http://www.sccah.com/?page=JB_Const","http://tgconsultantsinc.com/","http://blueskiespilotshop.com/index.html ","http://www.aaaglass.com/ ","http://www.carytravelexpress.com/","http://www.sccah.com/?page=Ad_Inquiry "); var alt1 = new Array("Adams Collision","Huntley Realty","Trinity","Sun City Arizona","Hunter Douglas Window Coverings and Custom Draperies","J&B Construction","TGI Consulting","Blue Skies","AAA Glass","Cary Travel Express","THIS COULD BE YOUR AD!!!"); var currentAd1 = 0; var imgCt1 = 11; function cycle1() { if (currentAd1 == imgCt1) { currentAd1 = 0; } var banner1 = document.getElementById('adBanner1'); var link1 = document.getElementById('adLink1'); banner1.src=imgs1[currentAd1] banner1.alt=alt1[currentAd1] document.getElementById('adLink1').href=lnks1[currentAd1] currentAd1++; } window.setInterval("cycle1()",4000); </script> <a href=""http://www.adamscollision.com"" id="adLink1" rel="nofollow" target="_blank"> <img src="/resource/resmgr/Ad_Banner/ad16.jpg" id="adBanner1" border="0" width="170" height="200"></a> hi i have this code i want to put a java script for this java scrip should be (amt1*amt2)+(amt3)*(amt4)=amt5 if (amt1*amt2)+(amt3)*(amt4) > amt5 should giver mesage on keyup of amount amt4 plzz help me how do i put javascript for this ...........plz help me Code: <table width="1113" height="99" border="0"> <tr bgcolor="#99FF66"> <td width="60"><div align="center"><strong>GROUP ID</strong></div></td> <td width="46"><div align="center"><strong>PART ID</strong></div></td> <td width="97"><div align="center"><strong>ITEM NAME</strong></div></td> <td width="144"><div align="center"><strong>UNIT</strong></div></td> <td width="144"><div align="center"><strong>a/b/c</strong></div></td> <td width="144"><div align="center"><strong>Qty/Crtn</strong></div></td> <td width="144"><div align="center"><strong>Nbr of Crtns</strong></div></td> <td width="144"><div align="center"><strong>Nett Wt/Crt</strong></div></td> <td width="152"><div align="center"><strong>Grs Wt/Crtn</strong></div></td> </tr> <?php $noofrow=0; $result10 = mysql_query("SELECT * FROM Ibws_Data WHERE Sc_No='$PcNo' AND Seq_No='$SeqNo' "); // $row1000 = mysql_fetch_array( $result1000 ); //$Sub_Total=""; while($row10 = mysql_fetch_array( $result10 )) { //$ttlamt=mysql_number_format(); $noofrow++; ?> <tr bgcolor="#99CC66"> <td><label> <?php echo '<input name="Group_ID'.$noofrow.'" value="'.$row10['Group_ID'].'" type="text" size="8" maxlength="12" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Part_ID'.$noofrow.'" value="'.$row10['Part_ID'].'" type="text" size="8" maxlength="12" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Name'.$noofrow.'" value="'.$row10['Name'].'" type="text" size="20" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="Unit'.$noofrow.'" value="'.$row10['Unit'].'" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="cat'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt1'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt2'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt3'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt4'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> <td><label> <?php echo '<input name="amt5'.$noofrow.'" value="a" type="text" size="8" maxlength="25" readonly="readonly" style="text-align:center" />' ; ?> </label></td> </tr> <tr> <td><label> <input type="submit" name="button" id="button" value="Submit" /> </label></td> <td><label></label></td> <td><label></label></td> <td> </td> <td><label></label></td> <td><label></label></td> </tr> </table> <p> </p> <p> </p> </form> plz help me with a sample java scrip code Hi everyone , I have been working with java script for a couple of weeks now and have run into some practice obstacles, ok so I am trying to build a html java program for my website and I wants there to be a web page in which users can dynamically change the styles of page elements (e.g.,background, text) by typing the style name into a dialog box. So basically enter a word and the that word should be set to change the attributes once entered in. Ive tried working with if else statements but have run into many problems. Again I am a beginner and am trying to self teach myself if you all could help me that would be great. Thanks Sash Hey, so I have successfully used this tutorial; http://articles.sitepoint.com/articl...y-javascript/3 to create a web page that "smoothscrolls" down to a certain point of content on the page. So, I know the java works! My problem is, I have changed the website to be along the X axes and not the Y, so instead of it scrolling "down" the page, I would like it to scroll from left to right. i.e on the X axes not the Y. Is there anyway of doing this by editing that java file? All my buttons work and display the correct part of the website, but the java doesn't work slidiing sideways. Thank you in advance! Darren i am getting error in document.createElement('input') index1 = { init: function() { var but=document.getElementById('button1'); index1.addEvent(but,'onClick',fun1,false); }, fun1: function(e) { var bo=document.getElementById('body1'); var in=document.createElement('input'); in.type="button"; in.value="songs"; in.id="song"; bo.appendChild(in); } } index1.addEvent(window,'load',index.init,false); Hi, i have multiple check box and text box for each check box. the check box value is given as text box name ex Checkbox <input type="checkbox" name="cBx" value=" txtname1 "/> Textbox <input type="text" name=" txtname1 " /> how to get the text box value (txtname1) on calling the below function function get_textBox_value() { var c_chkBoxName = ""; var c_txtBoxValue = ""; for (var i=0; i < document.Formname.cBx.length; i++) { if (document.Formname.cBx[i].checked) { c_chkBoxName= document.Formname.cBx[i].value; //working fine... c_txtBoxValue = document.Formname. c_chkBoxName .value; // not working... how to pass the chkbox value for c_txtBoxName } } } Hey ! You know I'm now trying to use that light box embed contact form in my page http://uniwebmart.com/roshan and that fade in fade out effect as well which you can see now in LCD. But when I use the java script of that embed contact form in lightbox, my previous script of fading doesn't work. <script type="text/javascript" src="scripts/prototype.js"></script> <script type="text/javascript" src="scripts/lightbox.js"></script> <script type="text/javascript" src="js/jquery.min.js"></script> <script type="text/javascript" src="js/fadeslideshow.js"></script> bold one is newly added script. Can't figure out the mistake. Can you please help me once again people??? Hiya all, I'm new here and fairly new to JavaScript and coding - one of my teachers said it would be a fun language to learn to help me out when our GCSE's come up so I thought I would give it a go. I am currently trying to make a roulette style of game - the first phase though is fairly basic. I want the user to click a number and then to be told if it is right or wrong and update their chips. Currently I am using a fixed number whilst building up the script for testing purposes - I will change that to a random number later on. So far I have broke the code down and the parts that work are where the user function is not there(The buttons) so i assume the function for changing a variable to what the user picks is broke. Although when printing that function it says that it has changed. Like I said I'm new here so if this is not where to post for help just let me know and point me in the wrong direction any help would be much appreciated The code is : Code: <html> <body> <script language='JavaScript'> var numbers = new Array(39); numbers[0] = "BLANK IF THIS COMES UP PANIC AND RUN"; numbers[1] = "1"; numbers[2] = "2"; numbers[3] = "3"; numbers[4] = "4"; numbers[5] = "5"; numbers[6] = "6"; numbers[7] = "7"; numbers[8] = "8"; numbers[9] = "9"; numbers[10] = "10"; numbers[11] = "11"; numbers[12] = "12"; numbers[13] = "13"; numbers[14] = "14"; numbers[15] = "15"; numbers[16] = "16"; numbers[17] = "17"; numbers[18] = "18"; numbers[19] = "19"; numbers[20] = "20"; numbers[21] = "21"; numbers[22] = "22"; numbers[23] = "23"; numbers[24] = "24"; numbers[25] = "25"; numbers[26] = "26"; numbers[27] = "27"; numbers[28] = "28"; numbers[29] = "29"; numbers[30] = "30"; numbers[31] = "31"; numbers[32] = "32"; numbers[33] = "33"; numbers[34] = "34"; numbers[35] = "35"; numbers[36] = "36"; numbers[37] = "0"; numbers[38] = "00"; var goldennum = numbers[20]; //roullete number document.write(goldennum +"</br>"); var userpot = 500; // The amount of credits or chips the user has //var userpot = userpot*38; //document.write(userpot); user pot working calc var usernum = 200; //user betting number function button00(){ var usernum = 00; } function button0(){ var usernum = 0; } function button3(){ var usernum = 3; } function button6(){ var usernum = 6; } function button9(){ var usernum = 9; } function button12(){ var usernum = 12; } function button15(){ var usernum = 15; } function button18(){ var usernum = 18; } function button21(){ var usernum = 21; } function button24(){ var usernum = 24; } function button27(){ var usernum = 27; } function button30(){ var usernum = 30; } function button33(){ var usernum = 33; } function button36(){ var usernum = 36; } function button2(){ var usernum = 2; } function button5(){ var usernum = 5; } function button8(){ var usernum = 8; } function button11(){ var usernum = 11; } function button14(){ var usernum = 14; } function button17(){ var usernum = 17; } function button20(){ var usernum = 20; //document.write("</br></br></br>" + usernum + "</br></br></br>"); } function button23(){ var usernum = 23; } function button26(){ var usernum = 26; } function button29(){ var usernum = 29; } function button32(){ var usernum = 32; } function button35(){ var usernum = 35; } function button1(){ var usernum = 1; } function button4(){ var usernum = 4; } function button7(){ var usernum = 7; } function button10(){ var usernum = 10; } function button13(){ var usernum = 13; } function button16(){ var usernum = 16; } function button19(){ var usernum = 19; } function button22(){ var usernum = 22; } function button25(){ var usernum = 25; } function button28(){ var usernum = 28; } function button31(){ var usernum = 31; } function button34(){ var usernum = 34; } function runnums(){ //function to run the if the users bet is equal to the roulette number if(usernum == goldennum){ var userpot=500; userpot = userpot * 38; document.write(userpot); document.write( " YOU ARE A WINNER "); } else{ var userpot = 500; userpot= userpot - userpot; document.write ("You have " + userpot + " credits left "); document.write ( " YOU ARE A LOOOOOSER "); } } </script> <br> <br> <br> <br> <br> <br> <br> <input type="button" name="Button" value="00" onclick="button00()"> <input type="button" name="Button3" value="3" onclick= "button3()"> <input type="button" name="Button6" value="6" onclick= "button6()"> <input type="button" name="Button9" value="9" onclick= "button9()"> <input type="button" name="Button12" value="12" onclick="button12()"> <input type="button" name="Button15" value="15" onclick="button15()"> <input type="button" name="Button18" value="18" onclick="button18()"> <input type="button" name="Button21" value="21" onclick="button21()"> <input type="button" name="Button24" value="24" onclick="button24()"> <input type="button" name="Button27" value="27" onclick="button27()"> <input type="button" name="Button30" value="30" onclick="button30()"> <input type="button" name="Button33" value="33" onclick="button33()"> <input type="button" name="Button36" value="36" onclick="button36()"> <p> <input type="button" name="Button0" value="0" onclick="button0()"> <input type="button" name="Button2" value="2" onclick="button2()"> <input type="button" name="Button5" value="5" onclick="button5()"> <input type="button" name="Button8" value="8" onclick="button8()"> <input type="button" name="Button11" value="11" onclick="button11()"> <input type="button" name="Button14" value="14" onclick="button14()"> <input type="button" name="Button17" value="17" onclick="button17()"> <input type="button" name="Button20" value="20" onclick="button20()"> <input type="button" name="Button23" value="23" onclick="button23()"> <input type="button" name="Button26" value="26" onclick="button26()"> <input type="button" name="Button29" value="29" onclick="button29()"> <input type="button" name="Button32" value="32" onclick="button32()"> <input type="button" name="Button35" value="35" onclick="button35()"> <p> <input type="button" name="Button1" value="1" onclick="button1()"> <input type="button" name="Button4" value="4" onclick="button4()"> <input type="button" name="Button7" value="7" onclick="button7()"> <input type="button" name="Button10" value="10" onclick="button10()"> <input type="button" name="Button13" value="13" onclick="button13()"> <input type="button" name="Button16" value="16" onclick="button16()"> <input type="button" name="Button19" value="19" onclick="button19()"> <input type="button" name="Button22" value="22" onclick="button22()"> <input type="button" name="Button25" value="25" onclick="button25()"> <input type="button" name="Button28" value="28" onclick="button28()"> <input type="button" name="Button31" value="31" onclick="button31()"> <input type="button" name="Button34" value="34" onclick="button34()"> <input type="button" name="Place Bets" value="Place Bets" onclick="runnums()"> </body> </html> Hello Everybody, Plese find the solution for this error, i have a textbox(id=txt_Acronym), when i fill the data into that control i get this error(document.getElementById()is null or not an object),Iam calling The Java script Function in "onchange". Yours NARASIMHA RAO K hi friends, i got a two textboxes,my requirement is when i enter two charectors in textbox1,automatically cursor must point to textbox2. but in my case it is not happening like above,when ever i enter charector3,curosr is entering textbox2 along with the entered charector, please find my code below and help me in modifying it. 1.abc.ascs.cs file code is: txtCategory.Attributes.Add("OnKeyPress", "Focus1(this.id);"); 2.abc.ascx file code is: <script type="text/javascript"> function Focus1(that) { if (document.getElementById(that).value.length>1) { //If Len(.Text) = 2 Or Len(TXTbox.Text) = 5 Then document.getElementById('ShippedQtyAdjEntry1_txtDetail').disabled=false; document.getElementById('ShippedQtyAdjEntry1_txtDetail').style.backgroundColor="White"; document.getElementById('ShippedQtyAdjEntry1_txtDetail').focus(); } Hi, I am using this image rotation tool on my website but I would like to alter it slightly http://www.zurb.com/playground/orbit...y-image-slider See the small navigation dots under the images to select individual pages there are 4 of them (more if you add more images) - on 1 horizontal line. I would like to alter the code if possible so that the dots are in pairs going down the page (I wont bore you with the reason why) ie: o o o o o o o o etc The code the handles the dots is this: Code: // ================== // ! BULLET NAV // ================== //Bullet Nav Setup if(options.bullets) { var bulletHTML = '<ul class="orbit-bullets"></ul>'; orbitWrapper.append(bulletHTML); var bullets = orbitWrapper.children('ul.orbit-bullets'); for(i=0; i<numberSlides; i++) { var liMarkup = $('<li>'+(i+1)+'</li>'); if(options.bulletThumbs) { var thumbName = slides.eq(i).data('thumb'); if(thumbName) { var liMarkup = $('<li class="has-thumb">'+i+'</li>') liMarkup.css({"background" : "url("+options.bulletThumbLocation+thumbName+") no-repeat"}); } } orbitWrapper.children('ul.orbit-bullets').append(liMarkup); liMarkup.data('index',i); liMarkup.click(function() { stopClock(); shift($(this).data('index')); }); } setActiveBullet(); } //Bullet Nav Execution function setActiveBullet() { if(!options.bullets) { return false; } else { bullets.children('li').removeClass('active').eq(activeSlide).addClass('active'); } } The CSS for this is: Code: /* BULLET NAV ================================================== */ .orbit-bullets { position: absolute; z-index: 1000; list-style: none; bottom: 150px; left: 0%; margin-left: 0px; padding: 0; } .orbit-bullets li { float: left; margin-left: 5px; cursor: pointer; color: #999; text-indent: -9999px; background: url(bullets.png) no-repeat 4px 0; width: 13px; height: 12px; overflow: hidden; } .orbit-bullets li.active { color: #222; background-position: -8px 0; } .orbit-bullets li.has-thumb { background: none; width: 100px; height: 75px; } .orbit-bullets li.active.has-thumb { background-position: 0 0; border-top: 2px solid #000; } The image file for the small dots is this: I'm afraid I'm not a Java person at all and know little about it so I would be very grateful if you could help me out with it... if it's possible. Thanks. PP. Hi, I have some steps to transform into JavaScript but no idea what I am doing wrong (novice with JavaScript). I hope you guys could help. 1//Set Unique ID done at other file 2//Pass Unique ID in the URL done at other file 3//Get FeedbyID function var getfeedvalue= GetFeedByID("Address") 4//Access connection object of that unique feed connection.addEventListener("getfeedvalue", FilteredUrlChangedHandler); 5// For the connection, get the value for the filteredUrl propery. (this is the url that is called when the layer is checked.) function FilteredUrlChangedHandler(sender) { var changevalue=sender.toString } 6// Set the value of the UrlFormat property with the value you got from the filteredURL. getfeedvalue=changevalue Please let me know what I am doing wrong at step 5 or 6. Thanks Ram |