JavaScript - Prevent Esc Behaviour
Hello.
I'm using the keyup event for an input box to check for the Escape key (keyCode 27). I'm then using this to hide a related select element. It works okay apart from IE(8) of course . How can I prevent IE carrying on with its normal Escape behaviour? If tried a number of things, most recently: Code: e.cancelBubble = true; if ( e.stopPropagation ) e.stopPropagation(); return false; but it, IE, is insistant. I tried switching to 'keydown' but it went a bit wonky.. Andy. Similar TutorialsHey all, I have a rather complicated program so I'm going to try and make it a little simpler - the problem is with the following function: Code: this.onInsertSuccess = function (paramsArray) { var result = Array(); result[0] = {}; result[0][this.params.idfield] = paramsArray.id; result[0][this.params.titlefield] = "NEW ITEM"; result[0][this.params.displayfield] = 1; console.log(this.displayArray.length); for (x = 0; x < this.displayArray.length; x++) { this.displayArray[x][this.params.displayfield] = x + 2; result[result.length] = this.displayArray[x]; newParams = {idfield:this.params.idfield, id:this.displayArray[x][this.params.idfield], table:this.params.table, displayfield:this.params.displayfield, order:(x+2)}; this.load.updateItem(newParams); } this.displayArray = Array(); for (x = 0; x < result.length; x++) { this.displayArray[x] = result[x]; } this.display(); } Here's a simplified version: Code: onInsertSuccess = function (id) { var result = Array(); result[0] = {}; result[0][this.params.idfield] = id; result[0][this.params.titlefield] = "NEW ITEM"; result[0][this.params.displayfield] = 1; for (x = 0; x < this.displayArray.length; x++) { this.displayArray[x].displayorder = x + 2; result[result.length] = this.displayArray[x]; } this.displayArray = result; // this just updates the display and has no effect on displayArray this.display(); } What's happening is that the first time this is called, displayArray appears to update correctly and a "NEW ITEM" appears at the top of my list. The next time the function is called, displayArray consists of only two results - each "NEW ITEM" - this continues to be the case when the function is called again. the initial displayArray is this: Code: this.displayArray = [{'clid': "1", 'name': "Yorkshire Digital Awards", 'displayorder': "1"}, {'clid': "2", 'name': "Screen Yorkshire", 'displayorder': "2"}, {'clid': "3", 'name': "SureStart Selby District", 'displayorder': "3"}, {'clid': "4", 'name': "Mencap", 'displayorder': "4"}, {'clid': "5", 'name': "York St. Johns", 'displayorder': "5"}, {'clid': "6", 'name': "Mobstar Media", 'displayorder': "6"}, {'clid': "7", 'name': "Wheatfields Hospice", 'displayorder': "7"}, {'clid': "8", 'name': "The National Railway Museum", 'displayorder': "8"}]; I've left the original function in because I fully appreciate that it may be another function that's causing this problem! I thought also it could be to do with accidentally assigning references rather than values (hence the adaption of the result assignment at the end of the function in the full code). Any ideas? Many thanks Edd I have 9 boxes which I can drag around an invisible grid however when the onMouseDown function is called for the first time on each of the boxes, they behave erratically, then once all boxes have been clicked once, the entire script works as it should. I've tried using default values when declaring the variables however it doesn't seem to do anything. Does this happen with anyone else, anything obvious I'm missing. Code: <html> <head> <script language="javascript"> var x; var y; var org_top; var org_left; var diff_org_top; var diff_org_left; var element; var element2; var being_dragged = false; var newleft; var newtop; function mouse_move(event) { if(event.offsetX || event.offsetY) { x=event.offsetX; y=event.offsetY; } else { x=event.pageX; y=event.pageY; } if(being_dragged = true) { document.getElementById(element).style.top = y-diff_org_top +'px'; document.getElementById(element).style.left = x-diff_org_left +'px'; } } function mouse_down(ele_name) { being_dragged = true; element = document.elementFromPoint(x, y).id; org_top = document.getElementById(element).style.top; org_left = document.getElementById(element).style.left; diff_org_top = y-org_top.substring(org_top.length-2,org_top); diff_org_left = x-org_left.substring(org_left.length-2,org_left); } function mouse_up() { being_dragged = false; newtop = Math.floor((y-diff_org_top+100)/200) * 200; newleft = Math.floor((x-diff_org_left+100)/200) * 200; if (newtop<0) { newtop = 0; } else if (newtop>400) { newtop = 400; } if (newleft<0) { newleft = 0; } else if (newleft>400) { newleft = 400; } document.getElementById(element).style.display = 'none'; if (document.elementFromPoint(newleft+100, newtop+100).id != '') { element2 = document.elementFromPoint(newleft+100, newtop+100).id; document.getElementById(element2).style.top = org_top; document.getElementById(element2).style.left = org_left; element2 = null } document.getElementById(element).style.display = 'block'; document.getElementById(element).style.top = newtop +'px'; document.getElementById(element).style.left = newleft +'px'; element = null; } </script> <style type="text/css"> .box { float:left; display:block; width:190; height:190; margin:5; position:absolute; } .red { background:red; top:0; left:0; } .blue { background:blue; top:0; left:201; } .yellow { background:yellow; top:0; left:401; } .green { background:green; top:201; left:0; } .violet { background:violet; top:201; left:201; } .orange { background:orange; top:201; left:401; } .maroon { background:maroon; top:401; left:0; } .lime { background:lime; top:401; left:201; } .indigo { background:indigo; top:401; left:401; } </style> </head> <body onMouseMove="mouse_move(event)"> <div id="one" class="red box" onMouseDown="mouse_down('one')" onMouseUp="mouse_up()"> </div> <div id="two" class="blue box" onMouseDown="mouse_down('two')" onMouseUp="mouse_up()"> </div> <div id="three" class="yellow box" onMouseDown="mouse_down('three')" onMouseUp="mouse_up()"> </div> <div id="four" class="green box" onMouseDown="mouse_down('four')" onMouseUp="mouse_up()"> </div> <div id="five" class="orange box" onMouseDown="mouse_down('five')" onMouseUp="mouse_up()"> </div> <div id="six" class="violet box" onMouseDown="mouse_down('six')" onMouseUp="mouse_up()"> </div> <div id="seven" class="maroon box" onMouseDown="mouse_down('seven')" onMouseUp="mouse_up()"> </div> <div id="eight" class="lime box" onMouseDown="mouse_down('eight')" onMouseUp="mouse_up()"> </div> <div id="nine" class="indigo box" onMouseDown="mouse_down('nine')" onMouseUp="mouse_up()"> </div> </body> </html> Hi all, A piece of code I have been working on has a small issue with bluring off a div and I can't working out why. Basically what I do is append divs to the DOM and on double click I make them editable and when I blur they are none editable and I append a new div into the document. I have quickly knock up a small piece of code to illustrate the problem ... Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <style text="text/css"> .dropArea { color:#757575; font-weight:bold; display:block; margin:0px; border: 1px dashed #999999; background-color:#DDDDDD; left:10px; right:10px; /*width:auto;*/ text-align:center; line-height:20px; } .textEditArea { display:block; margin-bottom:10px; border: 1px dashed #999999; background-color:inherit; left:10px; right:10px; padding:5px; width:auto; } </style> <script> function makeEditable(activeZone) { if (activeZone.className == "dropArea") { activeZone.innerHTML = ""; } activeZone.contentEditable = true; activeZone.className = "textEditArea"; } function doneEditing(activeZone) { // if no HTML added, make it a drop zone if (trim(activeZone.innerHTML) == "") { activeZone.className = "dropArea"; activeZone.innerHTML = "Drop items from or double click to add text"; } else if (activeZone.addDropZoneAlready == undefined) { // add a new drop zone underneath activeZone.title = "Double click to edit text"; activeZone.addDropZoneAlready = "true"; activeZone.zoneType = "textDisplay"; addNewDropZone(); } activeZone.contentEditable = false; } function addNewDropZone() { var dropArea = document.createElement("div"); dropArea.className = "dropArea"; var appendTo = document.body; appendTo.appendChild(dropArea); dropArea.ondblclick = function () { makeEditable(dropArea); }; dropArea.onblur = function () { alert('done'); doneEditing(dropArea); }; dropArea.innerHTML = "Drop items or double click to add text"; } </script> </head> <body onload="addNewDropZone();"> <div onDblClick="this.contentEditable=true;" onBlur="this.contentEditable=false;alert('Done!');" style="background-color:#C0C0C0; width: 500px; height:200px;"></div> </body> </html> The div in the body already works as expected, it alerts "Done!" however divs I append into the document have to blur twice before the onblur fires? I just don't undestand why its doing it. Anybody have any ideas as to what is happening? Thanks, Dale Hi I'm looking for solutions to play a movie file (it can be any format) on a keyboard press. I have this 'textsizer' code so far which I have adapted to work with swapimage but wondered if it would be possible to adapt this to play a movie too. function textsizer(e){ var evtobj=window.event? event : e //distinguish between IE's explicit event object (window.event) and Firefox's implicit. var unicode=evtobj.charCode? evtobj.charCode : evtobj.keyCode var actualkey=String.fromCharCode(unicode) if (actualkey=="a") MM_swapImage('Image1','','marta3.jpg',1) if (actualkey=="z") MM_swapImgRestore('Image1','','marta.jpg',1) } document.onkeypress=textsizer Hope someone can help Thanks Hi, I am trying to make an xml file download from my website, so the saveAs window will be open, I checked the forum and found the following code. but instead of saving the xml file it saves the html file. any clue??? are there other ways to do it ? Code: <html> <script type="text/javascript"> function forceSaveAs (filename){ document.execCommand('SaveAs',null,filename) } </script> <a href='/DVEConfiguration.xml' onclick=\"forceSaveAs('DVEConfiguration.xml_export'); return false\">Download</a> </html> I also try to send the xml with the following header but with no success Code: print "Content-type: application/octet-stream\n\n"; print "Content-Disposition: attachment; filename=file.xml;" Im using an anchor tag with a class specified. When i click the anchor tag which i have displayed using C# it opens as a popup with background disabled. But when i clikc the anchor tag which i displayed using javascript it redirects to the url mentioned and does not open as a popup. C# Code ----------------- Code: builder.Append("<a href='EditLevelValues.aspx?levelId=" + levelId + "&levelValueId=" + levelValueId + "&levelName=" + levelName + "&levelValueName=" + levelValueName + "&levelValueDescription="+levelValueDescription+"&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=300&width=500&modal=true&' class='thickbox obox'>"); trLevels.InnerHtml = builder.ToString(); JAVASCRIPT CODE ------------------------- Code: strLevelValues += "<a href='EditLevelValues.aspx?levelValueName=" + lvlValueName + "&levelId="+lvlId+"&levelValueId=" + lvlValueId + "&levelValueDescription="+lvlValueDescription+"&levelName=Projects&placeValuesBeforeTB_=savedValues&TB_iframe=true&height=300&width=500&modal=true&' class='thickbox obox'>"; trProjLevel[0].innerHTML = strLevelValues; Dear all I have been working with with window.promt() and i noticed a weird behaviour. In some cases (i do not known why) my prompt cannot get over a certain limit of characters. But in some other cases it can get as many characters as i want. Anyone know about this? Thanks Alex Hi. I have a JavaScript that resizes an image held within an Iframe. It works perfectly, BUT only works if there is an alert box in the code. /*Image resizing scripts - Dependant on page size!*/ /////////////////////////////////// function Im_Resize() { var imheight = 550; /*Change the IFrame CSS*/ iframeheight = imheight + 15; /* +15px for the x-axis scroll bar*/ var IFrame = document.getElementById('MainFrame'); IFrame.style.height = iframeheight + 'px'; alert('after iframe size - before im change'); /*Change the Image CSS*/ var innerdoc = IFrame.contentDocument || IFrame.contentWindow.document; Image1 = innerdoc.getElementById('MainImg1'); Image1.style.height = imheight + 'px'; } If I take the alert box out the code just doesn't work?? I thought that it was that during the loading of the page an element hadn't been loaded yet, but a delay doesn't work either. If I press 'ok' on the alert box too quick it doesn't work either. In terms of HTML this script is run whenever the page is loaded and is also fired when a click event is detected on one of the divs on the page. Any help would be great Ed for some reason on my site 2 javascipts are acting strange there is obviously a conflict in them but I have no idea when it comes to javascript. My site can be viewed at www.actioncomputing.co.uk The images on the right hand side use a script which makes them open a window with the enlarged image in, the revolving image below just cycles through other jobs i have done. now problem is when the side images are clicked everything else on page should go dark including the revolving image but it doesnt it stays light and even goes over the top of my close button ( please try clicking on the sds asbuilt image you will see what i mean. my html code is below but i dont think there is a issue here Im thinking there must be a variable thats conflicting between the 2?!?!? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Web Design Bournemouth, Graphic Design Hampshire, Logo Design Dorset, Southampton</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="description" content="Website Design and Graphic Design by Action computing, A leading Website Design Company. Website Design, Ecommerce Web Design & Web Development. Logo Design, Label Design ."/> <meta name="keywords" content="web design bournemouth, website design, web designers, website optimization, advert design,logo design, pc repair, label design, design, web design company, ecommerce, ecommerce web design, hampshire, dorset, bournemouth, southampton"/> <meta name="author" content="Website and Graphic Design Company, Action Computing"/> <meta name="language" content="EN"/> <meta name="Classification" content="Website Design and Graphic Design Company"/> <meta name="copyright" content="www.ActionComputing.co.uk"/> <meta name="robots" content="index, follow"/> <meta name="revisit-after" content="7 days"/> <meta name="document-classification" content="Website Design and Graphic Development"/> <meta name="document-type" content="Public"/> <meta name="document-rating" content="Safe for Kids"/> <meta name="document-distribution" content="Global"/> <link href="new-css-rebuild.css" rel="stylesheet" type="text/css" /> <link href="css/lightbox.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="jquery.min.js"></script> <script type="text/javascript" src="fadeslideshow.js"> </script> <script type="text/javascript"> var mygallery=new fadeSlideShow({ wrapperid: "fadeshow1", dimensions: [220, 200], imagearray: [ ["images/demos/sdsasbuilt.jpg", "http://www.asbuiltsdsgroup.co.uk/", "_new", "Asbuilt SDS group front portal"], ["images/demos/sdsgroup.jpg", "http://www.sds-group.co.uk/", "_new", "SDS Asbuilt group front portal"], ["images/demos/gillyprint.jpg", "http://www.gillyprinters.com", "_new", "Gilly Print, professional labelling Website"], ["images/demos/firetradeasia.jpg", "http://www.hemminginfo.co.uk/index.cfm?fuseaction=home.products&producttypeid=2", "_new", "Hemming Information Group online Fire Trade Europe Directory ."], ["images/demos/timespace.jpg", "http://www.intensive-driving-schools.co.uk/", "_new", "Time and Space driving schools website"], ["images/partytubhire.jpg", "http://www.partytubhire.co.uk", "_new", "Party Tub Hire Website 'Relax in style'"], ["images/demos/arborventure.jpg", "http://www.arborventure.co.uk/", "_new", "Arbor Venture Website"] ], displaymode: {type:'auto', pause:2500, cycles:0, wraparound:false}, persist: false, //remember last viewed slide and recall within same session? fadeduration: 500, //transition duration (milliseconds) descreveal: "ondemand", togglerid: "" }) </script> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script> </head> <body> <div class="Container"> <div class="header"> <div class="Topleftmenu"> <p style="text-align:center; padding-top:7px;"> <a class="menu" href="index.html">Home</a> <span class="vertline">|</span> <a class="menu" href="contact-action-computing-web-design.php">Contact</a> <span class="vertline">|</span> <a class="menu" href="#">About Us</a> <span class="vertline">|</span></p> </div> <div class="topmenuright"></div> <div class="menumiddle"></div> <div class="menubottomimage"></div><div class="menubottomright"> <p style="text-align:center; padding-top:7px;"><a class="menu" href="webdesign-web-designer-hampshire-dorset-bournemouth.htm">Web Design</a> <span class="vertline">|</span><a class="menu" href="pc-maintenance-hampshire-dorset.htm"> PC Maintenance</a> <span class="vertline">|</span> <a class="menu" href="logo-Design-hampshire-dorset-bournemouth.htm">Logo Design</a> <span class="vertline">|</span> <a class="menu" href="label-Design-hampshire-dorset-bournemouth.htm">Label Design</a> <span class="vertline">|</span> <a class="menu" href="graphic-Design-hampshire-dorset-bournemouth.htm">Other Graphic Design</a></p> </div> <div class="Flashtop"> <script type="text/javascript"> AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','622','height','101','src','images/headermov','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','images/headermov' ); //end AC code </script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="622" height="101"> <param name="movie" value="images/headermov.swf" /> <param name="quality" value="high" /> <embed src="images/headermov.swf" quality="high" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="622" height="101"></embed> </object></noscript> </div> </div> <div class="content1container"> <div class="contentleft"> <div class="insideleftborder"><img src="images/sidegradients.jpg" width="9" /></div> <div class="leftcontent-tops"> <h1 class="titles"> Welcome To Action Computing, Bournemouth!</h1> </div> <div class="leftcontent-bottom"> <p><br /> <h2>Welcome to Action Computing . We are a <strong>Web Design</strong> and <strong>Graphic Design</strong> studio based near Bournemouth, Dorset on the south coast of the United Kingdom. that specialize in <strong>Web Design</strong>, <strong>Web Optimisation</strong> and all elements of <strong>Graphic Design</strong> including <strong>Stationary Design</strong>, <strong>Logo Design</strong>,<strong> Label Design</strong>, <strong>Advert Design</strong>, <strong>Brochure Design</strong>, <strong>Exhibition Artwork Design</strong> and <strong>Packaging Design</strong>. Action Computing will Design Internationally as well as locally.<br /></h2> <br /> </p> <p>Action Computing focuses on three main goals, </p> <p> </p> <p ><img src="images/QuestionMark.png" width="53" height="51" style="float:right; padding-right:20px; padding-left:20px" /></p> <p><strong>One</strong>, making things as simple for the customer as possible using language and explanations that anyone can understand rather than using <strong>Web Design</strong> /<strong> Graphic Design 'jargon'</strong>, this way rather than being confused about the subject matter the client can feel completely Comfortable with exactly what is going on</p> <p> </p> <p><img src="images/handshake.jpg" style="float:right; padding-right:10px; padding-left:20px; padding-top:10px;"/><strong>Two</strong>, Building a friendly long term relationship with our customers. Successful web site's are not built overnight, they evolve over a period of months and years and with Action Computing by your side you can guarantee a constant aid to all your <strong>Web Design</strong> and <strong>Graphic Design</strong> needs.</p> <p> </p> <p><img src="images/pile_english_money.JPG" width="72" height="59" style="float:right; padding-right:10px; padding-left:20px;" /><strong>Three</strong>, Making you money while keeping your Web or <strong>Graphic Design</strong> costs as low as possible. Its all well and good having a pretty web site but if it does not generate money or business then it is simply a waste of time and money, at Action Computing we strive to make sure your web site will succeed.</p> <p> </p> <p align="justify" class="style10">With over 10 Years of <strong>Web Design</strong> experience we hope to make your journey to the web as smooth as possible and guarantee to cater to your needs as best possible as we can.</p> <p align="justify" class="style10">For Everything that is needed to take your first steps into you <strong>Web Design</strong> or <strong>Graphic future</strong> please<a href="contact.php"> click here</a> or above on the appropriate Design needed.</p> <br /> <p align="right" style="border-top:1px dashed #000000; border-bottom:1px dashed #000000; "> Regards<br /> Action Computing </p> </div> <div class="leftcontent-tops"> <h1 class="titles">Our Promise</h1> </div> <div class="leftcontent-bottom"><br /> At Action computing are promise to to make you happy, Whether it be <strong>Graphic Design</strong> including <strong>Logo Design</strong>, <strong>Label Design</strong> and <strong>Advert Design</strong> or <strong>Web Design</strong> we will not simply make one <strong>web site</strong> or graphic that you "must" take off us! we will not give up on your <strong>Web site</strong> or Graphics until you are "100%" happy with the outcome, We do usually manage to interpret our customers design dreams to a almost identical result first time, but we will always make your design dreams become a reality! <p></p> <br /> <br /> <p align="right" style="border-top:1px dashed #000000; border-bottom:1px dashed #000000; ">Regards<br /> Action Computing </p> <div align="center"> <p>All of our web sites are tested on the most common browsers.</p> <p> </p> <p><img src="images/ie.jpg" style=" padding-left:70px; float:left" /><img src="images/firefox.jpg" style=" padding-left:20px; float:left" /><img src="images/aol.jpg" style=" padding-left:20px; float:left"/><img src="images/SAFARI.jpg" style=" padding-left:20px; float:left"/> </p> <p style="clear:both; padding-left:67px; float:left;">Internet Explorer Fire Fox AOL Safari<br /> <br /><strong>Web Design Bournemouth, Graphic Design Hampshire, Logo Design Dorset, Southampton </strong></p> </div> </div> </div> <div class="contentright"> <div class="insiderightborder"></div> <div class="rightcontent-tops"> <h1 class="titles">Recent Examples</h1> </div> <div class="rightcontent-bottom"> <div align="center"><br /> <a href="images/demos/full size/levelchecker.jpg" title="Level-Checker Web site visit at www.level-checker.co.uk" rel="lightbox"> <img src="images/demos/level-checker.jpg" width="212" height="221" /></a><br /> <a href="images/demos/full size/levelchecker.jpg" title="Level-Checker Web site visit at www.level-checker.co.uk" rel="lightbox">Level-Checker</a><br /> Web site </p> <hr /> <a href="images/demos/full size/asbuilt.jpg" title="Asbuilt SDS Group Web Portal visit at www.asbuiltsdsgroup.co.uk" rel="lightbox"><img src="images/demos/sdsasbuilt.jpg" width="212" height="191" /></a><br /> <a href="images/demos/full size/asbuilt.jpg" title="Asbuilt SDS Group Web Portal visit at www.asbuiltsdsgroup.co.uk" rel="lightbox">Asbuilt SDS Group</a><br /> Web site / Portal <hr /> <div id="fadeshow1"></div> **** ****** </div> </div> <div class="rightcontent-tops"><h1 class="titles">Testimonials</h1></div> <div class="rightcontent-bottom"></div> </div> <div class="bottommenu"> <p><a class="menubottom" href="contact-action-computing-web-design.php">Contact</a> <span class="vertline">| </span><a class="menubottom" href="webdesign-web-designer-hampshire-dorset-bournemouth.htm">Web Design</a> <span class="vertline">|</span><a class="menubottom" href="pc-maintenance-hampshire-dorset.htm"> PC Maintenance</a> <span class="vertline">|</span> <a class="menubottom" href="logo-Design-hampshire-dorset-bournemouth.htm">Logo Design</a> <span class="vertline">|</span> <a class="menubottom" href="label-Design-hampshire-dorset-bournemouth.htm">Label Design</a> <span class="vertline">|</span> <a class="menubottom" href="graphic-Design-hampshire-dorset-bournemouth.htm">Other Graphic Design</a> </p> <p>Action Computing email:<a href="mailto:enquiries@actioncomputing.co.uk">enquiries@actioncomputing.co.uk</a> phone: 07927255606</p> </div> </div> </div> </body> </html> Major thanks to anyone who can help Hello, Is there anyway to prevent images, words, divisions, etc from being selected? Also if something is selected is there a way to deselect? Thanks! Hey! I searched a while on the web for this but i didn't find a solution that really worked. So is there a way how i can prevent IE9 from scrolling when i use the arrow keys? I retrieve a list of links from a database using ajax, then I assign them to the innerHTML property of a div whose display property is set to "none" Then I set the display property to "display" to get a drop-down listbox. The problem is the links in the list are all hilighted like they've been dragged over by a mouse. How do I prevent these links from highlighting? How do I prevent my Link from disappearing?? When I click on the link, "Click Here" It display, "Look At Me!!" but the link, "Click Here" is GONE Is there a way to keep my link, "Click Here" from disappearing? So when I click on the link, "Click Here" the content, "Look At Me!!"should display as well. thanks Here are my codes Code: <html> <head> <script type="text/javascript"> function display() { document.writeln("Look At Me!!"); } </script> </head> <body> <a href="google.com" onClick="display()">Click Here</a> </body> </html> Code: 1 ,<input id="14sq-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 2 ,<input id="510sq-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 3 ,<input id="1119sq-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 4, <input id="20jsq-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 5 ,<input id="oneyear-und-0-value" maxlength="10" class="form-text" type="text"> 6 ,<input id="twoyear-und-0-value" maxlength="10" class="form-text" type="text"> 7 ,<input id="threeyear-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 8 <input id="vpssq-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 9 <input id="500zh-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 10 <input id="1000zh-und-0-value" size="12" maxlength="10" class="form-text" type="text"> 11 <input id="1500zh-und-0-value" size="12" maxlength="10" class="form-text" type="text"> now, i want to do, if the editor type content to 1, 2, 3 4 input box and finished namely the 1 ,2,3 4have value , then he can't type anything to the rest. if the 5,6,7, input box has value. then can't type anything to the rest. if the 8, input box has value. then can't type anything to the rest. if the9,10,11, input box has value. then can't type anything to the rest. I have a tracking ad at the bottom of my site. (no iframes). how do I know and/or prevent that tracking ad from popping up a popup? They are not suppose to, but I suspect they do. Is there a way to track this, or perhaps prevent them from popping the popup from within my page? I have access to various libraries, prototype/jquery etc.. so if there is a func/method in those, I could use too. I've run into a glitch in my little calculator form. Apparently, in Safari, when you hit the enter key while the cursor is in an input field, it will attempt to submit the form. I don't want this to happen. Submitting serves no purpose in this, because all of the functionality is in the script on the page. I copied most of the HTML from an example, and noted that the form tag didn't contain an action= parameter. I tried adding this with the hopes that it would override Safari's default submit action. They do affect its behavior, but not in a way that does any good. First, I tried: action="" which didn't work Then, I tried: action="CalcRange()" This is a harmless function that normally runs on field change. It didn't work either. In every case Safari is determined to fire off a URL. No problems with MSIE or Firefox. Is there another way of using the action parameter to fix the problem, or do I have to attack this another way. Thanks. Code: <html><head><title></title> <script language="JavaScript"> var d = null; function PadCalc(ctrm,cvlo,cvhi,cstray,rc) { chp = cvhi+ctrm; clp = cvlo+ctrm; beta=(rc-1)*cstray; a=rc* clp- chp +beta; b= (rc-1)*clp*chp+beta*(clp + chp); c=beta*clp* chp; cser=(-b-Math.sqrt(b*b-4*a*c))/(a+a); return(cser); } function TrmCalc(cser,cvlo,cvhi,cstray,rc) { if (cser<0.00001) { ctrm=(cvhi+cstray-rc*(cvlo+cstray))/(rc-1); } else { cser2=cser*cser; k0=(1-rc)*cstray; k1=k0*cser2; k2=k0*cser+cser2; k3=k0*cser-rc*cser2; k4=k0+(1-rc)*cser; a=k4; b=k2+k3+k4*(cvlo+cvhi); c=k1+k2*cvhi+k3*cvlo+k4*cvlo*cvhi; ctrm=(-b-Math.sqrt(b*b-4*a*c))/(a+a); } return(ctrm); } function setCellTxt(id,tx,clr){ cell=document.getElementById(id); cell.innerHTML=tx; cell.style.color=clr; } function CalcAll() { setCellTxt("ex_cpar","***","#FF0000"); setCellTxt("ex_cser","***","#FF0000"); setCellTxt("ex_L","***","#FF0000"); flo = parseFloat(d.ef_flo.value); fhi = parseFloat(d.ef_fhi.value); cvlo = parseFloat(d.ef_cvlo.value); cvhi = parseFloat(d.ef_cvhi.value); cstray = parseFloat("0".concat(d.ef_cstray.value)); KVal = parseFloat(d.ef_KVal.value); spi = 500000.0/Math.PI; rf=fhi/flo; rc=rf*rf; switch(d.mknown.selectedIndex){ case 0: // For Given inductor L = KVal; w=(spi/flo) chppp = w*w/L; w=(spi/fhi) clppp = w*w/L; alpha = cstray-chppp; beta = cstray-clppp; k1 = cvhi-chppp-cvlo+clppp; k2 = alpha - beta; k3 = alpha*cvhi - beta*cvlo; k4 = alpha*cvhi; k5 = cvhi + alpha; a = -k2/k1; b = alpha-(k3+k2*k5)/k1; c = k4-(k3*k5)/k1; ctrm = (-b+Math.sqrt(b*b-4*a*c))/(a+a); cser = -(k2*ctrm+k3)/k1; if (cser>100*cvhi) cser=0; // End of given L calc break; case 1: // For Given Padder cser=KVal; if (cser<.00001) { cpinv=0; } else { cpinv=1/cser; } ctrm=TrmCalc(cser,cvlo,cvhi,cstray,rc); chp=cvhi+ctrm; chppp=1/(1/chp+cpinv)+cstray; w=spi/flo; L=w*w/chppp; break; case 2: // For Given Trimmer ctrm=KVal; cser=PadCalc(ctrm,cvlo,cvhi,cstray,rc); chppp=chp*cser/(chp+cser)+cstray; if (cser>100*cvhi) cser=0; w=spi/flo; L=w*w/chppp break; } badVal=false; if (isNaN(ctrm) || ctrm<0) badVal=True; if (isNaN(cser) || cser <0) badVal=True; if (isNaN(L) || L<0) badVal=True; if (!badVal) { setCellTxt("ex_cpar",ctrm.toFixed(2),"#000080"); setCellTxt("ex_cser",cser.toFixed(2),"#000080"); setCellTxt("ex_L",L.toFixed(2),"#000080"); } } function CalcRange() { flo = parseFloat(d.ef_flo.value); fhi = parseFloat(d.ef_fhi.value); cvlo = parseFloat(d.ef_cvlo.value); cvhi = parseFloat(d.ef_cvhi.value); cstray = parseFloat("0".concat(d.ef_cstray.value)); if (flo>0 && fhi>0 && cvlo>0 && cvhi>0) { spi = 500000.0/Math.PI; rf=fhi/flo; rc=rf*rf; csmin=PadCalc(0,cvlo,cvhi,cstray,rc); ctmax=TrmCalc(0,cvlo,cvhi,cstray,rc); w=spi/flo chppp=cvhi*csmin/(cvhi+csmin)+cstray; Lmax=w*w/chppp; chppp=cvhi+ctrm+cstray; Lmin=w*w/chppp; //Reset exact calc outputs after input parameter change /* setCellTxt("ex_cpar","","#000080"); setCellTxt("ex_cser","","#000080"); setCellTxt("ex_L","","#000080"); */ if (Lmin<0 || Lmax<0 || ctmax<0 || csmin<0) { setCellTxt("rTrm","***","#FF0000"); setCellTxt("rPad","***","#FF0000"); setCellTxt("rInd","***","#FF0000"); } else { setCellTxt("rTrm","0 ... ".concat(ctmax.toFixed(2)),"#000080"); setCellTxt("rPad",">= ".concat(csmin.toFixed(2)," (if present)"),"#000080"); setCellTxt("rInd","".concat(Lmin.toFixed(2)," ... ",Lmax.toFixed(2)),"#000080"); } } } function kvChange() { descriptions = Array ("Enter Inductance Value (µH):","Enter Series Capacitance Value (pF):","Enter Parallel Capacitance Value: (pF)"); setCellTxt("KVdescription",descriptions[d.mknown.selectedIndex],"#000080"); setCellTxt("ex_cpar","","#000080"); setCellTxt("ex_cser","","#000080"); setCellTxt("ex_L","","#000080"); } </script> </head> <body onload="d = document.forms[0];"> <center> <h2>Bandspread Calculator</h2> </center> <form > <table style="width: 692px; height: 400px;" align="center" border="0"> <tbody> <tr> <td align="center" colspan=2"><B>Input Parameters:</B></td> </tr> <tr> <td align="right">Lowest Frequency (kHz):</td> <td><input name="ef_flo" onchange="CalcRange()" size="18"> </td> </tr> <tr> <td align="right">Highest Frequency (kHz):</td> <td><input name="ef_fhi" onchange="CalcRange()" size="18"> </td> </tr> <tr> <td align="right">Tuning Capacitor <I>C<sub>V</sub></I> Minimum Capacitance (pF):</td> <td><input name="ef_cvlo" onchange="CalcRange()" size="18"> </td> </tr> <tr> <td align="right">Tuning Capacitor <I>C<sub>V</sub></I> Maximum Capacitance (pF):</td> <td><input name="ef_cvhi" onchange="CalcRange()" size="18"> </td> </tr> <tr> <td align="right">Stray Capacitance <I>C<sub>S</sub></I> (pF):</td> <td><input name="ef_cstray" onchange="CalcRange()" size="18"> </td> </tr> <tr> <td align="center" colspan=2"><HR></td> </tr> <tr> <td align="center" colspan=2"><B>Allowable Component Ranges:</B></td> </tr> <tr> <td align="right">Trimmer Capacitor <I>C<sub>T</sub></I> (pF): </td> <td align="left" id="rTrm"><font color="#FF0000">***</font></td> </tr> <tr> <td align="right">Padder Capacitor <I>C<sub>P</sub></I> (pF): </td> <td align="left" id="rPad" ><font color="#FF0000">***</font></td> </tr> <tr> <td align="right">Inductor (µH): </td> <td align="left" id="rInd"><font color="#FF0000">***</font></td> </tr> <tr> <td align="center" colspan=2"><HR></td> </tr> <tr> <td align="center" colspan=2"><B>Exact Value Calculation:</B></td> </tr> <tr> <td align="right">Choose the Known Component:</td> <td> <select name="mknown" onchange="kvChange()" size="1"> <option selected="selected">Inductor</option> <option>Padder Capacitor (Series)</option> <option>Trimmer Capacitor (Parallel)</option> </select> </td> </tr> <tr> <td id="KVdescription" align="right">Enter the Known Component Value:</td> <td><input name="ef_KVal" size="18"></td> </tr> <tr> <td align="right">Click to Calculate the Unknown Components:</td> <td><input type="button" value="Calculate" onclick="CalcAll()"> </td> </tr> <tr> <td align="right">Trimmer Capacitor <I>C<sub>T</sub></I> (pF): </td> <td id="ex_cpar" > </td> </tr> <tr> <td align="right">Padder Capacitor <I>C<sub>P</sub></I> (pF): </td> <td id="ex_cser"> </td> </tr> <tr> <td align="right">Inductor (µH): </td> <td id="ex_L"> </td> </tr> </tbody> </table> </form> </body></html> Edit: I should also add that my web page is made using Apple's iWeb software, and it stores the above code in a separate file, and then uses the following iframe code to load it: Code: <iframe id="widget1-frame" src=".//BandspreadCalc_files/widget1_markup.html" frameborder="0" style="width: 100%; height: 100%;" scrolling="no" marginheight="0" marginwidth="0" allowTransparency="true"></iframe> So, when Safari submits the form, the result is that it loads a page containing only the widget1_markup.html code, and not the parent page. Either way, it's annoying, because any data that the user has entered in a field will be erased. Hello, Is there any way I can prevent IE from displaying the "active X controls and script prevention message" when I load my web page into the browser. Firefox, Safari and Chrome, allow my scripts to run without displaying the message when the page is loaded into the respective browsers. Any tips would be really useful. Many thanks Nonye Please, I need a code that is capable of preventing SEOQuake from loading on my websites, even if a user has installed the plug-in. For example, Google, Yahoo and Bing implements such feature. I just don't want it to load whenever anybody visits my sites. |