JavaScript - Drop Down Menu Not Working On Touch Screen Device Ipad
Hi developers
Needing some help. My javascript/css drop down menu is not working on the ipad or other touch screen devices. It works fine on laptops & desktops which use a mouse. I've discovered that this is because touchscreen devices like the Ipad do not recognise the onmouseover/onmouseout event handler that my script relies on. Is there any way I can modify my script so that it is compatiable both with traditional devices and touchscreen devices? The code I am using is: <script type="text/javascript"><!-- var timeout = 500; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // close layer when click-out document.onclick = mclose; //--></script> Which drives the following html: <ul id="links"> <li><a href="whats_new/whats_new.html">what's new</a></li> <li><a href="#" onmouseover="mopen('m1')" onmouseout="mclosetime()">clothing</a> <div id="m1" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="clothing/clothing_page1.html">clothing</a> </div> </li> <li><a href="#" onmouseover="mopen('m2')" onmouseout="mclosetime()">accessories</a> <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="bags/bags_page1.html">bags</a> <a href="jewellery/jewellery_page1.html">jewellery</a> </div> </li> </ul> Any suggestions would be much appreciated. Thank you. Nonye Similar TutorialsHello all, I've got a problem with a JS dropdown menu that I'm using. It's an unordered HTML list that is driven by a JS file. The menu is at Watt You Need Electrical - Offering Electrical Services For Geelong, Bellarine Peninsula & The Surf Coast Initially when I got the menu template all the top level items and all the list items were coded as links. What I've done is make the Electrical heading just text and the two dropdown list items below it are still links. The menu works both on a desktop with a pointer and also on a mobile device by touch. The problem is that on a mobile device when I touch the Electrical heading the dropdown doesn't appear. The Solar heading and the dropdown below it work fine because the Solar heading is still a link. Obviously I've created the problem by changing the Electrical heading to text from a link but I'd like to be able to have it that way. I've tested using some online mobile device emulators and it works OK there but when I physically test on an Iphone 5 the bug is there. I haven't been able to get my hands on any other phones or devices to test yet so don't know if it's a problem just with Iphones or Ipads. I've had a look through the Dropdown.src.js file but it's way beyond me, I've listed both the HTML and JS file below. Code: <!DOCTYPE html> <html> <head> <title>Watt You Need Electrical - Offering Electrical Services For Geelong, Bellarine Peninsula & The Surf Coast</title> <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" /> <meta name="description" content="Watt You Need Electrical is your one stop shop for all types of electrical services. Whether you need some domestic, commercial, or even industrial electrical work done we can help. We also can advise on and install solar power systems and split air conditioners." /> <meta name="keywords" content="electrical services" /> <meta name="robots" content="index, follow" /> <link rel="stylesheet" type="text/css" href="css/styles.css" media="Screen" /> <link rel="stylesheet" type="text/css" href="css/mobile.css" media="handheld" /> <link media="only screen and (max-device-width: 480px)" href="css/mobile.css" type="text/css" rel="stylesheet" /> <script> // initialise the drop-down menus runOnLoad(Dropdown.initialise); </script> </head> <body> <div id="wrapper"> <a href="tel://+61425859742"><div id="mobile_header"></div></a> <a href="tel://+61425859742"><div id="phoneBlock"></div></a> <div id="header"></div> <div id="nav"> <ul class="dropdown"> <li> <a href="index.html">Home</a> </li> <li>Electrical <ul> <li> <a href="domestic_electrician.html">Domestic</a> </li> <li> <a href="electrical_contractors.html">Commercial/Industrial</a> </li> </ul> </li> <li> <a href="air_conditioner_installation.html">Air Conditioners</a> </li> <li> <a href="solar_power_systems.html">Solar</a> <ul> <li><a href="solar_system_maintenance.html">Maintenance</a> </li> <li><a href="solar_energy_facts.html">About Solar</a> </li> </ul> </li> <li> <a href="b_type_gas_service.html">Type B Gas</a> </li> <li> <a href="formgenerator/forms/contact.html">Contact Us</a> </li> </ul> </div> <div id="content-2"> <div class="clear"> </div> <div id="top_border"></div> <div id="content-2-1"> <span class="blackheading">Watt You Need Electrical - Offering Electrical Services For Geelong, Bellarine Peninsula & The Surf Coast</span> <p>Watt You Need Electrical Services can help you with all your electrical needs. We're not one of the big franchise electrical contractors so we can take that extra bit of time and effort to make sure you get the best service and advice. <br /><br /> If it's just an extra power point you need all the way to a complete house rewire, thinking about making the switch to solar power, or if you want a split airconditioner to keep your house or business cool and comfortable, our focus is on exceeding our customer's expectations and providing the best quality job at a competitive price. <br /><br /> Our service doesn't just stop at <a href="domestic_electrician.html">domestic electrical</a> and <a href="solar_power_systems.html">solar power</a>, we can also attend to your <a href="electrical_contractors.html">commercial and industrial electrical</a> needs and we specialise in <a href="b_type_gas_service.html">B Class gas appliance</a> repair and maintenance. Our range of services and quality workmanship are what sets us apart from other electrical contractors. <br /><br /> <a href="formgenerator/forms/contact.html">Contact us</a> today and let Watt You Need Electrical take care of your domestic, solar, air conditioning and commercial and industrial electrical services. </p> </div> <div id="bottom_border"></div> </div> <div id="footer"> <table class="tableFooter"> <tr><td>Watt You Need Electrical Pty. Ltd. © 2014</td></tr> </table> </div> </div> </body> </html> Code: /* Dropdown.js Creates touch-friendly drop-down menus Created by Stephen Morley - http://code.stephenmorley.org/ - and released under the terms of the CC0 1.0 Universal legal code: http://creativecommons.org/publicdomain/zero/1.0/legalcode */ // create the Dropdown object var Dropdown = (function(){ // the delay, in milliseconds var DELAY = 250; // the list of menus var menus = []; // Initialises the drop-down menus. function initialise(){ // listen for touch events on the document if appropriate if ('createTouch' in document){ document.body.addEventListener('touchstart', handleTouchStart, false); } // loop over the menus, converting them var menus = document.querySelectorAll('ul.dropdown'); for (var i = 0; i < menus.length; i ++) applyTo(menus[i]); } /* Handles a touch start event. The parameter is: * * e - the event */ function handleTouchStart(e){ // determine whether any menu is open var isOpen = false; for (var i = 0; i < menus.length; i ++){ if (menus[i].isOpen) isOpen = true; } // return immediately if all menus are closed if (!isOpen) return; // move up the document tree until we reach the root node var node = e.target; while (node != null){ // return immediately if we are inside a drop-down menu if (/\bdropdown\b/.test(node.className)) return; // move onto the parent node node = node.parentNode; } // close all menus close(); } /* Closes all menus except the specified menu. The parameter is: * * menu - a menu not to close; this parameter is optional */ function close(menu){ // loop over the menus, closing them for (var i = 0; i < menus.length; i ++){ if (menus[i] != menu) menus[i].close(); } } /* Creates a drop-down menu. The parameter is: * * node - either the DOM node of the menu or the ID of the node */ function applyTo(node){ // fetch the DOM node if a string was supplied if (typeof node == 'string') node = document.getElementById(node); // create and store the new menu menus.push(new Menu(node)); } /* Creates a drop-down menu. The parameter is: * * node - the DOM node of the menu */ function Menu(node){ // store the node this.node = node; // update the class name node.className += ' dropdownJavaScript'; // listen for mouse events if ('addEventListener' in node){ node.addEventListener( 'mouseover', this.bind(this.handleMouseOver), false); node.addEventListener('mouseout', this.bind(this.handleMouseOut), false); node.addEventListener('click', this.bind(this.handleClick), false); }else{ node.attachEvent('onmouseover', this.bind(this.handleMouseOver)); node.attachEvent('onmouseout', this.bind(this.handleMouseOut)); node.attachEvent('onclick', this.bind(this.handleClick)); } // listen for touch events if appropriate if ('createTouch' in document){ node.addEventListener('touchstart', this.bind(this.handleClick), false); } } // whether the menu is open Menu.prototype.isOpen = false; // the timeout Menu.prototype.timeout = null; /* Binds the specified function to the current object. The parameter is: * * f - the function */ Menu.prototype.bind = function(f){ // return the bound function var thisObject = this; return function(){ f.apply(thisObject, arguments); } } /* Handles a mouse over event. The parameters a * * e - the event * immediate - true to open the menu without a delay */ Menu.prototype.handleMouseOver = function(e, immediate){ // clear the timeout this.clearTimeout(); // find the parent list item var item = ('target' in e ? e.target : e.srcElement); while (item.nodeName != 'LI' && item != this.node) item = item.parentNode; // if the target is within a list item, set the timeout if (item.nodeName == 'LI'){ this.toOpen = item; this.timeout = window.setTimeout(this.bind(this.open), (immediate ? 0 : DELAY)); } } // Handles a mouse out event. Menu.prototype.handleMouseOut = function(){ // clear the timeout this.clearTimeout(); // set the timeout this.timeout = window.setTimeout(this.bind(this.close), DELAY); } /* Handles a click event. The parameter is: * * e - the event */ Menu.prototype.handleClick = function(e){ // close any other menus close(this); // find the parent list item var item = ('target' in e ? e.target : e.srcElement); while (item.nodeName != 'LI' && item != this.node) item = item.parentNode; // check that the target is within a list item if (item.nodeName == 'LI'){ // check whether the item has a closed submenu var submenu = this.getChildrenByTagName(item, 'UL'); if (submenu.length > 0 && !/\bdropdownOpen\b/.test(item.className)){ // open the submenu this.handleMouseOver(e, true); // prevent the default action if ('preventDefault' in e){ e.preventDefault(); }else{ e.returnValue = false; } } } } // Clears the timeout. Menu.prototype.clearTimeout = function(){ // clear the timeout if (this.timeout){ window.clearTimeout(this.timeout); this.timeout = null; } } // Opens the last item hovered over. Menu.prototype.open = function(){ // store that the menu is open this.isOpen = true; // loop over the list items with the same parent var items = this.getChildrenByTagName(this.toOpen.parentNode, 'LI'); for (var i = 0; i < items.length; i ++){ // check whether there is a submenu var submenu = this.getChildrenByTagName(items[i], 'UL'); if (submenu.length > 0){ // check whether the submenu should be opened or closed if (items[i] != this.toOpen){ // close the submenu items[i].className = items[i].className.replace(/\bdropdownOpen\b/g, ''); this.close(items[i]); }else if (!/\bdropdownOpen\b/.test(items[i].className)){ // open the submenu items[i].className += ' dropdownOpen'; // determine the location of the edges of the submenu var left = 0; var node = submenu[0]; while (node){ left += node.offsetLeft; node = node.offsetParent; } right = left + submenu[0].offsetWidth; // move the submenu to the right of the item if appropriate if (left < 0) items[i].className += ' dropdownLeftToRight'; // move the submenu to the left of the item if appropriate if (right > document.body.clientWidth){ items[i].className += ' dropdownRightToLeft'; } } } } } /* Closes the menus within the specified node. The parameter is: * * node - the node; if omitted, all menus are closed */ Menu.prototype.close = function(node){ // if no node was specified, close all menus if (!node){ this.isOpen = false; node = this.node; } // loop over the items, closing their submenus var items = node.getElementsByTagName('li'); for (var i = 0; i < items.length; i ++){ items[i].className = items[i].className.replace(/\bdropdownOpen\b/g, ''); } } /* Returns an array containing the children of the specified node with the * specified tag name. The parameters a * * node - the node * tagName - the tag name */ Menu.prototype.getChildrenByTagName = function(node, tagName){ // initialise the list of children var result = []; // loop over the children, adding those with the right tag name to the list for (var i = 0; i < node.childNodes.length; i ++){ if (node.childNodes[i].nodeName == tagName){ result.push(node.childNodes[i]); } } // return the children return result; } // return the public API return { initialise : initialise, applyTo : applyTo }; })(); Any help is appreciated. Thanks for looking, I am a novice. Desi Drop down menu that works with IE7 & 8 Works with: MSIE6? andversions (that I have checked) of FF, Safari, Safari for iPhone Page: http://sfphotography.com/menu/test.html All files: http://sfphotography.com/menu/ Note, there are no linked pages, IE7 does not even show the option for selecting pages. [code=html] <script type="text/javascript" src="drop_down.js"></script> <style type="text/css"> @import url(style2.css); </style> <body text="black" bgcolor="white" link="#a50921" vlink="#767676" background=""> <div align="center"> <ul><font size="2"> <li><a href="#">Rooms</a> <ul> <li><a href="queen.html">2 Queen / King</a></li> <li><a href="family.html">Family Suite</a></li> <li><a href="jacuzzi.html">Jacuzzi Suite</a></li> </ul> </li> <li><a href="#">Rates</a> <ul> <li><a href="queen_.html">2 Queen / King</a></li> <li><a href="family_.html">Family Suite</a></li> <li><a href="jacuzzi_.html">Jacuzzi Suite</a></li> </ul> </li> </font> </ul> [/code] [code=javascript] // JavaScript Document startList = function() { if (document.all&&document.getElementById) { navRoot = document.getElementById("nav"); for (i=0; i<navRoot.childNodes.length; i++) { node = navRoot.childNodes[i]; if (node.nodeName=="LI") { node.onmouseover=function() { this.className+=" over"; } node.onmouseout=function() { this.className=this.className.replace(" over", ""); } } } } } window.onload=startList; [/code] [code=CSS] body { font: normal 11px verdana; } ul { margin: 0; padding: 0; list-style: none; width: 150px; /* Width of Menu Items */ border-bottom: 1px solid #ccc; } ul li { position: relative; } li ul { position: absolute; left: 149px; /* Set 1px less than menu width */ top: 0; display: none; } /* Styles for Menu Items */ ul li a { display: block; text-decoration: none; color: #777; background: #fff; /* IE6 Bug */ padding: 5px; border: 1px solid #ccc; border-bottom: 0; } /* Fix IE. Hide from IE Mac \*/ * html ul li { float: left; height: 1%; } * html ul li a { height: 1%; } /* End */ ul li a:hover { color: #a50921; background: #f9f9f9; } /* Hover Styles */ li ul li a { padding: 2px 5px; } /* Sub Menu Styles */ li:hover ul, li.over ul { display: block; } /* The magic */ [/code] I'm was working on show and hide drop down menu and this works fine on IE, Google Chrome, Safari but not firefox. Can anyone explain to me one this is? Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head><title></title> <script type="text/javascript"> var timeout = 500; var closetimer = 0; function mopen(eid) { //cancel the timer cancelTimer(); //if there is a existing menu close it if(menu) menu.style.display='none'; //now go about opening the current one var menu = document.getElementById(eid); menu.style.display='block'; } function mclose() { menu.style.display='none'; } function startTimer() { closetimer = window.setTimeout(mclose, timeout); } function cancelTimer() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } </script> <style type="text/css"> body,html { background:#2E2D3B; font-family:Arial; font-size:0.9em; } div#menu { width:120px; height:auto; display:none; border-top:1px solid #cccccc; border-right:1px solid #cccccc; border-left:1px solid #cccccc; overflow:hidden; position:relative; top:3px; } a { color:#f1f1f1; text-decoration:none; } a:hover { text-decoration:underline; } #menu a { color:#111111; text-decoration:none; } #menu a:hover { color:#FF0000; } #menu ul { margin: 0; padding: 0; } #menu li { list-style:none; list-style-position:inside; list-style-type:none; padding:5px; background:#ffffff; border-bottom:1px solid #cccccc; } #menu li:hover { background:#f1f1f1; } </style> </head> <body> <a href="javascript:;" onmouseover="mopen('menu');" onmouseout="startTimer();">Show Menu</a> <div id="menu"> <ul onmouseover="cancelTimer();" onmouseout="startTimer();"> <li><a href="#">Page</a></li> <li><a href="#">Page 1</a></li> <li><a href="#">Page 2</a></li> <li><a href="#">Page 3</a></li> <li><a href="#">Page 4</a></li> <li><a href="#">Page 5</a></li> </ul> </div> </body> </html> And you can view it he http://idigteck.com Thanks, Jon W I thought I was so cool combining both this shopping cart with the double drop down menu, but now my menu isnt working and I can't seem to trouble shoot my way through it anymore. I am sure I am missing just one small part because the page loads fine, but when I select an option from step three where it says "select a subject" it no longer loads the options into the subsequent drop down menu which reads "Pages appear here" (LoL at least I WISH they would appear there) Here is the code. I apologize for not making it smaller, but as I mentioned it is meshed with a shopping cart and I am not skilled enough to seperate my code. Code: <head> <script language="javascript"> <!--// //new Option("text","value") //this code changes menus function nullOptionsDMA(aMenu){ var tot=aMenu.options.length for (i=0;i<tot;i++) { aMenu.options[i]=null } aMenu.options.length=0; } function MySubjectDMA0(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Drink Low/No Alcohol Beer","295"); options[2]=new Option("Drink Mixed Drinks","295"); options[3]=new Option("Buy Chewing Tobacco","295"); options[0].selected=true } } function MySubjectDMA1(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Buy Fine Jewelry,<$400","295"); options[2]=new Option("Buy Aerobic/Fitness Shoes, $50+","295"); options[3]=new Option("Dry Cleaning,$100+","295"); options[0].selected=true } } function MySubjectDMA2(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Lease Most Recent Vehicle","295"); options[2]=new Option("Own/Lease New Vehicle","295"); options[3]=new Option("Own/Lease Used Vehicle","295"); options[0].selected=true } } function MySubjectDMA3(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Has Satellite Dish","295"); options[2]=new Option("Watch Any Pay-per-View","100"); options[0].selected=true } } function MySubjectDMA4(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Own Camcorder","295"); options[2]=new Option("Buy Any TV","295"); options[3]=new Option("Own 3+ Television Sets","295"); options[0].selected=true } } function MySubjectDMA5(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Has Any Homeowner/Per Pr Insurance","295"); options[2]=new Option("Has Auto","295"); options[3]=new Option("Has Disability Insurance","295"); options[0].selected=true } } function MySubjectDMA6(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Grocery Shop,4+ Times 1wk","295"); options[2]=new Option("Grocery Store, Travel 11+ Miles ","295"); options[0].selected=true } } function MySubjectDMA7(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Buy Health/Beauty Products for Women,$100+","295"); options[2]=new Option("Go to the Doctor for Check-Ups","295"); options[3]=new Option("Use Hair Growth Products","295"); options[0].selected=true } } function MySubjectDMA8(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Buy from Fast Food","295"); options[2]=new Option("Dine Out,1+ Times/wk","295"); options[3]=new Option("Dine Out,<1 Times/mo","295"); options[0].selected=true } } function MySubjectDMA9(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Belong to a Church Board ","295"); options[2]=new Option("Belong to a Country Club ","100"); options[3]=new Option("Buy Any Children's Toys","295"); options[0].selected=true } } function MySubjectDMA10(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","295"); options[1]=new Option("Average Monthly Cell Phone Bill,$100+","295"); options[2]=new Option("Own Cell Phone ","295"); options[3]=new Option("Has Cell Phone for Business Use ","295"); options[0].selected=true } } function MySubjectDMA11(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","0"); options[1]=new Option("Ads Keep Me Up-to-Date about Prods/Svcs I Want","295"); options[2]=new Option("Buy Based on Quality, Not Price","295"); options[3]=new Option("Choose Store b/c Store Personnel Service","295"); options[0].selected=true } } function MySubjectDMA12(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","1650"); options[1]=new Option("Has Cooling Equipment, Heat Pump","1650"); options[2]=new Option("Has Heater System, Central Warm","1650"); options[3]=new Option("Has Heater System, Heat Pump ","1650"); options[0].selected=true } } function MySubjectDMA13(aMenu){ nullOptionsDMA(aMenu) with (aMenu){ //Rewrites the text and values options[0]=new Option("Select a page","1650"); options[1]=new Option("Has Online Game Download Sub","1650"); options[2]=new Option("Has Online Movie Download Sub","1650"); options[3]=new Option("Has Online","1650"); options[0].selected=true } } /* ####################### setUp100 ####################### */ function setUpDMA(){ with (document.orderform) { if (menuSubjectsDMA.selectedIndex==0){ menuSubjectsDMA.options[0].selected=true qty4.options[0].selected=true } if (menuSubjectsDMA.selectedIndex==1) MySubjectDMA0(qty4) if (menuSubjectsDMA.selectedIndex==2) MySubjectDMA1(qty4) if (menuSubjectsDMA.selectedIndex==3) MySubjectDMA2(qty4) if (menuSubjectsDMA.selectedIndex==4) MySubjectDMA3(qty4) if (menuSubjectsDMA.selectedIndex==5) MySubjectDMA4(qty4) if (menuSubjectsDMA.selectedIndex==6) MySubjectDMA5(qty4) if (menuSubjectsDMA.selectedIndex==7) MySubjectDMA6(qty4) if (menuSubjectsDMA.selectedIndex==8) MySubjectDMA7(qty4) if (menuSubjectsDMA.selectedIndex==9) MySubjectDMA8(qty4) if (menuSubjectsDMA.selectedIndex==10) MySubjectDMA9(qty4) if (menuSubjectsDMA.selectedIndex==11) MySubjectDMA10(qty4) if (menuSubjectsDMA.selectedIndex==12) MySubjectDMA11(qty4) if (menuSubjectsDMA.selectedIndex==13) MySubjectDMA12(qty4) if (menuSubjectsDMA.selectedIndex==14) MySubjectDMA13(qty4) } } /* ####################### changeFiles ####################### */ function changeFilesDMA(){ aMenu=document.orderform.menuSubjectsDMA aMenu2=document.orderform.qty4 with (aMenu){ switch (selectedIndex) { case 0: aMenu2.options.length=0; aMenu2.options[0]= new Option("Pages appear here","0") aMenu2.options[0].selected=true; history.go(0) break case 1: MySubjectDMA0(aMenu2) aMenu2.options[0].text="Drink Any Beer" break case 2: MySubjectDMA1(aMenu2) aMenu2.options[0].text="Buy Costume Jewelry" break case 3: MySubjectDMA2(aMenu2) aMenu2.options[0].text="Bought Most Recent Vehicle" break case 4: MySubjectDMA3(aMenu2) aMenu2.options[0].text="Subscribe to Cable TV" break case 5: MySubjectDMA4(aMenu2) aMenu2.options[0].text="Buy Camera" break case 6: MySubjectDMA5(aMenu2) aMenu2.options[0].text="Has Any Credit Card" break case 7: MySubjectDMA6(aMenu2) aMenu2.options[0].text="Grocery Shopping spend $150+ 1wk" break case 8: MySubjectDMA7(aMenu2) aMenu2.options[0].text="Buy Health/Beauty Products for Men,$100+" break case 9: MySubjectDMA8(aMenu2) aMenu2.options[0].text="Buy from Any Fast Food Restaurant" break case 10: MySubjectDMA9(aMenu2) aMenu2.options[0].text="Attend Classical/Opera perform.,1+ Times/mo" break case 11: MySubjectDMA10(aMenu2) aMenu2.options[0].text="Average Monthly Cell Phone Bill,<$26" break case 12: MySubjectDMA11(aMenu2) aMenu2.options[0].text="Ads Are More Manipulative Than Informative100" break case 13: MySubjectDMA12(aMenu2) aMenu2.options[0].text="Has Cooling Equipment, Central Air" break case 14: MySubjectDMA13(aMenu2) aMenu2.options[0].text="Has Wireless home network" break } } } //--> </script> <!-- ######## end copying code (DMA) from the HEAD ####### --> <script> <!-- function wopen(url, name, w, h) { // Fudge factors for window decoration space. // In my tests these work well on all platforms & browsers. w += 32; h += 96; var win = window.open(url, name, 'width=' + w + ', height=' + h + ', ' + 'location=no, menubar=no, ' + 'status=no, toolbar=no, scrollbars=no, resizable=no'); win.resizeTo(w, h); win.focus(); } // --> </script> <SCRIPT SRC="language-en.js"></SCRIPT> <SCRIPT SRC="nopcart.js"> </SCRIPT> <link rel="stylesheet" type="text/css" href="main.css"> </head> <BODY> <table class="Global" cellpadding="0" cellspacing="0" border="0"> <tr><td height="117" colspan="2"> <!-- ============ Navbar Menu ============== --> <table class="NavBar" style="height: 27px;" cellspacing="0" border="0"><tr><td> <table class="NavBarMenu" style="height: 27px;" align="left" border="0" cellspacing="0"><tr> <td><a href="index.html">Home</a> </td> <td><a href="samples.html">Samples</a> </td> <td><a href="ordering.html">Ordering</a> </td> <td><a href="faq.html">F.A.Q.</a> </td> <td><a href="contact.html">Contact</a></td> </tr></table> </td></tr></table> <div style="height: 1px; background: #000000;"><img src="images/space1x1.gif" width="1" height="1" alt="spacer"></div> <noscript> <p style="color:red">You appear to have Javascript disabled. This page requires Javascript. Please <a href="http://support.microsoft.com/gp/howtoscript" target="_blank">enable Javascript</a> and reload this page before continuing.</p> </noscript> <script language="JavaScript"> <!-- function CalculateTotals(){ f=document.orderform; f.total1.value=parseInt(f.qty1.value)*50; f.total2.value=parseInt(f.qty2.value)*((f.qty1.value)*10+10); f.total3.value=parseInt(f.qty3.value)*100; f.total4.value=parseInt(f.qty4.value)*1.2; f.grandtotal.value=parseInt(f.total1.value) +parseInt(f.total2.value) +parseInt(f.total3.value) +parseInt(f.total4.value) +parseInt(f.sh.value);} //--> </script></head> <body> <form name="orderform" method="post" action="formprocessor"> <table border="1" width="100%" cellpadding="4"><tr> <td colspan="2" align="center"><b>Step 1: Select what to include in your report</b><br><i>My report should...</i></td></tr> <tr><td> Evaluate a radius of <select name="qty1" onchange="CalculateTotals()"> <option Selected value="0">5 miles <option value="1">10 miles <option value="2">15 miles <option value="3">20 miles </select> around <INPUT TYPE="text" NAME="Location" VALUE="Full Address OR Zipcode" SIZE="22" MAXLENGTH="45"> </td> <td align="right"><input name="total1" size="7" OnFocus="document.orderform.qty2.select(); document.orderform.qty2.focus();" /></td></tr> <tr><td> <select name="qty2" onchange="CalculateTotals()"> <option Selected value="0">No <option value="1">Yes </select> Include competitive analysis (<a href="whatis1.html" target="popup" onClick="wopen('whatis1.html', 'popup', 350, 450); return false;">what is this?</a>) </td> <td align="right"><input name="total2" size="7" OnFocus="document.orderform.qty3.select(); document.orderform.qty3.focus();" /></td></tr> <tr><td> <select name="qty3" onchange="CalculateTotals()"> <option Selected value="0">No <option value="1">Yes </select> Include target market report (<a href="whatis2.html" target="popup" onClick="wopen('whatis2.html', 'popup', 350, 450); return false;">what is this?</a>) </td> <td align="right"><input name="total3" size="7" OnFocus="document.orderform.qty4.select(); document.orderform.qty4.focus();" /></td></tr> </table><br><table border="1" width="100%" cellpadding="4"> <tr><td colspan="4" align="center"> <b>Step 2: Define your target market</b><br><i>The people I am looking for are...</i></td></tr> <tr><td colspan="2"> Household Age</td><td colspan="2"> <select name="HHAge" onchange="CalculateTotals()"> <option Selected value="">Target Age <option value="Less than 35">Less than 35 <option value="Less than 100">Less than 55 <option value="25to44">25-44 </select> <tr><td colspan="2"> Average Household Education</td><td colspan="2"> <select name="HHEducation" onchange="CalculateTotals()"> <option Selected value="">Target Education <option value="GradPlus">Graduate Plus <option value="CollegeGrad">College Grad </select><br> <tr><td colspan="2"> Household Employment Type</td><td colspan="2"> <select name="HHEmployment" onchange="CalculateTotals()"> <option Selected value="">Target Employment <option value="Management">Management <option value="Professional">Professional </select><br> <tr><td colspan="2"> Household Ethnicity</td><td colspan="2"> <select name="HHEthnicity" onchange="CalculateTotals()"> <option Selected value="">Target Ethnicity <option value="White">White <option value="WhiteAsianMix">White, Asian, Mix </select><br> <tr><td colspan="2"> Household Composition</td><td colspan="2"> <select name="HHComposition" onchange="CalculateTotals()"> <option Selected value="">Target Age <option value="HHwithKids">Household with kids <option value="MostlywithKids">Mostly with kids </select><br> <tr><td colspan="2"> Household Income</td><td colspan="2"> <select name="HHIncome" onchange="CalculateTotals()"> <option Selected value="">Target Income <option value="Wealthy">Wealthy <option value="Upscale">Upscale <option value="UpperMiddle">Upper Middle <option value="Middle">Middle <option value="LowerMid">Lower Middle </select><br> <tr><td colspan="2"> Household Tenure</td><td colspan="2"> <select name="HHTenure" onchange="CalculateTotals()"> <option Selected value="">Target Tenure <option value="Homeowners">Homeowners <option value="Renters">Renters </select><br> </td></tr> </table><br><table border="1" width="100%" cellpadding="4"> <tr><td colspan="4" align="center"><b>Step 3: Add a specialty targeting criteria</b><br><i>I want people who...</i></td></tr><tr></td> <tr><td> <!-- This menu holds the subjects--> <select name="menuSubjectsDMA" onChange="changeFilesDMA()" size="1"> <option value="0">Select a subject <option value="">Alcohol & Tabacco $295 <option value="">Jewelry & Apparel $295 <option value="">Automotive $295 <option value="">TV Media $295 <option value="">Electronics & Internet $295 <option value="">Finance $295 <option value="">Grocery $295 <option value="">Health & Drugs $295 <option value="">Restaurants $295 <option value="">Sports & Leisure $295 <option value="">Telecommunications $295 <option value="">Consumer Behavior $295 <option value="">Home and Utilities $1980 <option value="">Home Technology $1980 </select> </td><td colspan="2"> <!-- this menu holds the files to go--> <select name="qty4" onChange="CalculateTotals()" style="width:200" size="1"> <option value="0">Pages appear here </select> <td align="right"><input name="total4" size="7" OnFocus="document.orderform.qty1.select(); document.orderform.qty1.focus();" /></td></tr> </td></tr> </table><br> <table border="1" width="100%" cellpadding="4"> <tr><td colspan="4" align="center"><b>Step 4: Tell us about your business</b><br><i>Customize my report for...</i></td></tr> <tr><td> <td align="right">Minimum Order:</td><td align="right">$200 </td></tr> <tr><td></td><td></td> <td align="right"><b>GRAND TOTAL:</b></td> <td align="right"><input name="grandtotal" size="7" OnFocus="document.orderform.qty1.select(); document.orderform.qty1.focus();" /></td></tr> </table> <input type="hidden" value="5" name="sh" /> <br /> <center><input type="reset" value="Reset Form"> <input type="submit" value="Proceed to Checkout"> </center> </form> <script language="JavaScript"> <!-- f=document.orderform; f.qty1.value=0; f.qty2.value=0; f.qty3.value=0; f.qty4.value=0; f.total1.value=0; f.total2.value=0; f.total3.value=0; f.total4.value=0; f.sh.value=200; f.grandtotal.value=200; //--> </script> </body></html> <!-- ======= End Content ======== --> </td></tr> <!-- ======== Footer ========== --> <tr><td colspan="2" class="Footer" style="vertical-align: middle;"> Copyright © GrowthEdge </td></tr></table> </body> </html> I also check my email regularly if anyone has any comments or advice. I am working on a website that features a custom javascript enabled audio player with an animated playhead to follow along with the provided spectrogram. An example of this is included below. http://cetus.ucsd.edu/voicesinthesea.../humpback.html I am having difficulty figuring out why the audio/spectrogram player does not work on an iPad. This component was built by a developer who I am not longer in contact with, thus I am in urgent need of some advice/wisdom. Thank you! hi, When I navigate to a page with Ajax on my iphone or ipad, it doesn't show up, page is just blank, I have checked for errors and there is no errors?! here is my Ajax code Code: function datecheckFunction(){ var datecheckRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari datecheckRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ datecheckRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ datecheckRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server datecheckRequest.onreadystatechange = function(){ if(datecheckRequest.readyState == 4){ var ajaxDisplay = document.getElementById('ajaxDiv'); ajaxDisplay.innerHTML = datecheckRequest.responseText; } } var datepicker = document.getElementById('datepicker').value; var queryString = "?datepicker=" + datepicker; //Add the following line datecheckRequest.open("GET", "http://www.affordableappliancerepairs.co.uk/admin/checkdate.php" + queryString, true); datecheckRequest.send(null); } Hi all, this is my first post so forgive me for any errors but i'll try and give all the information i can. i use Xara Designer Pro and i have used a 3rd party software to create a html menu however i have a html loading screen on my site and the menu always appears on top of the screen and while the screen is loading, this is the only thing that appears on top everything else is fine, i have put this to the people on the xara forums and the opinion is that its probably the JS file that the menu is using that is telling it to appear on top. i was wondering what i should look for to determin this problem or if someone could take a look at it for me? i'll upload the JS here and see if anyone can help. my site is at www.pcevo.co.uk however you need to CTRL + F5 to refresh wihtout the cache to see the loading screen if you are on a fast connection.
I know how to edit the CSS, and minute parts of the JavaScript code (for example; speed of the drop). The problem is, I had a massive amount of help making the Javascript side of the menu, and do not know how to edit it... I want the rules to still apply, where only one can be expanded at a time (one of the first drops, and then only one of the sub-drops). I noticed in the code, I can edit it so there can be more than one drop, but that would mean, the whole menu could be expanded Also, I want my sub-drops. to have different span colour than the main drop. but trhe links and such, (everything else about it) can be the same.... My live demo is here! Thank you for any help and/or advice in advance, Best Regards, Tim I am using this javascript code to detect screen size and display an alternate css. Code: if (screen.width<1600) { document.write('<link rel="stylesheet" href="<?php echo $path ?>/css/templateadjust.css" type="text/css" />'); } This works fine in FF and Chrome but doesn't seem to work in IE. Any idea why? Hello Folks, I installed a template on the following site and did not actually write the javascript dropdown menu seen at the top of http://sthomaslc.com/ The problem is that if parent list items Ministries and Parish Leadership have enough children, they expand out right off of the screen of low resolution setups. I am totally new to javascipt programming so excuse my ignorance when I ask how to make the children items to expand out left instead of right if it's detected that the menu has hit the right side of the browser window. Best Regards David ? how would i make it for a menu so you could press it and it would go down to click on a link.
I am using this: http://www.crowdsavings.com/open-source/drawbox (http://page-test.co.uk/jquery.drawbox.js is the main JS file). It works fine on desktop browsers, but there is an issue on every Touch mobile phone I have tried. When you draw on the canvas and then go to click a button off the canvas, it doesn't work. You need to touch off the canvas and then the button. So using the demo above, if you draw on the canvas and then click the 'Clear Canvas' button, it doesn't work and you have to press it again. I have tried setting focus on the body and also detecting what the focus is when a touch action is performed, but no luck. I know the entire screen is responsive to touch and mouse events, where I would have thought it best to just make the canvas section respond to touch/mouse events. Hello, I just created a new page topper for my website, and am new to javascript. I spent HOURS on designing all of the mouseover images that are on my website now, except there are spaces in between all of the images and I designed them to touch. You can see what I am talking about on my website he http://www.corporateavedesign.com I've tried everything in the code to get these images to touch. Can anyone help? Here is my code: Code: <SCRIPT LANGUAGE="JavaScript"> <!-- Begin loadImage1 = new Image(); loadImage1.src = "http://www.corporateavedesign.com/images/website-logoMO1.jpg"; staticImage1 = new Image(); staticImage1.src = "http://www.corporateavedesign.com/images/website-logo1.jpg"; loadImage2 = new Image(); loadImage2.src = "http://www.corporateavedesign.com/images/website-logoMO2.jpg"; staticImage2 = new Image(); staticImage2.src = "http://www.corporateavedesign.com/images/website-logo2.jpg"; loadImage3 = new Image(); loadImage3.src = "http://www.corporateavedesign.com/images/website-logoMO3.jpg"; staticImage3 = new Image(); staticImage3.src = "http://www.corporateavedesign.com/images/website-logo3.jpg"; loadImage4 = new Image(); loadImage4.src = "http://www.corporateavedesign.com/images/website-logoMO4.jpg"; staticImage4 = new Image(); staticImage4.src = "http://www.corporateavedesign.com/images/website-logo4.jpg"; loadImage5 = new Image(); loadImage5.src = "http://www.corporateavedesign.com/images/website-logoMO5.jpg"; staticImage5 = new Image(); staticImage5.src = "http://www.corporateavedesign.com/images/website-logo5.jpg"; loadImage6 = new Image(); loadImage6.src = "http://www.corporateavedesign.com/images/website-logoMO6.jpg"; staticImage6 = new Image(); staticImage6.src = "http://www.corporateavedesign.com/images/website-logo6.jpg"; // End --> </script> <!-- STEP TWO: Insert this code into the BODY of your HTML document --> <TD style="BORDER-TOP: #000000 0px solid; BORDER-LEFT-WIDTH: 0px; BORDER-LEFT-COLOR: #000000; BORDER-BOTTOM: #000000 0px solid; BORDER-RIGHT-WIDTH: 0px; BORDER-RIGHT-COLOR: #000000" vAlign=bottom bgColor=#ffffff colSpan=2 height=10> <CENTER> <a href="http://www.corporateavedesign.com/" onmouseover="image1.src=loadImage1.src;" onmouseout="image1.src=staticImage1.src;"> <img name="image1" src="http://www.corporateavedesign.com/images/website-logo1.jpg" border=0></a> <a href="http://www.corporateavedesign.com/" onmouseover="image2.src=loadImage2.src;" onmouseout="image2.src=staticImage2.src;"> <img name="image2" src="http://www.corporateavedesign.com/images/website-logo2.jpg" border=0></a> <a href="http://www.corporateavedesign.com/pages/AboutUs.htm" onmouseover="image3.src=loadImage3.src;" onmouseout="image3.src=staticImage3.src;"> <img name="image3" src="http://www.corporateavedesign.com/images/website-logo3.jpg" border=0></a> <a href="http://www.corporateavedesign.com/contact.htm" onmouseover="image4.src=loadImage4.src;" onmouseout="image4.src=staticImage4.src;"> <img name="image4" src="http://www.corporateavedesign.com/images/website-logo4.jpg" border=0></a> <a href="http://www.corporateavedesign.com/pages/Portfolio.htm" onmouseover="image5.src=loadImage5.src;" onmouseout="image5.src=staticImage5.src;"> <img name="image5" src="http://www.corporateavedesign.com/images/website-logo5.jpg" border=0></a> <a href="http://www.corporateavedesign.com/category_36/Current-Price-List.htm" onmouseover="image6.src=loadImage6.src;" onmouseout="image6.src=staticImage6.src;"> <img name="image6" src="http://www.corporateavedesign.com/images/website-logo6.jpg" border=0></a> </CENTER> Please help if you can, I am desperate and my website looks crazy right now! THANKS!!! I'd be grateful for any help please. I've just started to build my first ever sencha app and am pleased with the results so far, but am now stuck on one thing. I've built a search form and want to be able to display the results on the same page, but this is where I'm stuck. The form works and sends the results using GET, but it doesn't send it to the correct place. I want to show it on the same page (I've built a php file called search.php to handle the results), but it reloads the whole app with the variables in the url. I've tested all of the code away from the app and it works perfectly so I know the problem isn't with the code, but more with my lack of understanding of Sencha so would be extremely grateful for any help. Code: searchForms = new Ext.TabPanel({ fullscreen: true, title: 'Search', displayField: 'text', sto searchForm, iconCls: 'search', items: [{ id: 'searchSubmit', xtype: 'form', standardSubmit : true, scroll: 'vertical', items: [{ xtype: 'fieldset', title: 'Keywords', defaults: { // labelAlign: 'right' labelWidth: '35%' }, items: [{ xtype: 'textfield', name: 'keywords', id: 'keywords', placeHolder: 'EG: Music, TV', autoCapitalize : true, required: true, useClearIcon: true }] }, { xtype: 'fieldset', title: 'Advanced Search', items: [{ xtype: 'selectfield', name: 'genre', id: 'genre', label: 'Genre', options: [{ text: 'All', value: ' ' text: 'Country', value: '1' text: 'Sci-Fi', value: '2' text: 'Western', value: '3' }] }, { xtype: 'selectfield', name: 'media', id: 'media', label: 'Media', options: [{ text: 'All', value: ' ' text: 'Music', value: '1' text: 'TV', value: '2' text: 'Movie', value: '3' }] }] }, { layout: 'vbox', defaults: {xtype: 'button', flex: 1, style: 'margin: .5em;'}, items: [{ text: 'Search', ui: 'confirm', scope: this, hasDisabled: false, handler: function(){ searchForms.submit({ url: 'search.php' }); } }, { text: 'Reset', ui: 'decline', handler: function(){ searchForms.reset(); } }] }] }] }); I've then tried to use this to display the results on the same page, but as I say this just doesn't work. It doesn't call the search.php page at all. I've made sure all of the files (except the index.js file which is in a js folder) are in the same directory as the index.html file. I've also tried to load the file in the app seperately by using: Code: Ext.regModel('mobile', { fields: [ {name: 'text', type: 'string'} ] }); var searchForm = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'search.php?keywords=test', reader: { type: 'tree', root: 'items' } } }); and that works perfectly so I know that all of the php stuff is working and does work with Sencha Touch, but I'm just not sure how to get it to only work when somebody clicks 'search' I'd be grateful for any help with this as I've spent days searching the web to get this fix, but nothing seems to be working I don't know if this is of help, but the main javascript file is: Code: var tabPanel; var homePanel = new Ext.Panel({ title: 'Home', iconCls: 'home', fullscreen: true, scroll:{direction:'vertical',threshold:7}, items: [{ html: '<center><p>Home</p></center>' }] }); var servicePanel = new Ext.Panel({ title: 'Services', iconCls: 'team', fullscreen: true, items: [{ html: '<center>Please choose a service</center>' }] }); var searchPanel = new Ext.Panel({ title: 'Search', iconCls: 'search', fullscreen: true, items: [{ html: '<center>Search</center>' }] }); var feedtabpanel = new Ext.Carousel({ title: 'More', iconCls: 'more', fullscreen: true, sortable : true, xtype:'panel', scroll:{direction:'vertical',threshold:7}, items: [ { title: 'Contact', html : '<center><h1>Contact Us</h1></center>', }, { title: 'Feedback', html : '<center><h1>Let us know what you think<h1></center>', }, { title: 'Tell a friend', html : '<center><h1>Tell your friends how much you love this app</h1></center>', } ] }); searchForms = new Ext.TabPanel({ fullscreen: true, title: 'Search', displayField: 'text', sto searchForm, iconCls: 'search', items: [{ id: 'searchSubmit', xtype: 'form', standardSubmit : true, scroll: 'vertical', items: [{ xtype: 'fieldset', title: 'Keywords', defaults: { // labelAlign: 'right' labelWidth: '35%' }, items: [{ xtype: 'textfield', name: 'keywords', id: 'keywords', placeHolder: 'EG: Music, TV', autoCapitalize : true, required: true, useClearIcon: true }] }, { xtype: 'fieldset', title: 'Advanced Search', items: [{ xtype: 'selectfield', name: 'genre', id: 'genre', label: 'Genre', options: [{ text: 'All', value: ' ' text: 'Country', value: '1' text: 'Sci-Fi', value: '2' text: 'Western', value: '3' }] }, { xtype: 'selectfield', name: 'media', id: 'media', label: 'Media', options: [{ text: 'All', value: ' ' text: 'Music', value: '1' text: 'TV', value: '2' text: 'Movie', value: '3' }] }] }, { layout: 'vbox', defaults: {xtype: 'button', flex: 1, style: 'margin: .5em;'}, items: [{ text: 'Search', ui: 'confirm', scope: this, hasDisabled: false, handler: function(){ searchForms.submit({ url: 'search.php' }); } }, { text: 'Reset', ui: 'decline', handler: function(){ searchForms.reset(); } }] }] }] }); Ext.regModel('mobile', { fields: [ {name: 'text', type: 'string'} ] }); var searchForm = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'search.php', reader: { type: 'tree', root: 'items' } } }); var store = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'areas.php', reader: { type: 'tree', root: 'items' } } }); var nestedList = new Ext.NestedList({ fullscreen: true, title: 'Location', displayField: 'text', sto store, iconCls: 'locate', }); nestedList.on('leafitemtap', function(subList, subIdx, el, e) { var store = subList.getStore(), record = store.getAt(subIdx), recordNode = record.node, title = nestedList.renderTitleText(recordNode), card, preventHide, anim; if (record) { card = record.get('card'); anim = record.get('animation'); preventHide = record.get('preventHide'); } if (card) { tabPanel.setCard(card, anim || 'slide'); tabPanel.currentCard = card; } }); var services = new Ext.data.TreeStore({ model: 'mobile', proxy: { type: 'ajax', url: 'subcats.php', reader: { type: 'tree', root: 'items' } } }); var servicesList = new Ext.NestedList({ fullscreen: true, title: 'Services', displayField: 'text', sto services, iconCls: 'team', }); servicesList.on('leafitemtap', function(subList, subIdx, el, e) { var store = subList.getStore(), record = store.getAt(subIdx), recordNode = record.node, title = servicesList.renderTitleText(recordNode), card, preventHide, anim; if (record) { card = record.get('card'); anim = record.get('animation'); preventHide = record.get('preventHide'); } if (card) { tabPanel.setCard(card, anim || 'slide'); tabPanel.currentCard = card; } }); Ext.setup({ icon: 'icon.png', glossOnIcon: false, tabletStartupScreen: 'tablet_startup.png', phoneStartupScreen: 'phone_startup.png', onReady: function() { tabPanel = new Ext.TabPanel({ tabBar: { dock: 'bottom', layout: { pack: 'center' } }, fullscreen: true, ui: 'dark', animation: { type: 'cardslide', cover: true }, items: [ homePanel, nestedList, servicesList, searchForms, feedtabpanel ] }); } }) i am new to sencha touch,and i created a login form which accepts user id and password and a login button,so when i click on login button i should get the user id value as a alert.and the code is Code: Ext.setup ({ onReady: function () { var myform=new Ext.form.FormPanel({ id:'form', fullscreen:true, standardSubmit:true, dockedItems:[{ Dock:'top', xtype:'toolbar', height:40, title:'Tool Bar', id:'login', } ], items:[{ xtype:'textfield', name:'id', width:'50%', align:'center', label:'User Id' }, { xtype:'textfield', name:'pwd', id:'pwd', width:'50%', align:'center', label:'Password' }, { xtype:'button', ui:'round', width:'50%', text:'Login', align:'center', handler:function() { gettingvalues();/* var fields = form.getValues(); console.log(fields['name']); */ } } ], }); gettingvalues=function() { var fields=myform.getValues(); Ext.Msg.alert(fields['id'].getValue()); } } }); But am not getting any value in alert,what i have to do. and after that i want to send those values to our local server which requires id and password,it will be in the format of... oururl?action=login&id=xyz&pwd=xyz, in this it will accepts and returns the response,so for that what i have to write, please let me know as soon as possible. Thanks in advance. Edit2:: This is what I got to work. Code: <INPUT class=touch type=button value='UP' onMouseDown="up=true;" onMouseUp="up=false;"> <INPUT class=touch type=button value='DOWN' onMouseDown="down=true;" onMouseUp="down=false;"> Then added a check to see if (up==true) {move up code} else if (down==true) {move down code} etc Edit:: Basically Code: <INPUT class=touch type=button value='38' onMouseDown="movingUP();"> Then in JS Code: function movingUP(){ window.event.keyCode = 38; } But what do I put in movingUP() to send keyCode 38 when while the button is being clicked????????????????????? Trying to add 8 icons of W,A,S,D, LEFT, RIGHT, UP, DOWN which upon click/touch will input the relative command to the screen canvas for mobiles that don't have a keyboard. They aren't clicking on the canvas. I need some buttons/icons/images outside the canvas probably in a div, that send input events as an alternative to a keyboard...Something that can be clicked and held down to repeatedly spam that key to walk in that direction. I have script to click icons from a keyboard and output the clicked key to a text field, but I don't know how to tie it into my keyboard listener in my game.. My game code uses: Code: // Handle keyboard controls var keysDown = {}; addEventListener("keydown", function (e) { keysDown[e.keyCode] = true; }, false); addEventListener("keyup", function (e) { delete keysDown[e.keyCode]; }, false); Then elsewhere I can trigger events when keysDown contains the number of a key that triggers an item like: Code: if (38 in keysDown && hero.y > 0 ) { // Player holding UP key //walk north code here } Is there a simple way to click on a button and send the "UP" keyCode to the entire screen? Particularly the canvas element......Or get it into my keysDown[e.keyCode]; I found this: Quote: function addKey(cKey) { d = document.forms["foo"].elements["bar"]; d.value = (cKey.value=='backspace') ? d.value.slice(0,-1) : d.value+cKey.value; } //elsewhere in html body <INPUT class=touch type=button value=w onClick="addKey(this)"> which will send 'w' when clicked, and I tried to send '38' instead but it only sends it to 1 element and not the entire screen....so it shows 38 in a text box each time I click it but it doesn't actually send 38 to keys being pressed. Is there a simple way to do this? I wanted to add a fire button and others I figured I could just put an image with an event but can't figure it out.... Can anyone tell me how or point me to a tutorial which shows how to go about coding a drop down menu "without a button", where i can store all my links. Thanks i have done dropdown menu dynamic using php in which data fetched from database(mysql).now i've to do that if i'll choose any option from dropdown menu that particular item's rate will also fetch from data base and display in a text box.that value can also be changed.plzz help me .give some idea.
I presently have a drop down menu in one of my sites. I wish to break it down one more time so that it opens up on the side. However, not being a javascript expert I cannot figure out how to do it. I assume it is something within the coding that needs to be changed, or even a new section added. I have included the coding, please can someone point me in the right direction. Thank you so much! Monica CODE: var timeout = 500; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // close layer when click-out document.onclick = mclose; </SCRIPT> <script type='text/javascript'> $(function() { $('#nav-drop').droppy(); }); SDDM: #sddm { margin: 0; padding: 0; z-index: 300} #sddm li { margin: 0; padding: 0; list-style: none; float: left; font: 14px Arial, Helvetica, sans-serif} #sddm li a { display: block; margin: 0 1px 0 0; padding: 2px 6px; width: 95px; background: ##333366; color: #FFFFFF; text-align: center; text-decoration: none} #sddm li a:hover { background: #9F8469} #sddm div { position: absolute; visibility: hidden; margin: 0; padding: 0; background: #333366; border: 1px solid #FFFFFF} #sddm div a { position: relative; display: block; margin: 0; padding: 5px 10px; width: auto; white-space: nowrap; text-align: left; text-decoration: none; background: #333366; color: #FFFFFF; font: 14px Arial, Helvetica, sans-serif} #sddm div a:hover { background: #9F8469; color: #FFFFFF} .style12 { color: #FFFFFF; font-family: Arial, Helvetica, sans-serif; font-size: 12px; } HTML: <tr> <td height="21" colspan="3" bgcolor="#333366"> <ul id="sddm"> <li><a href="index.html" class="style18">HOME</a></li> <li><a href="about_us.html" class="style18">ABOUT US</a></li> <li><a href="criminal_law.html" class="style18" onmouseover="mopen('m2')" onmouseout="mclosetime()">CRIMINAL LAW </a> <div id="m2" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="driving-impared_offences.html">Driving/Impaired Offences</a> <a href="drug_related_chages.html">Drug Related Charges</a> <a href="bail_hearing.html">Bail Hearing</a> <a href="fraud_theft.html">Fraud/Theft</a> <a href="assault.html">Assault</a> would like to break this assault button down to 4 more options <a href="domestic_violence.html">Domestic Violence</a> <a href="break_enter_robbery.html">Break & Enter/Robbery</a> <a href="weapons_offences.html">Weapons Offences</a> <a href="fail_to_comply.html">Fail to Comply</a> </div> </li> <li><a href="family_law.html" class="style18" onmouseover="mopen('m3')" onmouseout="mclosetime()">FAMILY LAW</a> <div id="m3" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="family_law_divorce.html">Divorce</a> <a href="family_law_custody_access.html">Custody and Access</a> <a href="child_spousal_support.html">Child/Spousal Support</a> <a href="division_of_property.html">Division of Property</a> <a href="restraining_orders.html">Restraining Orders</a> <a href="cas_matters.html">CAS Matters</a> <a href="paternity.html">Paternity</a> <a href="adoptions.html">Adoptions</a> <a href="premarital_cohapitation_separtion_agreements.html">Premarital/Cohabitation/Separation Agreements</a> </div> </li> <li><a href="civil.html" class="style18" onmouseover="mopen('m4')" onmouseout="mclosetime()">CIVIL LITIGATION</a> <div id="m4" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="personal_injury.html">Personal Injury</a> <a href="wrongful_dismissal.html">Wrongful Dismissal</a> <a href="contract_disputes.html">Contract Disputes</a> <a href="property_issue_discrepancies.html">Property/Issue Discrepancies</a> <a href="tax_matters.html">Tax Matters</a> </div> </li> <li><a href="wills.html" class="style18" onmouseover="mopen('m5')" onmouseout="mclosetime()">WILLS & ESTATES</a> <div id="m5" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="wills.html">Wills</a> <a href="power_of_sale.html">Power of Sale</a> <a href="power_of_attorney.html">Power of Attorney</a> </div> </li> <li><a href="administrative_law.html" class="style18" onmouseover="mopen('m6')" onmouseout="mclosetime()">ADMINISTRATIVE LAW</a> <div id="m6" onmouseover="mcancelclosetime()" onmouseout="mclosetime()"> <a href="board_tribunals.html">Board Tribunals</a> <a href="omb.html">OMB</a> <a href="rental_housing.html">Rental Housing</a> <a href="licensing_tribunals.html">Licensing Tribunals</a> <a href="ministry_challenges.html">Ministry Challenges</a> <a href="consent_compassion_board.html">Consent and Compassion Board</a> <a href="wsib.html">WSIB</a> <a href="fisco.html">FISCO</a> <a href="human_rights_commission.html">Human Rights Commission</a> <a href="conversation_review_board.html">Conservation Review Board</a> </div> </li> <li><a href="resources.html" class="style18">RESOURCES</a></li> <li><a href="contact_us.html" class="style18">CONTACT US</a></li> </ul> Hi Could you help me please. I am trying to make this drop down menu work in Internet Explorer 7 by inserting the Javascript. I'm obviously doing something wrong. Please be gentle with me I'm a bit of a newcomer to this: HTML and Javascript included below. <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script type="text/javascript"> sfHover = function() { var sfEls = document.getElementById("nav").getElementsByTagName("LI"); for (var i=0; i<sfEls.length; i++) { sfEls[i].onmouseover=function() { this.className+=" sfhover"; } sfEls[i].onmouseout=function() { this.className=this.className.replace(new RegExp(" sfhover\\b"), ""); } } } if (window.attachEvent) window.attachEvent("onload", sfHover); </script> <link href="dropdownmenu.css" rel="stylesheet" type="text/css" /> </head> <body> <ul class="nav"> <li><a href="/home/">Home </a></li> <li><a href="/products/">Products </a> <ul> <li><a href="/products/silverback/">Silverback </a></li> <li><a href="/products/fontdeck/">Font Deck </a></li> </ul> </li> <li><a href="/services/">Services </a> <ul> <li><a href="/services/design/">Design </a></li> <li><a href="/services/development/">Development </a></li> <li><a href="/services/ consultancy/">Consultancy </a></li> </ul> </li> <li><a href="/contact/">Contact Us </a></li> </ul> </body> </html> |