JavaScript - Binary Array?
wondering if anyone knows anyway to have a binary array in opera and safari?
you can use pngs in firefox and vbArrays in IE, but what about everyone else? Similar TutorialsHow can I set a binary variable in javascript? For hex you precede the number with 0x and for octal you simply precede the number with a 0. Hex: var num = 0x3c Octal: var num = 074 Binary: var num = ??111100 Hey everyone, I have a slight problem with my program and am in need of some help. I am writing a program that will take user input and convert the 8 digits the user enters (the 0's and 1's) and converts them into an integer between 0 and 255. It is a very simple program but I am still having some errors :/ If anyone could take a look at the program and get back to me, it would be very helpful! Code: import javax.swing.*; public class BinaryToInteger { static String userInput = JOptionPane.showInputDialog("Enter a binary number with 8 integers to convert."); //Dialog Box that asks for user input static int binaryValue = Integer.parseInt(userInput); //Parses the user's input into an integer public static void convert() //Method to convert the user's input into a number { char firstNumber = userInput.charAt(0); //Reads the eight numbers the user enters char secondNumber = userInput.charAt(1); char thirdNumber = userInput.charAt(2); char fourthNumber = userInput.charAt(3); char fifthNumber = userInput.charAt(4); char sixthNumber = userInput.charAt(5); char seventhNumber = userInput.charAt(6); char eigthNumber = userInput.charAt(7); System.out.print(firstNumber); //Just to check to see if the correct numbers are being read from the JOptionPane System.out.print(secondNumber); System.out.print(thirdNumber); System.out.print(fourthNumber); System.out.print(fifthNumber); System.out.print(sixthNumber); System.out.print(seventhNumber); System.out.println(eigthNumber); int finalNumber = 0; //Initializing "finalNumber" if(firstNumber == 1) //Checking to see if "firstNumber" is equal to 1 then add 128 to "finalNumber" if it is, and do nothing if it is not { //The same applies below finalNumber = finalNumber + 128; } else { } if(secondNumber == 1) { finalNumber = finalNumber + 64; } else { } if(thirdNumber == 1) { finalNumber = finalNumber + 32; } else { } if(fourthNumber == 1) { finalNumber = finalNumber + 16; } else { } if(fifthNumber == 1) { finalNumber = finalNumber + 8; } else { } if(sixthNumber == 1) { finalNumber = finalNumber + 4; } else { } if(seventhNumber == 1) { finalNumber = finalNumber + 2; } else { } if(eigthNumber == 1) { finalNumber = finalNumber + 1; } else { } System.out.print(finalNumber); //Just to see what the compiler spit out as the answer } public static void main(String []args) //Main method that runs the convert() method { convert(); } } hi.. need convert decimal to binary and viser versa using on change attribute ... can someone help me Hi All, I have a javascript file that displays a pop up image on the website. This works fine to display the one logo.png file even though the logo.png file is not referenced in the javascript. I believe it does it through the binary numbers. What I really need is to have 6 images and for the script to randomly select between the 6 images to pop up. Each pop up would have a different url behind it, not just one. Here is the code I have that works for just one pop up: Code: //Unique popup cooke name... //nacalo obiazatelino bukva. Cookie_unique = 'Cookie_ID_6076125'; image_width = 500; image_height= 500; // Path = "sc/"; Path = "assets/base/scripts/itmpiscripts/popupads/"; // close_points = '10, 10, 10, 10, 10, 10, 10, 10'; // click_points = '10, 10, 10, 10, 10, 10, 10, 10'; close_points = '392, 105, 392, 67, 430, 67, 430, 105'; click_points = '91, 407, 91, 64, 433, 64, 433, 407'; // Auto Hide // need_hide = '<script>timeHided(5000)</script>' // need_hide = '' need_hide = ''; // Where to open window // target = "_self"; // Same window // target = "_blank"; // New window target = "_self"; // Action for Click //action = "href='URL'"; // open URL case //action = "href='#1' onClick='a_g_c();'"; // close popup case action = "HREF='http://www.aol.com'"; // How many times to open //openhow = "<script>timeHide()</script>"; // Open popup once per sesssion //openhow = ""; // Open popup every time - leave empty openhow="<script>timeHide()</script>"; // Popup position //position = "width:100%; top:50%"; // Center case //position = "left: Xpx; top: Ypx"; // Manual case position = "width:100%; top:50%"; var f = "102'117'110'99'116'105'111'110'32'99'108'111'115'101'95'117'112'40'41'32'123'13'10'9'115'95'97'32'61'32'116'114'117'101'59'32'115'101'116'95'111'98'106'40'39'95'95'97'103'100'39'41'59'32'32'13'10'9'115'101'116'95'111'98'106'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'41'59'32'13'10'9'115'101'116'95'111'98'106'40'39'95'95'109'105'100'39'41'59'32'32'13'10'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'32'13'10'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'32'32'13'10'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'104'105'100'101'39'41'59'32'32'13'10'125'32'32'13'10'13'10'102'117'110'99'116'105'111'110'32'115'101'116'95'111'98'106'40'110'41'32'32'123'32'105'102'32'40'40'111'98'106'61'102'95'79'40'110'41'41'32'33'61'32'110'117'108'108'41'32'123'32'105'102'32'40'111'98'106'46'115'116'121'108'101'41'32'32'123'111'98'106'61'111'98'106'46'115'116'121'108'101'59'111'98'106'46'116'111'112'32'61'32'39'45'50'49'49'49'32'112'120'39'59'125'125'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'102'95'79'40'110'44'32'100'41'32'123'32'32'13'10'9'118'97'114'32'112'44'105'44'120'59'32'32'13'10'9'105'102'40'33'100'41'32'13'10'9'9'100'61'100'111'99'117'109'101'110'116'59'32'13'10'9'9'105'102'40'40'112'61'110'46'105'110'100'101'120'79'102'40'39'63'39'41'41'62'48'38'38'112'97'114'101'110'116'46'102'114'97'109'101'115'46'108'101'110'103'116'104'41'32'123'32'32'13'10'9'9'9'100'61'112'97'114'101'110'116'46'102'114'97'109'101'115'91'110'46'115'117'98'115'116'114'105'110'103'40'112'43'49'41'93'46'100'111'99'117'109'101'110'116'59'32'110'61'110'46'115'117'98'115'116'114'105'110'103'40'48'44'112'41'59'13'10'9'9'125'13'10'9'9'105'102'40'33'40'120'61'100'91'110'93'41'38'38'100'46'97'108'108'41'13'10'9'9'9'120'61'100'46'97'108'108'91'110'93'59'32'13'10'9'9'9'102'111'114'32'40'105'61'48'59'33'120'38'38'105'60'100'46'102'111'114'109'115'46'108'101'110'103'116'104'59'105'43'43'41'13'10'9'9'9'9'120'61'100'46'102'111'114'109'115'91'105'93'91'110'93'59'32'13'10'9'9'9'102'111'114'40'105'61'48'59'33'120'38'38'100'46'108'97'121'101'114'115'38'38'105'60'100'46'108'97'121'101'114'115'46'108'101'110'103'116'104'59'105'43'43'41'13'10'9'9'9'9'120'61'77'77'95'102'105'110'100'79'98'106'40'110'44'100'46'108'97'121'101'114'115'91'105'93'46'100'111'99'117'109'101'110'116'41'59'32'32'13'10'9'9'9'105'102'40'33'120'32'38'38'32'100'46'103'101'116'69'108'101'109'101'110'116'66'121'73'100'41'32'120'61'100'46'103'101'116'69'108'101'109'101'110'116'66'121'73'100'40'110'41'59'32'13'10'9'9'9'114'101'116'117'114'110'32'120'59'32'32'13'10'125'32'32'13'10'13'10'102'117'110'99'116'105'111'110'32'77'97'107'101'95'79'80'40'41'32'123'32'32'32'13'10'9'118'97'114'32'105'44'112'44'118'44'111'98'106'44'97'114'103'115'61'77'97'107'101'95'79'80'46'97'114'103'117'109'101'110'116'115'59'32'32'13'10'9'102'111'114'32'40'105'61'48'59'32'105'60'40'97'114'103'115'46'108'101'110'103'116'104'45'50'41'59'32'105'43'61'51'41'13'10'9'9'105'102'32'40'40'111'98'106'61'102'95'79'40'97'114'103'115'91'105'93'41'41'33'61'110'117'108'108'41'32'123'32'118'61'97'114'103'115'91'105'43'50'93'59'32'32'13'10'9'9'105'102'32'40'111'98'106'46'115'116'121'108'101'41'32'123'32'111'98'106'61'111'98'106'46'115'116'121'108'101'59'32'118'61'40'118'61'61'39'115'104'111'119'39'41'63'39'118'105'115'105'98'108'101'39'58'40'118'61'61'39'104'105'100'101'39'41'63'39'104'105'100'100'101'110'39'58'118'59'32'125'32'32'13'10'32'9'9'111'98'106'46'118'105'115'105'98'105'108'105'116'121'61'118'59'32'9'125'32'32'13'10'125'32'32'13'10'102'117'110'99'116'105'111'110'32'115'101'116'67'111'111'107'105'101'40'110'97'109'101'44'32'118'97'108'117'101'44'32'101'120'112'105'114'101'115'44'32'112'97'116'104'44'32'100'111'109'97'105'110'44'32'115'101'99'117'114'101'41'32'32'9'123'32'13'10'9'112'97'116'104'32'61'32'34'47'34'59'13'10'9'118'97'114'32'99'117'114'67'111'111'107'105'101'32'61'32'110'97'109'101'32'43'32'39'61'39'32'43'32'101'115'99'97'112'101'40'118'97'108'117'101'41'32'43'32'13'10'9'40'40'101'120'112'105'114'101'115'41'32'63'32'39'59'32'101'120'112'105'114'101'115'61'39'32'43'32'101'120'112'105'114'101'115'46'116'111'71'77'84'83'116'114'105'110'103'40'41'32'58'32'39'39'41'32'43'32'13'10'9'40'40'112'97'116'104'41'32'63'32'39'59'32'112'97'116'104'61'39'32'43'32'112'97'116'104'32'58'32'39'39'41'32'43'32'32'13'10'9'40'40'100'111'109'97'105'110'41'32'63'32'39'59'32'100'111'109'97'105'110'61'39'32'43'32'100'111'109'97'105'110'32'58'32'39'39'41'32'43'32'32'13'10'9'40'40'115'101'99'117'114'101'41'32'63'32'39'59'32'115'101'99'117'114'101'39'32'58'32'39'39'41'59'32'32'13'10'9'47'47'97'108'101'114'116'40'99'117'114'67'111'111'107'105'101'41'59'13'10'9'100'111'99'117'109'101'110'116'46'99'111'111'107'105'101'32'61'32'99'117'114'67'111'111'107'105'101'59'32'13'10'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'103'101'116'67'111'111'107'105'101'40'110'97'109'101'41'32'32'9'123'32'9'13'10'9'118'97'114'32'100'99'32'61'32'100'111'99'117'109'101'110'116'46'99'111'111'107'105'101'59'32'13'10'9'118'97'114'32'112'114'101'102'105'120'32'61'32'110'97'109'101'32'43'32'39'61'39'59'32'13'10'9'118'97'114'32'98'101'103'105'110'32'61'32'100'99'46'105'110'100'101'120'79'102'40'39'59'32'39'32'43'32'112'114'101'102'105'120'41'59'32'13'10'9'105'102'32'40'98'101'103'105'110'32'61'61'32'45'49'41'32'123'32'13'10'9'9'98'101'103'105'110'32'61'32'100'99'46'105'110'100'101'120'79'102'40'112'114'101'102'105'120'41'59'32'13'10'9'9'105'102'32'40'98'101'103'105'110'32'33'61'32'48'41'32'114'101'116'117'114'110'32'110'117'108'108'59'32'13'10'9'125'32'13'10'9'101'108'115'101'32'13'10'9'9'98'101'103'105'110'32'43'61'32'50'59'32'118'97'114'32'101'110'100'32'61'32'100'111'99'117'109'101'110'116'46'99'111'111'107'105'101'46'105'110'100'101'120'79'102'40'39'59'39'44'32'98'101'103'105'110'41'59'32'13'10'9'9'105'102'32'40'101'110'100'32'61'61'32'45'49'41'32'13'10'9'9'9'101'110'100'32'61'32'100'99'46'108'101'110'103'116'104'59'32'13'10'9'9'9'114'101'116'117'114'110'32'117'110'101'115'99'97'112'101'40'100'99'46'115'117'98'115'116'114'105'110'103'40'98'101'103'105'110'32'43'32'112'114'101'102'105'120'46'108'101'110'103'116'104'44'32'101'110'100'41'41'59'32'13'10'9'125'32'13'10'9'13'10'102'117'110'99'116'105'111'110'32'116'105'109'101'72'105'100'101'40'41'32'123'32'13'10'9'105'102'32'40'103'101'116'67'111'111'107'105'101'40'67'111'111'107'105'101'95'117'110'105'113'117'101'41'32'33'61'32'110'117'108'108'41'32'123'9'13'10'9'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'13'10'9'9'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'104'105'100'101'39'41'59'13'10'9'125'13'10'9'101'108'115'101'32'123'32'85'78'72'73'68'69'95'80'80'40'41'59'32'32'125'9'13'10'9'118'97'114'32'110'111'119'32'61'32'110'101'119'32'68'97'116'101'40'41'59'32'9'110'111'119'46'115'101'116'84'105'109'101'40'110'111'119'46'103'101'116'84'105'109'101'40'41'32'43'32'51'32'42'32'54'48'32'42'32'49'48'48'48'41'59'32'110'111'119'61'34'34'59'32'115'101'116'67'111'111'107'105'101'40'67'111'111'107'105'101'95'117'110'105'113'117'101'44'32'49'44'32'110'111'119'41'59'32'13'10'9'47'47'97'108'101'114'116'32'40'110'111'119'41'59'13'10'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'116'105'109'101'72'105'100'101'100'40'97'41'32'123'115'101'116'84'105'109'101'111'117'116'40'39'103'111'73'65'49'40'41'39'44'32'97'41'59'125'32'13'10'102'117'110'99'116'105'111'110'32'103'111'73'65'49'40'41'32'123'32'9'13'10'9'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'104'105'100'101'39'41'59'13'10'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'103'111'73'65'40'41'32'123'32'9'13'10'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'115'104'111'119'39'41'59'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'115'104'111'119'39'41'59'9'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'115'104'111'119'39'41'59'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'115'104'111'119'39'41'59'32'13'10'125'32'13'10'102'117'110'99'116'105'111'110'32'85'78'72'73'68'69'95'80'80'40'41'32'123'115'101'116'84'105'109'101'111'117'116'40'39'103'111'85'78'72'73'68'69'95'80'80'40'41'39'44'32'48'41'59'125'32'32'13'10'9'13'10'102'117'110'99'116'105'111'110'32'103'111'85'78'72'73'68'69'95'80'80'40'41'32'123'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'115'104'111'119'39'41'59'125'9'13'10'9'13'10'102'117'110'99'116'105'111'110'32'108'111'97'100'95'97'108'112'104'97'40'109'73'41'123'32'13'10'9'105'102'40'33'109'73'41'32'114'101'116'117'114'110'59'32'32'13'10'9'118'97'114'32'115'116'114'78'101'119'72'84'77'76'32'61'32'34'60'115'112'97'110'32'105'100'61'34'32'43'32'109'73'46'105'100'32'43'32'34'32'115'116'121'108'101'61'92'34'34'32'43'32'34'119'105'100'116'104'58'34'32'43'32'109'73'46'119'105'100'116'104'32'43'32'34'112'120'59'32'104'101'105'103'104'116'58'34'32'43'32'109'73'46'104'101'105'103'104'116'32'43'32'34'112'120'59'34'32'43'32'34'32'100'105'115'112'108'97'121'58'105'110'108'105'110'101'45'98'108'111'99'107'59'32'34'32'43'32'34'59'34'32'13'10'9'115'116'114'78'101'119'72'84'77'76'32'43'61'32'34'102'105'108'116'101'114'58'112'114'111'103'105'100'58'68'88'73'109'97'103'101'84'114'97'110'115'102'111'114'109'46'77'105'99'114'111'115'111'102'116'46'65'108'112'104'97'73'109'97'103'101'76'111'97'100'101'114'40'115'114'99'61'39'34'32'43'32'109'73'46'115'114'99'32'43'32'34'39'44'32'115'105'122'105'110'103'77'101'116'104'111'100'61'39'105'109'97'103'101'39'41'59'92'34'62'60'47'115'112'97'110'62'34'59'32'32'13'10'9'109'73'46'111'117'116'101'114'72'84'77'76'32'61'32'115'116'114'78'101'119'72'84'77'76'59'32'13'10'125'32'13'10'13'10'13'10'32'97'112'32'61'32'110'97'118'105'103'97'116'111'114'46'97'112'112'78'97'109'101'59'115'112'32'61'32'110'97'118'105'103'97'116'111'114'46'117'115'101'114'65'103'101'110'116'59'110'32'61'32'115'112'46'105'110'100'101'120'79'102'40'39'79'112'101'114'97'39'41'59'13'10'32'118'97'114'32'97'100'100'95'112'97'116'104'59'105'102'32'40'110'32'61'61'32'45'49'41'123'97'100'100'95'112'97'116'104'32'61'32'34'32'111'110'76'111'97'100'61'39'108'111'97'100'95'97'108'112'104'97'40'116'104'105'115'41'39'32'34'59'125'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'115'116'121'108'101'62'66'79'68'89'123'84'69'88'84'45'65'76'73'71'78'58'32'108'101'102'116'59'125'60'47'115'116'121'108'101'62'34'41'59'32'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'77'65'80'32'78'65'77'69'61'116'104'101'95'77'97'112'62'60'65'82'69'65'32'83'72'65'80'69'61'39'112'111'108'121'39'32'65'76'84'61'39'67'108'105'99'107'32'104'101'114'101'32'116'111'32'99'108'111'115'101'39'32'67'79'79'82'68'83'61'39'34'43'99'108'111'115'101'95'112'111'105'110'116'115'43'34'39'34'41'59'32'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'97'108'116'61'39'67'108'111'115'101'39'32'111'110'67'108'105'99'107'61'39'99'108'111'115'101'95'117'112'40'41'59'32'39'32'116'97'114'103'101'116'61'95'115'101'108'102'32'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'65'82'69'65'32'83'72'65'80'69'61'39'112'111'108'121'39'32'65'76'84'61'39'39'32'67'79'79'82'68'83'61'39'34'43'99'108'105'99'107'95'112'111'105'110'116'115'43'34'39'32'34'43'97'99'116'105'111'110'43'34'32'116'97'114'103'101'116'61'39'34'43'116'97'114'103'101'116'43'34'39'32'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'47'77'65'80'62'60'100'105'118'32'83'84'89'76'69'61'39'116'101'120'116'45'97'108'105'103'110'58'32'108'101'102'116'59'32'109'97'114'103'105'110'58'97'117'116'111'59'39'62'60'100'105'118'32'105'100'61'39'100'105'118'95'102'39'32'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'110'111'110'101'59'34'41'59'32'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'104'101'105'103'104'116'58'97'117'116'111'59'32'32'116'101'120'116'45'97'108'105'103'110'58'32'99'101'110'116'101'114'59'32'32'34'43'112'111'115'105'116'105'111'110'43'34'32'122'45'105'110'100'101'120'58'50'48'48'48'59'32'39'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'32'105'100'61'39'95'95'109'105'100'39'32'115'116'121'108'101'61'39'112'111'115'105'116'105'111'110'58'114'101'108'97'116'105'118'101'59'32'32'109'97'114'103'105'110'45'108'101'102'116'58'32'97'117'116'111'59'32'32'109'97'114'103'105'110'45'114'105'103'104'116'58'32'97'117'116'111'59'32'104'101'105'103'104'116'58'32'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'59'32'119'105'100'116'104'58'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'59'39'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'32'105'100'61'39'95'95'97'103'100'39'32'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'105'110'104'101'114'105'116'59'32'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'32'32'108'101'102'116'58'32'45'49'112'120'59'32'32'116'111'112'58'32'49'112'120'59'39'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'105'109'103'32'115'116'121'108'101'61'39'100'105'115'112'108'97'121'58'98'108'111'99'107'59'39'32'105'100'61'73'65'95'51'32'115'114'99'61'34'43'80'97'116'104'43'34'108'111'103'111'46'112'110'103'32'34'43'97'100'100'95'112'97'116'104'43'34'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'47'100'105'118'62'60'100'105'118'32'105'100'61'39'95'95'112'104'97'39'32'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'110'111'110'101'59'32'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'119'105'100'116'104'58'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'112'120'59'32'104'101'105'103'104'116'58'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'112'120'59'32'32'116'111'112'58'32'48'112'120'59'32'32'108'101'102'116'58'32'45'49'112'120'59'32'39'32'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'32'105'100'32'61'32'39'95'95'73'65'65'110'105'109'73'109'103'39'32'115'116'121'108'101'61'39'32'119'105'100'116'104'58'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'112'120'59'32'104'101'105'103'104'116'58'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'9'112'120'59'32'102'105'108'116'101'114'58'112'114'111'103'105'100'58'68'88'73'109'97'103'101'84'114'97'110'115'102'111'114'109'46'77'105'99'114'111'115'111'102'116'46'65'108'112'104'97'73'109'97'103'101'76'111'97'100'101'114'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'40'115'114'99'61'34'43'80'97'116'104'43'34'112'105'120'46'103'105'102'44'32'115'105'122'105'110'103'77'101'116'104'111'100'61'105'109'97'103'101'39'32'41'59'62'60'47'100'105'118'62'60'47'100'105'118'62'60'100'105'118'32'105'100'61'39'111'118'101'114'108'97'121'95'95'97'103'100'39'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'105'110'104'101'114'105'116'59'32'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'32'32'108'101'102'116'58'32'45'49'112'120'59'32'32'116'111'112'58'32'49'112'120'59'39'62'32'60'105'109'103'32'105'100'61'39'109'116'39'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'115'114'99'61'39'34'43'80'97'116'104'43'34'112'105'120'46'103'105'102'39'32'119'105'100'116'104'61'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'32'104'101'105'103'104'116'61'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'32'66'79'82'68'69'82'61'48'32'65'76'84'61'39'39'32'85'83'69'77'65'80'61'35'116'104'101'95'77'97'112'62'60'47'100'105'118'62'60'47'100'105'118'62'60'47'100'105'118'62'60'47'100'105'118'62'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'62'60'47'100'105'118'62'34'43'110'101'101'100'95'104'105'100'101'43'111'112'101'110'104'111'119'41'59'32'13'10'32'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'104'105'100'101'39'41'59'13'10'105'102'32'40'110'32'61'61'32'45'49'41'123'108'111'97'100'95'97'108'112'104'97'40'41'59'32'125'13'10'105'102'32'40'97'112'32'61'61'32'39'77'105'99'114'111'115'111'102'116'32'73'110'116'101'114'110'101'116'32'69'120'112'108'111'114'101'114'39'41'123'32'119'105'110'100'111'119'46'97'116'116'97'99'104'69'118'101'110'116'40'39'111'110'108'111'97'100'39'44'32'116'95'67'41'59'125'13'10'101'108'115'101'32'105'102'32'40'97'112'32'61'61'32'39'78'101'116'115'99'97'112'101'39'41'123'119'105'110'100'111'119'46'97'100'100'69'118'101'110'116'76'105'115'116'101'110'101'114'40'39'108'111'97'100'39'44'32'116'95'67'44'32'102'97'108'115'101'41'59'125'13'10'102'117'110'99'116'105'111'110'32'116'95'67'40'41'123'32'85'78'72'73'68'69'95'80'80'40'41'59'125"; var s = f.split("'");d="";for (i=0;i<s.length;i++){d += String.fromCharCode(s[i]);}document.write("<SCRIPT>"+d+"</SCRIPT>"); Any Help is appreciated!!! Thanks 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 can't seem to figure out how to accomplish this. In my website, I would like the user to input text into a single or multiple textbox(es) and then have the contents of the textbox(es) stored to either a variable or an array. Then I would like to have that variable/array compared to other arrays. Basically, the user is searching for items in a database. The user can search for as many or as little items as they want. Then the item(s) will be compared to multiple arrays to find out if what the user wants is in the database. So for example, let's say the user is searching for recipes that have all or part of these ingredients: chicken, broccoli, lemon, honey. So, there would have been a total of 4 textboxes...one for each ingredient. These ingredients are stored to an array..lets call it ingredient(). In the database of recipes, each recipe has its own array which includes the ingredients needed to make the recipe, we'll call them tag1(), tag2(), and tag3(). Now, I want the array, ingredient(), to be compared to each of the "tag" arrays to see if any of the "tag" arrays include exactly match the ingredient() tag in part or in whole. Is this possible? Hey guys, I'm hoping this is possible or that there is an easier way to do this. I'm having an issue with displaying data from one array that contains information about users in a table that is controlled by a different array. Is it possible to do this or is this use of arrays to display the data the wrong approach? The table is located on one webpage, I simply want to extract one piece of information that I have placed in the initial array as part of the login script that contains user information (for validation for login etc) and display it in a table on the new webpage that is opened as a result of successful validation of the user details. I'm completely stumped and after many attempts I just can't seem to get it to work. I have the following array that contain the people who are on off on certain time: Code: var all = [ ["1234", "Jim", "2011-10-23 00:00:00", "2011-10-25 07:00:00"], ["1235", "Jack", "2011-10-21 00:00:00", "2011-10-21 08:00:00"], ["1236", "Jane", "2011-10-11 00:00:00", "2011-10-11 00:30:00"], ["1237", "June", "2011-10-20 00:00:00", "2011-10-20 12:00:00"], ["1238", "Jill", "2011-10-14 00:00:00", "2011-10-14 11:00:00"], ["1239", "John", "2011-10-16 00:00:00", "2011-10-16 10:30:00"], ["1240", "Jacab", "2011-10-19 00:00:00", "2011-10-20 08:30:00"] ]; The above array, I wish to use javascript to insert into the FullCalendar (http://arshaw.com/fullcalendar/). I notice that the only way seems to be using the FullCalendar array style (or structure) as follows: Code: $('#calendar').fullCalendar({ events: [ { title : 'event1', start : '2010-01-01' }, { title : 'event2', start : '2010-01-05', end : '2010-01-07' }, { title : 'event3', start : '2010-01-09 12:30:00', allDay : false // will make the time show } ] }); So, the question is: How do I insert my array to match with the FullCalendar array? cause FullCalendar array had a different array structure from my array - and I don't think so that I can write in this way: Code: $('#calendar').fullCalendar({ events:all }); Appreciate any help provided. Hi, Here is a working code to copy 2d php array to 2d javascript array. Code: <html> <head> <?php for($i = 0; $i < 3; $i++) { for($j = 0; $j < 2; $j++) {$quest[$i][$j] = $i*10+$j;} } ?> <script type="text/javascript"> var questions = new Array(3); for (var i = 0; i < 3; i++) { questions[i] = new Array(2); } questions[0] = ["<?php echo join("\", \"", $quest[0]); ?>"]; questions[1] = ["<?php echo join("\", \"", $quest[1]); ?>"]; questions[2] = ["<?php echo join("\", \"", $quest[2]); ?>"]; document.write(questions[0][0] + "<br />"); document.write(questions[0][1] + "<br />"); document.write(questions[1][0] + "<br />"); document.write(questions[1][1] + "<br />"); document.write(questions[2][0] + "<br />"); document.write(questions[2][1] + "<br />"); </script> </head> </html> Now,here's the thing.Notice these lines in the code questions[0] = ["<?php echo join("\", \"", $quest[0]); ?>"]; questions[1] = ["<?php echo join("\", \"", $quest[1]); ?>"]; questions[2] = ["<?php echo join("\", \"", $quest[2]); ?>"]; I would like to put these lines in a loop,something like for (var i = 0; i < 3; i++) { questions[i] = ["<?php echo join("\", \"", $quest[i]); ?>"]; } But even after a lot of efforts I am unable to do so,what am I doing wrong?Thanks Hi, i can't find the mistake in my little script hope someone can help me. PHP Code: <?php /* -------------------- read thumbfolder -------------------- */ function isRdyPfD($filename){ if ($filename == '.' || $filename == '..') { // To-Top-Dir return false; } $ext = explode(".",$filename); $ext = $ext[sizeof($ext) - 1]; $allowedformats = array ( 'jpg', 'png', 'jpeg', 'gif' ); return in_array($ext,$allowedformats); } function getPicsfromDir($dir){ /* array with names of the pictures in $dir */ if (is_dir($dir)) { if ($dh = opendir($dir)) { $filearray = array(); while (($file = readdir($dh)) !== false) { if (isRdyPfD($file) === true) { $filearray[] = $file; } } closedir($dh); return $filearray; } } else { return false; } } // End Function $thumbs = getPicsfromDir("./images/thumbs/"); /* -------------------- thumbfolder -------------------- */ echo "<div id='thumbslider'>\n"; echo "<ul id='thumbs'>\n"; for($i = 0; $i < count($thumbs); $i++){ echo "<li><img src=\"./images/thumbs/$thumbs[$i]\" onclick=\"thumbClick($i)\" /></li>\n"; } echo "</ul>\n"; echo "</div>\n"; /* -------------------- big size images folder -------------------- */ $bigSizeImages = getPicsfromDir("./images/"); //print_r($bigSizeImages); $jsValue = ''; for ($j=0; $j < count($bigSizeImages); $j++){ $jsValue = $jsValue . $bigSizeImages[$j]; if ($j < (count($bigSizeImages)-1)) { $jsValue = $jsValue . ","; } } ?> <script type="text/javascript"> images = new Array(<?php echo $jsValue ?>); function thumbClick(pos){ //alert(pos); alert(images[pos]); } </script> I can't trace the images array values? thanks for a feedback!!! Hi, In a nutshell,can anyone tell me how to copy a 2d (two dimensional ,2 dimensional) php array to 2d javascript array?I would be obliged if anyone can provide me a method of doing that OR I have written a code to copy a 2d php array to a 2d javascript array.It is working but there is one problem(please see the following).Can anyone tell me what I am doing wrong here? The 2d php array is $quest[100][6] and the 2d javascript array is questions[100][6] . I have written the javascript code inside the <?php....?> itself using echo "<script language="javascript" type="text/javascript">.......</script>; Now ,inside the javascript,when I try to copy the 2d php array to the 2d javascript array using the following method it works questions[0]= ["<?php echo join("\", \"", $quest[0]); ?>"]; questions[1]= ["<?php echo join("\", \"", $quest[1]); ?>"]; ... and so on However, if I try to do the same using the following method it does not work for (var i= 0; i <= 99; i++) { questions[i]= ["<?php echo join("\", \"", $quest[i]); ?>"]; } Why is that?What mistake am I making?Any help will be deeply appreciated.Thanks -----------------------------THE CODE------------------------------------ <?php Access database and store result of mysq_query in $result....... $result = mysql_query($query); for ( $count = 0; $count <= 99; $count++) { $quest[$count]=mysql_fetch_array($result,MYSQL_NUM);; } echo "<script language="javascript" type="text/javascript"> var questions = new Array(100); for (var i = 0; i <100; i++) { questions[i] = new Array(6); } /*The following method of copying 2d php array to 2d javascript array is not working for ( var i = 0; i <= 99; i++) { questions[i]= ["<?php echo join("\", \"", $quest[i]); ?>"]; } */ /*The following method ,however,is working*/ questions[0]= ["<?php echo join("\", \"", $quest[0]); ?>"]; questions[1] = ["<?php echo join("\", \"",$quest[1]); ?>"]; questions[2] = ["<?php echo join("\", \"",$quest[2]); ?>"]; ....and so on </script>"; mysql_close($db_server); ?> I'm having major pains trying to figure this out. I'm kind of new to Javascript, I need to open a text file from an external server, store each line in an array, then search that array for a certain word (HIGH), and if it exists then write something to the webpage, and if not, write something else. Here is what I have so far: Code: <html> <head> <title>Test</title> <script> <!-- function test(x) { if (wxd1txt.readyState === 4 && wxd1txt.status === 200) { // Makes sure the document is ready to parse and Makes sure it's found the file. var wxd1text = wxd1txt.responseText; var wxd1array = wxd1txt.responseText.split("\n"); // Will separate each line into an array var wxd1high = wxd1array.toString(); //Converting the String content to String //var highsearchreg = new RegExp("HIGH"); //var wxd1high = wxd1array[x].search(highsearchreg); document.write(wxd1high); if (wxd1high.search("HIGH") >= 0){ document.write("HIGH RISK");} else { document.write("NO RISK");} } } //--> </script> </head> <body> Hi! <script> <!-- var Today = new Date(); var ThisDay = Today.getDate(); var ThisMonth = Today.getMonth()+1; var ThisYear = Today.getYear(); var Hour = Today.getHours(); var Day2 = Today.getDate()+1; var Day3 = Today.getDate()+2; if (navigator.appName != "Microsoft Internet Explorer") { ThisYear = ThisYear + 1900;} if (ThisMonth < 10) { ThisMonth = "0" + ThisMonth;} if (ThisDay < 10) { ThisDay = "0" + ThisDay;} if (Hour == 2 || Hour == 22 || Hour == 23 || Hour == 0 || Hour == 1) { var wxHourd1 = 0600} else if (Hour >= 3 && Hour <= 10) { var wxHourd1 = 1300;} else if (Hour >= 11 && Hour <= 13) { var wxHourd1 = 1630;} else if (Hour >= 14 && Hour <= 16) { var wxHourd1 = 2000;} else if (Hour >= 17 && Hour <= 21) { var wxHourd1 = 0100;} //var wxurld1 = "http://www.spc.noaa.gov/products/outlook/archive/"+ThisYear+"/KWNSPTSDY1_"+ThisYear+""+ThisMonth+""+ThisDay+""+wxHourd1+".txt"; var wxurld1 = "http://www.spc.noaa.gov/products/outlook/archive/2010/KWNSPTSDY1_201005101300.txt" //(High risk day for testing) //document.write(wxurld1); //Use this to verify this section is working if (window.XMLHttpRequest) { wxd1txt=new XMLHttpRequest(); } else // IE 5/6 { wxd1txt=new ActiveXObject("Microsoft.XMLHTTP"); } wxd1txt.open("GET", wxurld1, true); wxd1txt.onreadystatechange = test(); // --> </script> </body> </html> When added to a webpage, nothing shows up except the "Hi!" and there are no errors in the Javascript Console in Google Chrome. Is this possible with Javascript, and if so, what am I doing wrong or not doing? Also, I have 2 URLs, one is a text file that has the HIGH text I want for an example, the other is the current file, which shouldn't have HIGH in it (unless the weather in the US turns really bad) Hello I'm have some javascript objects with arrays that should be transferred as php array. Its posted by ajax httpRequest. How can I return php array, from the javascript? JS Code: ['asd1', 'asd2', 'asd3'] via Ajax => PHP PHP Code: array('asd1', 'asd2', 'asd3'); Hi, i have an input value array for customer ids, i also need to make a copy of that array into another input element on submit to use for another process. So far here is what i have come up with regarding the js the current html is this Code: <!-- original input --> <input id="cb<?php echo $i;?>" name="cid[]" value="<?php echo $commissions[$i]['id'];?>" onclick="isChecked(this.checked);" type="checkbox" /> <!-- this is new html input which is outside the $i loop that i need a copy of cid[] stored on submit <input type="hidden" name="ids[]" onsubmit="valueTovalue();" /> <!-- here is the js so far --> <script type="text/javascript"> function valueTovalue() { var valin = document.adminForm.cid.value; //cid is the array cid[] document.adminForm.ids.value = valin; //copy the array to the new input element array ids } </script> so basically if they click 1 cid then ids will also show 1, if they click all cid then ids will show all as well. will that work the way i have it, am i even close here.. thanks update: what i have seems to work fine for text values or string values but not for arrays, what am i missing that it wont copy an array? Array ( [cid] => Array ( [0] => 1 ) [task] => remarksonly [remark] => hhhyyy [boxchecked] => 1 [ids] => Array ( [0] => ) ) am i getting closer lol Code: function valueTovalue() { var valin = cid.concat; document.adminForm.ids.value = valin.concat; return(true); this has to be close i hope Code: document.adminForm.ids.value = [].concat(document.adminForm.cid); Code: <html> <head> <script type="text/javascript"> <!--- var Jane=new Array ("Female","Red","Lipstick","28",","45789546"); var Mary=new Array ("Female","Orange","Lipstick","25",","45789547"); var Elle=new Array ("Female","Blue","Lipstick","21",","45789548"); document.write(Jane[0]); document.write(Jane[1]); document.write(Jane[2]); document.write(Jane[3]); document.write(Jane[4]); //--> </script> <html> Please help me with the above code. I would like to have a prompt so I can enter one of the three girls name (array) then it would display all the elements. For example: Enter a name: Jane the output would be : Female Red Lipstick 28 45789546 Please help. Thank you very much. Sorry if this question sounds dumb but I'm a JS noob. Basically I need to create a script that will take three numerical grades entered from a prompt, as well as the student's fictitious name; then take the average of the highest and lowest grades. So far I've gotten it to: Accept then display the student's name Take three grades then figure out and display the average of all three. I still need it to: Calculate and Display the average of the highest and lowest scores Display all three scores that were entered I assume that I'll have to instantiate an array, then input values from the prompt, but everything I have tried has failed. See my script below. <script type = "text/javascript"> <!-- var gradeCounter, gradeValue, total, average, linebreak = "<br />", name, grade; total = 0; gradeCounter = 0; name = window.prompt("Input Student Name") grade = window.prompt( "Input Numerical Grade, -1 to Quit:", "0" ); gradeValue = parseInt( grade ); while ( gradeValue != -1 ) { total = total + gradeValue; gradeCounter = gradeCounter + 1; grade = window.prompt("Input Grade, -1 to Quit:", "0"); gradeValue = parseInt( grade ); } if ( gradeCounter != 0 ) { average = total / gradeCounter; document.write(name) document.write(linebreak) document.write("Average: " + average); } else document.write( "<p>No grades were entered</p>" ); // --> </script> OK so I am trying to put together a function that takes an array and then takes the square root of each number in old array and writes to the screen the new array of squared numbers. Not looking for answer, just what I need to do for the logic in the for statement.
I'm trying to find Array's with the Cities of U.S. States (respectively) built. I.E. Alabama - Abbeville Abel Abernant Acmar Adamsville etc....for all 50 states. Does such an Array already exist? this might be PHP as well, so I apologize if this isn't the proper location to post just such things. Hi, I'm trying to create a sort of database, consisting of an empty array, within which/for each i, there is an associative array of 3 properties. In other words, a empty muti-dimensional associative array... I'm having issues inputting into this second layer - I'm possibly getting confused with arrays, objects, functions... Code: var dbase = new Array() for(i in dbase) { dbase[i] = [ artist, name, url ] dbase[i].artist = ("Please enter the artist's name") } Im trying to create a 2d array with these two rows - Example1, Example2, Example3 Example4, Example5, Example6 To print I use this for loop- Code: for(i = 0; i < 2; i++) { for( j = 0 ; j < 3; j++) { document.write(array[i][j]); } } I dont Understand how to create the actual 2d array though. Can someone please shed some light on the situation. Thanks alot |