JavaScript - Getting Error "documentelement" Is Either Null Or Does Not Exist
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml"> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <title>Washington DC</title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript" src="scripts/downloadxml.js"></script> <style type="text/css"> html, body { height: 100%; } </style> <script type="text/javascript"> var side_bar_html = ""; var gmarkers = []; var map = null; function createMarker(latlng, name, html) { var contentString = html; var marker = new google.maps.Marker({ position: latlng, map: map, zIndex: Math.round(latlng.lat()*-100000)<<5 }); google.maps.event.addListener(marker, 'click', function() { infowindow.setContent(contentString); infowindow.open(map,marker); }); // save the info we need to use later for the side_bar gmarkers.push(marker); // add a line to the side_bar html side_bar_html += '<a href="javascript:myclick(' + (gmarkers.length-1) + ')">' + name + '<\/a><br>'; } function myclick(i) { google.maps.event.trigger(gmarkers[i], "click"); } function initialize() { var myOptions = { zoom: 14, center: new google.maps.LatLng(38.897725,-77.036511), mapTypeControl: true, mapTypeControlOptions: {style: google.maps.MapTypeControlStyle.DROPDOWN_MENU}, navigationControl: true, mapTypeId: google.maps.MapTypeId.ROADMAP } map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); google.maps.event.addListener(map, 'click', function() { infowindow.close(); }); // Read the data from Washington.xml downloadUrl("Washington.xml", function(doc) { var xmlDoc = xmlParse(doc); var marker = xmlDoc.documentElement.getElementsByTagName("marker"); for (var i = 0; i < markers.length; i++) { // obtain the attribues of each marker var lat = parseFloat(marker[i].getAttribute("lat")); var lng = parseFloat(marker[i].getAttribute("lng")); var point = new google.maps.LatLng(lat,lng); var html = marker[i].getAttribute("html"); var label = marker[i].getAttribute("label"); // create the marker var POI = createMarker(point,label,html); } // put the assembled side_bar_html contents into the side_bar div document.getElementById("side_bar").innerHTML = side_bar_html; }); } var infowindow = new google.maps.InfoWindow( { size: new google.maps.Size(150,50) }); </script> </head> <body style="margin:0px; padding:0px;" onload="initialize()"> <table border="1"> <tr> <td> <div id="map_canvas" style="width: 1000px; height: 600px"></div> </td> <td valign="top" style="width:200px; text-decoration: underline; color: #4444ff;"> <div id="side_bar"></div> </td> </tr> </table> </body> </html> Similar TutorialsI'm getting the following problem. The reason is that the object appears through AJAX. But if I choose it NOT to appear it gives this problem. How can I avoid this? I put an if statement inline Code: if(document.getElementById('vsbtitle_1').value!=null){ thisurlext+='&btitle1='+document.getElementById('vsbtitle_1').value; } But it doesn't help. Quote: Error: document.getElementById("vsbtitle_1") is null Source File: javascript:%20var%20file='forforum.php';%20var%20thisurlext='?type=forforum&btitle0='+document.getEl ementById('vsbtitle_0').value;%20if(document.getElementById('vsbtitle_1').value!=null){thisurlext+=' &btitle1='+document.getElementById('vsbtitle_1').value;%20}%20var%20checkedlength=0;%20thisurlext+=' &checkresult0=';%20for(i=0;i<document.getElementsByName('checkresult_0').length;++i){if(document.get ElementsByName('checkresult_0')[i].checked){thisurlext+=document.getElementsByName('checkresult_0')[i].value;checkedlength++;if(i+1<document.getElementsByName('checkresult_0').length){if(document.getEle mentsByName('checkresult_0')[i+1].checked){thisurlext+='+';}}}};%20thisurlext+='&checkresult1=';%20for(i=0;i<document.getElementsByNa me('checkresult_1').length;++i){if(document.getElementsByName('checkresult_1')[i].checked){thisurlext+=document.getElementsByName('checkresult_1')[i].value;checkedlength++;if(i+1<document.getElementsByName('checkresult_1').length){if(document.getEle mentsByName('checkresult_1')[i+1].checked){thisurlext+='+';}}}};var%20getKeyURL='';%20for(a=0;%20a<document.getElementById('txtid').v alue;%20a++){if(document.getElementById('txtarea_'+[a]).value!=%20''){getKeyURL+='&txtarea'+[a]+'=';}getKeyURL+=document.getElementById('txtarea_'+[a]).value;}var%20thisnewurlext=file+thisurlext+getKeyURL;%20forForum(); Line: 1 Below are the full Javascript and HTML to detect a browser and either display HTML5 or Flash video. However, the script is returning an error, 'document.getElementById(...)' is null or not an object. Any suggestions? Code: var deviceAgent = navigator.userAgent.toLowerCase(); $brwzr = deviceAgent.match(/(chrome|firefox|safari|msie 9.0)/); if ($brwzr) { document.getElementById("video_5").setAttribute("class", "on"); } else { document.getElementById("video_F").setAttribute("class", "on"); } Code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>Video Switch</title> <script language="JavaScript" src="index/js/detect.js"></script> <style> <!-- .off { display: none; } .on { display: inline; } --> </style> </head> <body> <div id="video_5" class="off">HTML5!</div> <div id="video_F" class="off">Flash!</div> </body> </html> Hey all, For the below code, I'm just trying to create a simple toggle menu for a Table of Contents. However, when page loads, I get document.gelementbyid('sidebar') is null even though it's clearly there and if I move script to below markup, it will also give me a hideElements() is not a function error, even though it clearly is. Code: <script type="text/javascript"> (function(){ var headers = document.getElementById("sidebar").childNodes; for(var i=0; i < headers.length; i++){ hideElements(headers[i]); if(headers[i].nodeName == "h1"){ headers[i].childNodes[0].onclick = function(){ hideElements(headers[i]); this.parentNode.nextSibling.style.display = "block"; return false; } } } var hideElements = function(element){ if(element.nodeName == "UL") element.style.display = "none"; } })(); </script> <body> <a name="top"></a> <div id="masthead"> <h1>This is the Help Page</h1> </div> <div id="sidebar"> <h1><a href="chapter1"> Info</a></h1> <ul> <li><a href="#section1">Section 1</a></li> <li><a href="#section2">Section 2</a></li> <li><a href="#section3">Section 3</a></li> </ul> <h1><a href="chapter2"> Info</a></h1> <ul> <li><a href="#section4">Section 4</a></li> <li><a href="#section5">Section 5</a></li> <li><a href="#section6">Section 6</a></li> </ul> </div> <div id="content"> <h1 id="section1">Section 1</h1> <p> </p> <a href="#top">Back to Top</a> <h1 id="section2">Section 2</h1> <p> </p> <a href="#top">Back to Top</a> <h1 id="section3">Section 3</h1> <p> </p> <a href="#top">Back to Top</a> </div> </body> Thanks for any response. Though I took out the source of the iframe, I get an error when I click the test button to get the value of msg_title. I am using IExplorer to debug it, as firefox doesnt show the error. Code: <script type='text/javascript'> function test(){ page = window.location.href document.getElementById('1').value = window.frames[2].document.getElementByName('msg_title').value } function apple(){ document.getElementById('3').innerHTML = '<iframe src="" name="4" id="4"></iframe>' } window.onLoad = test(); </script> <div id='3' name='3'></div> <input type='button' value='apple' name='apple' id='apple' onclick='apple()'> <input type='button' value='test' name='test' id='test' onclick='test()'> <input type='text' value='' name='1' id='1'> <br> <iframe src='' name='2' id='2'> Hiya, I would like to ask your help regarding this damned error message that comes out only in Internet Explorer and makes impossible to submit the form. The javascript code is: Code: function checkForm() { var cname, cspouse, cemail, chphone, ccellular, caddress, ccity, cstate, czip, cpets, cvolunteer, cadditional; with(window.document.volApplForm) { cname = Name; cspouse = Spouse; cemail = Email; chphone = HomePhone; ccellular = Cellular; caddress = Address; ccity = City; cstate = State; czip = Zip; cpets = Pets; cvolunteer = Volunteer; cadditional = Additional; } var ALERT_TITLE = "Oops!"; var ALERT_BUTTON_TEXT = "Close"; if(document.getElementById) { window.alert = function(txt) { createCustomAlert(txt); } } function createCustomAlert(txt) { d = document; if(d.getElementById("modalContainer")) return; mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div")); mObj.id = "modalContainer"; mObj.style.height = document.documentElement.scrollHeight + "px"; alertObj = mObj.appendChild(d.createElement("div")); alertObj.id = "alertBox"; if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px"; alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px"; h1 = alertObj.appendChild(d.createElement("h1")); h1.appendChild(d.createTextNode(ALERT_TITLE)); msg = alertObj.appendChild(d.createElement("p")); msg.innerHTML = txt; btn = alertObj.appendChild(d.createElement("a")); btn.id = "closeBtn"; btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT)); btn.href = "#"; btn.onclick = function() { removeCustomAlert();return false; } } if(trim(cname.value) == '') { alert('Please enter your name'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cname.focus();} return false; } else if(trim(cemail.value) == '') { alert('Please enter your email'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cemail.focus();} return false; } else if(!isEmail(trim(cemail.value))) { alert('Email address is not valid'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cemail.focus();} return false; } else if(trim(chphone.value) == '') { alert('Please enter your valid phone number'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); chphone.focus();} return false; } else if(trim(ccellular.value) == '') { alert('Please enter valid cell phone number'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); ccellular.focus();} return false; } else if(trim(caddress.value) == '') { alert('Please enter your valid address'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); caddress.focus();} return false; } else if(trim(ccity.value) == '') { alert('Please enter your city'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); ccity.focus();} return false; } else if(trim(cstate.value) == '') { alert('Please enter valid state name'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cstate.focus();} return false; } else if(trim(czip.value) == '') { alert('Please enter valid zip code'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); czip.focus();} return false; } else if(trim(cvolunteer.value) == '') { alert('Please fill in all fields'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cvolunteer.focus();} return false; } else if(trim(cadditional.value) == '') { alert('Please fill in all fields'); function removeCustomAlert() {document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer")); cadditional.focus();} return false; } else { cname.value = trim(cname.value); cspouse.value = trim(cspouse.value); cemail.value = trim(cemail.value); chphone.value = trim(chphone.value); ccellular.value = trim(ccellular.value); caddress.value = trim(caddress.value); ccity.value = trim(ccity.value); cstate.value = trim(cstate.value); czip.value = trim(czip.value); cpets.value = trim(cpets.value); cvolunteer.value = trim(cvolunteer.value); cadditional.value = trim(cadditional.value); return true; } } function trim(str) { return str.replace(/^\s+|\s+$/g,''); } function isEmail(str) { var regex = /^[-_.a-z0-9]+@(([-_a-z0-9]+\.)+(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn |bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk| dm|do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs |gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr| kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|museum |mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr |pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su|sv|sy|sz|tc|td|tf |tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi|vn|vu|wf|ws|ye|yt|yu|za| zm|zw)|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3}([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i; return regex.test(str); } And when trying to submit the form, I get the error message: Code: Line: 177 Character: 4 Code: 0 Error Message: 'undefined' is null or not an object URL: https://localhost/ruff/scripts/validationVol.js Do you have an idea what could be the problem? As I checked line 177, it seems to be OK. I checked the web, but didn't find anything related to this message in a situation like this. Thanks in advance for your comments. I am testing the contents of e.min for null, this works in everything except the latest version of Safari and Chrome. In the latest versions if I test for "" it works correctly but this does not work in IE, Firefox or older versions of Safari. e.min has not been set to anything. For now I have fixed the problem by omitting the test but I would like to know if it is possible to implement a real fix.
I am trying to manipulate a an image gallery that functions well. Now, I have the ability to pull information from a user's preference pannel and need to place it in the an href="" // And other information in each of the "src" | "url" | "alt". Any ideas would be truly helpful. This is what I am working with at the moment and it doesn't work (obviously because it is adding code inside a span). Here is what I am starting from: [CODE] var title01Span = document.getElementById('title01Span'), //Finds the id that I want prefs = new gadgets.Prefs(), // Pulls from the user's preferences yourtitle01 = prefs.getString("title01"); // Pulls the correct string from those preferences title01Span.innerHTML = yourtitle01; // replaces the span.id with that text but I need to be able to do this in the src / href / url / etc. [CODE] Thank you so much! I seriously could use as much help as possible! Hi all, I'm having a bit of a problem.. I need to disable the submit button on body onload, and i need to re-enable it when "i agree" is checked. the problem is, it wont do this.. it literally stays disabled, even after check mark.. code: Code: <html> <head><title>Metal Detecting</title></head> <body onload="disable()" oncontextmenu="return false;"> <script> function disable(){ if(document.forms.test.agree.checked == false){ document.forms.test.s1.disabled = true; } } function enable(){ if(document.forms.test.agree.checked == true){ document.forms.test.s1.disabled = false; } } function checkCheckBox(f) { if (f.agree.checked == false) { alert('You MUST agree to the terms by checking the box above.'); return false; }else{ enable() return true; } } var max=255; function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit){ // if too long...trim it! field.value = field.value.substring(0, maxlimit); // otherwise, update 'characters left' counter }else{ countfield.value = maxlimit - field.value.length; } } function submitonce(theform){ //if IE 4+ or NS 6+ if (document.all||document.getElementById){ //screen thru every element in the form, and hunt down "submit" and "reset" for (i=0;i<theform.length;i++){ var tempobj=theform.elements[i] if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") //disable em tempobj.disabled=true } } } function checkdata(which) { var pass=true; var t1 = document.forms.test; for (i=0;i<which.length;i++) { var tempobj=which.elements[i]; if (tempobj.name.substring(0,8)=="required") { if (((tempobj.type=="text"||tempobj.type=="textarea")&& tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&& tempobj.selectedIndex==0)) { pass=false; break; } } } if (!pass) { shortFieldName=tempobj.name.substring(8,30).toUpperCase(); alert("The "+shortFieldName+" field is a required field."); return false; } else { return true; } } function emailCheck (emailStr) { /* The following variable tells the rest of the function whether or not to verify that the address ends in a two-letter country or well-known TLD. 1 means check it, 0 means don't. */ var checkTLD=1; /* The following is the list of known TLDs that an e-mail address must end with. */ var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/; /* The following pattern is used to check if the entered e-mail address fits the user@domain format. It also is used to separate the username from the domain. */ var emailPat=/^(.+)@(.+)$/; /* The following string represents the pattern for matching all special characters. We don't want to allow special characters in the address. These characters include ( ) < > @ , ; : \ " . [ ] */ var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]"; /* The following string represents the range of characters allowed in a username or domainname. It really states which chars aren't allowed.*/ var validChars="\[^\\s" + specialChars + "\]"; /* The following pattern applies if the "user" is a quoted string (in which case, there are no rules about which characters are allowed and which aren't; anything goes). E.g. "jiminy cricket"@disney.com is a legal e-mail address. */ var quotedUser="(\"[^\"]*\")"; /* The following pattern applies for domains that are IP addresses, rather than symbolic names. E.g. joe@[123.124.233.4] is a legal e-mail address. NOTE: The square brackets are required. */ var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/; /* The following string represents an atom (basically a series of non-special characters.) */ var atom=validChars + '+'; /* The following string represents one word in the typical username. For example, in john.doe@somewhere.com, john and doe are words. Basically, a word is either an atom or quoted string. */ var word="(" + atom + "|" + quotedUser + ")"; // The following pattern describes the structure of the user var userPat=new RegExp("^" + word + "(\\." + word + ")*$"); /* The following pattern describes the structure of a normal symbolic domain, as opposed to ipDomainPat, shown above. */ var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$"); /* Finally, let's start trying to figure out if the supplied address is valid. */ /* Begin with the coarse pattern to simply break up user@domain into different pieces that are easy to analyze. */ var matchArray=emailStr.match(emailPat); if (matchArray==null) { /* Too many/few @'s or something; basically, this address doesn't even fit the general mould of a valid e-mail address. */ alert("Email address seems incorrect (don't forget to add an @ and a . to your email address!)"); return false; } var user=matchArray[1]; var domain=matchArray[2]; // Start by checking that only basic ASCII characters are in the strings (0-127). for (i=0; i<user.length; i++) { if (user.charCodeAt(i)>127) { alert("Ths username contains invalid characters."); return false; } } for (i=0; i<domain.length; i++) { if (domain.charCodeAt(i)>127) { alert("Ths domain name contains invalid characters."); return false; } } // See if "user" is valid if (user.match(userPat)==null) { // user is not valid alert("The username doesn't seem to be valid."); return false; } /* if the e-mail address is at an IP address (as opposed to a symbolic host name) make sure the IP address is valid. */ var IPArray=domain.match(ipDomainPat); if (IPArray!=null) { // this is an IP address for (var i=1;i<=4;i++) { if (IPArray[i]>255) { alert("Destination IP address is invalid!"); return false; } } return true; } // Domain is symbolic name. Check if it's valid. var atomPat=new RegExp("^" + atom + "$"); var domArr=domain.split("."); var len=domArr.length; for (i=0;i<len;i++) { if (domArr[i].search(atomPat)==-1) { alert("The domain name does not seem to be valid."); return false; } } /* domain name seems valid, but now make sure that it ends in a known top-level domain (like com, edu, gov) or a two-letter word, representing country (uk, nl), and that there's a hostname preceding the domain or country. */ if (checkTLD && domArr[domArr.length-1].length!=2 && domArr[domArr.length-1].search(knownDomsPat)==-1) { alert("The address must end in a well-known domain or two letter " + "country."); return false; } // Make sure there's a host name preceding the domain. if (len<2) { alert("This address is missing a hostname!"); return false; } // If we've gotten this far, everything's valid! return true; } </script> Please contact us!<br><br> *Please note you can submit the form ONLY once. Any double form submissions will be deleted.<br> <form name="test" id="test" method="POST" onsubmit="return checkdata(this), emailCheck(this.email.value), checkCheckBox(this)" action="send.php"> <div id = "div01" style="width: 100; height: 25;"> Firstname: <input name="requiredfirstname" id="firstname" type="text" /> Lastname: <input name="requiredlastname" id="lastname" type="text" /> Email: <input name="requiredemail" id="email" type="text" /><br /><br /> </div> <H4>Your statement: </H4> <textarea onKeyDown="textCounter(this.form.statement,this.form.counter,max);" onKeyUp="textCounter(this.form.statement,this.form.counter,max);" name="requiredstatement" id="statement" rows="15" cols="40"></textarea><br /> Characters left: <input readonly="readonly" value="255" size=3 maxlength=3 type="text" name="counter" id="counter"><br/><br /> <textarea name="license" cols="40" rows="15" id="license">Blah!</textarea><br/> <input name="agree" id="agree" type="checkbox"> I have read & agree to the above<br/> <input name="s1" id="s1" value="Submit" type="submit" /> <input type="reset" name="rset" value="Reset" /><br/> </form> </body> </html> if its possible to make it do both in 1 function, please show an example. if you have to use 2 functions, then also show me an example. ANY help is GREATLY appreciated! Hello, recently I have been to many government websites where I have noticed that the programmer has used window.open() method in JavaScript to link to different pages instead of using <a> tags! I was just getting curious to know whether it is normal or has it been used due to security concerns(if any, I don't know)? Any comments? Hello, I run a online gaming website, and I'm having problems with certain websites iframing our games. Actually I'm ok with iframing, as long as they include the banner ad located just beneath our games. But often times unscrupulous webmasters will iframe only the game, preventing us from generating any revenue from the banner ad (and costing us additional bandwidth charges). I'm hoping to find a way to detect the dimensions of the iframe, so that I may dynamically resize the game, in order to include the banner ad within the iframe. Does anybody know how to extract the "height" and "width" attribute values from an <iframe> tag sitting on a different site? Regards, Steve Strange problem here... I'm implementing google's JS tracking code verbatim which determines whether or not the current site is using HTTP or HTTPS. It builds a dynamic URL used as the "SRC" parameter in the SCRIPT statement. On browsers I'm testing with(FF, IE, Chrome) there's no problem running the code. However, there are some people in the office who get an FF or IE error (same versions as mine) on the URL as the SRC parameter. The error, in the FF Error Console, is this: Quote: illegal character http://www.google-analytics.com/ga.js ? ? ? ? --> question marks appear in console I can't figure it out since I can't create this error on any of my browsers. Could this be related to something like browser security settings or add-ons? Hi, I'm trying to use a form which is existent on one of my sites and try re-creating a similar form on another site for the exact same purpose. Here is the URL for the form on our website Cast Iron Cookware Depot. I have everything duplicated but running into form validation errors. Right now without event entering any data into the form and also the verification code the form still gets submitted but ofcourse runs into "object expected" error at onsubmit="return validate(this);"> by IE Debugger. Below is the total code and would appreciate if any of you gurus point out where the mistake is and also why the exact same code is working on one site is not working on this site. Thanks much in advance. Please help me! ------------------------------------------------------------------------ Code: <style> .TableBG { background-color: #83a338; color: #ffffff; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; } .no { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px; font-weight: bold; color: #333333; width: 35px; text-align:right; } input, textarea {border: 1px inset #cccccc; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 12px;} .input01 {width: 150px;} .input02 {width: 250px;} .button { background-color: #83a338; color: #000000; border: 1px outset #83a338; font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size: 12px; } </style><br /> <br /> <table width="600" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#FFFFFF" class="TableBG"> <tr> <td bgcolor="#FFFFFF"> <FORM name="form1" method="POST" action="http://s.p8.hostingprod.com/@castironcookwaredepot.com/php/tellafriend.php" onsubmit="return validate(this);"> <FORM name="form1" method="POST" action="http://s.p4.hostingprod.com/@bestsafetyapparel.com/php/tellafriend.php" onsubmit="return validate(this);"> <table width="100%" border="0" cellpadding="5" cellspacing="0"> <tr> <td class="TableBG"> </td> <td class="TableBG"><strong>Your Name: </strong></td> <td class="TableBG"><strong>Your Email: </strong></td> </tr> <tr> <td colspan="3" height="5"></td> </tr> <tr> <td> </td> <td> <input type="text" name="sName" class="input01" style="font-weight: bold;" /> </td> <td> <input type="text" name="sEmail" class="input02" size="40" style="font-weight: bold;" /> </td> </tr> <tr> <td colspan="3" height="5"></td> </tr> <tr> <td width="4%" class="TableBG"> </td> <td width="36%" class="TableBG"> Your Friend's Name :</td> <td width="60%" class="TableBG">Your Friend's Email:</td> </tr> <tr> <td colspan="3" height="5"></td> </tr> <tr> <td class="no"><strong>1.</strong></td> <td> <input type="text" name="name1" class="input01" /> </td> <td> <input type="text" name="email1" class="input02" size="40" /> </td> </tr> <tr> <td class="no"><strong>2.</strong></td> <td> <input type="text" name="name2" class="input01" /> </td> <td> <input type="text" name="email2" class="input02" size="40" /> </td> </tr> <tr> <td class="no"><strong>3.</strong></td> <td> <input type="text" name="name3" class="input01" /> </td> <td> <input type="text" name="email3" class="input02" size="40" /> </td> </tr> <tr> <td class="no"><strong>4.</strong></td> <td> <input type="text" name="name4" class="input01" /> </td> <td> <input type="text" name="email4" class="input02" size="40" /> </td> </tr> <tr> <td class="no"><strong>5.</strong></td> <td> <input type="text" name="name5" class="input01" /> </td> <td> <input type="text" name="email5" class="input02" size="40" /> </td> </tr> <tr> <td class="TableBG"> </td> <td colspan="2" class="TableBG">Your Message </td> </tr> <tr> <td colspan="3" height="5"></td> </tr> <tr> <td colspan="3" align="center"> <textarea name="comments" cols="65" rows="5" id="comments" style="width: 420px;"></textarea> </td> </tr> <tr> <td class="TableBG"> </td> <td colspan="3" class="TableBG">Enter Verification Code</td> </tr> <tr> <td colspan="3" height="5"></td> </tr> <tr> <td colspan="3" align="center" valign="absmiddle"><img src="http://s.p8.hostingprod.com/@castironcookwaredepot.com/php/captcha.php" align="absmiddle"> <input type="text" name="vercode" value="Enter Verification Code" onFocus="if(this.value=='Enter Verification Code') this.value='';" onBlur="if(this.value=='') this.value='Enter Verification Code';" size="25"/></td> </tr> <tr> <td colspan="3" align="center"> <input type="submit" name="Submit" value=" Send Email " class="button" /> </td> </tr> </table> </form> </td> </tr> </table> <script> function validate(frm) { name = frm.sName; email = frm.sEmail; name1=frm.name1; email1=frm.email1; err_flag = 0; if (name.value == "" || !removeSpaces(name.value)) { alert ("Please enter proper Name!"); name.value=""; name.focus(); return false; } else if (email.value == "" || !validate_email(email.value)) { alert ("Please enter proper Email!"); email.value=""; email.focus(); return false; } else if (name1.value == "" || !removeSpaces(name1.value)) { alert ("Please enter proper Friend\'s Name!"); name1.value=""; name1.focus(); return false; } else if (email1.value == "" || !validate_email(email1.value)) { alert ("Please enter proper Friend\'s Email!"); email1.value=""; email1.focus(); return false; } } function validate_email(e) { var str=e; var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i if (!filter.test(str)) return false; else return true; } function removeSpaces(string) { var tstring = ""; string = '' + string; splitstring = string.split(" "); for(i = 0; i < splitstring.length; i++) tstring += splitstring[i]; return tstring; } </script> <br /> <br /> Regards Learner Hi I am trying to load html stream directly into webbrowser in delphi. The html contains java script. It loads xml and xsl files and display the xml content in the web browser. I got an error, says access denied for the command xmlDoc.load(fname); If I save the html into a file, test.html, and double click it, it is fine, no problem. The code is actually copied from w3schools.com. the html code as followed: <html> <head> <script> function loadXMLDoc(fname){var xmlDoc; if (window.ActiveXObject) { xmlDoc=new ActiveXObject("Microsoft.XMLDOM"); } else { alert('Your browser cannot handle this script'); } xmlDoc.async=false; xmlDoc.load(fname); return(xmlDoc); } function displayResult() { xml=loadXMLDoc("catalog.xml"); xsl=loadXMLDoc("catalog.xsl"); if (window.ActiveXObject) { ex=xml.transformNode(xsl); document.getElementById("example").innerHTML=ex; } } </script> </head> <body id="example" onLoad="displayResult()"> </body> </html> The delphi code is procedure TForm1.WBLoadHTML(WebBrowser: TWebBrowser; HTMLCode: string) ; var v: OleVariant; HTMLDocument: IHTMLDocument2; begin memo1.Lines.LoadFromFile('d:\test\htmltxtold.html'); HTMLCode := memo1.Text; WebBrowser1.Navigate('about:blank') ; HTMLDocument := WebBrowser.Document as IHTMLDocument2; v := VarArrayCreate([0, 0], varVariant); v[0] := HTMLCode; HTMLDocument.Write(PSafeArray(TVarData(v).VArray)); HTMLDocument.Close; end; Thanks a lot It works in FF but i can seem to find what the issue is here is the code Code: <script type="text/javascript">//<![CDATA[ window.addEvent('domready',function(){ new viewer($$('#box1 img)'),{ mode: 'alpha', interval: 5000 }).play(true); }); //]]> </script> <script type="text/javascript"> <!-- // When DOM is ready $(document).ready(function(){ // ------- Submit First Form ------- $("#contact").submit(function(){ var str = $(this).serialize(); $.ajax({ type: "POST", url: "contact.php", data: str, success: function(msg){ $("#note").ajaxComplete(function(event, request, settings){ if(msg == 'OK') // Message Sent? Show the 'Thank You' message and hide the form { result = '<div class="notification_ok">Your message has been sent. Thank you!</div>'; $("#fields").hide(); } else { result = msg; } $(this).html(result); }); } }); return false; }); this is line 64 -> </script> The error is Syntax error code0 line:64 char:1 . Please if anyone can help. Hi I have developed an internet mapping site which uses an html viewer with various frames to pull in a mapping window, a legend / key and a frame of tools amongst other things. It works absolutely fine in Internet Explorer version 6, but whilst testing it in Internet Explorer 7, my mapping window is not loading up the image. It might seem strange me posting this in a javascript forum but as the error is javascript related I thought I would give it a shot! The error message I am receiving is "Access is denied". After looking online, it appears as though this error could be linked to the use of frames; and those frames trying to access other windows with different document domains?? Does anyone know if new security measures have been implemented in IE7 which restricts the use of frames? My code is below; does anyone notice anything that might give this kind of javascript error? Any help will be greatly appreciated as I do not tend to dable too much in javascript! Code: <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <TITLE>Intranet GIS Service</TITLE> <HTML> <HEAD> <SCRIPT LANGUAGE="JavaScript" SRC="javascript/aimsResource.js" TYPE="text/javascript"></SCRIPT> <SCRIPT TYPE="text/javascript" LANGUAGE="JavaScript"> // Designer will set the next variable - theTitle //var theTitle = "Intranet GIS"; var theTitle = ""; if (theTitle.indexOf("###TITLE##")!=-1) theTitle = titleList[0]; var cmdString = document.location.search; var webParams = cmdString; var reloadTimer=0; document.writeln("<TITLE>" + theTitle + "</TITLE>"); function doIt() { MapFrame.useJava=false; MapFrame.checkParams(); } function replacePlus(inText) { var re = /\+/g; inText = inText.replace(re," "); return inText; } function reloadApp() { //window.clearTimeout(reloadTimer); //reloadTimer = window.setTimeout("document.location.href = 'viewer.jsp' + cmdString",1000); //Above code replaced with this. Only the map should refresh after a resize, otherwise //all added datashare layers are lost. MapFrame.mWidth = MapFrame.getMapWidth(); MapFrame.mHeight = MapFrame.getMapHeight(); MapFrame.sWidth = screen.width; MapFrame.sHeight = screen.height; MapFrame.loadBannerLeft = parseInt((MapFrame.mWidth - 119)/2); MapFrame.loadBannerTop = parseInt((MapFrame.mHeight - 72)/2); MapFrame.document.getElementById("theMap").style.width = MapFrame.sWidth; MapFrame.document.getElementById("theMap").style.height = MapFrame.sWidth; MapFrame.iWidth = MapFrame.mWidth; MapFrame.iHeight = MapFrame.mHeight; MapFrame.legHeight = MapFrame.iHeight - 160; var cmd = 'MapFrame.sendMapXML();'; cmd += 'MapFrame.document.getElementById("theImage").style.width = MapFrame.mWidth;'; cmd += 'MapFrame.document.getElementById("theImage").style.height = MapFrame.mHeight;'; window.clearTimeout(reloadTimer); reloadTimer = window.setTimeout(cmd,1000); } </SCRIPT> </HEAD> <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript"> var browser = navigator.appName; var moreStuff = 'onresize="reloadApp()"'; var addNS = 0; if (browser=="Netscape") { addNS = 3; } document.writeln('<FRAMESET ROWS="' + (45+addNS) + ',*,30,0" FRAMEBORDER="No" FRAMESPACING="0" onload="doIt()" BORDER=2 ' + moreStuff + '>'); document.writeln('<FRAME NAME="TopFrame" SRC="topbar.htm" MARGINWIDTH="5" MARGINHEIGHT="0" SCROLLING="No" FRAMEBORDER="No" NORESIZE>'); document.writeln('<FRAMESET COLS="' + (30+addNS) + ',*,270" FRAMEBORDER="No" FRAMESPACING="0" BORDER="2">'); </SCRIPT> <FRAME NAME="TextFrame" SRC="text.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="No" FRAMEBORDER="No" NORESIZE FRAMESPACING="0" BORDER="2"> <!-- If textframe is used--> <FRAMESET ROWS="*,115"> <FRAME NAME="MapFrame" SRC="MapFrame.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="No" FRAMEBORDER="Yes" RESIZE="YES"> <FRAME NAME="ToolFrame" SRC="blank.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="Auto" FRAMEBORDER="No" RESIZE="YES"> </FRAMESET> <!-- If textframe is not used --> <!--<FRAME NAME="MapFrame" SRC="MapFrame.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="No" FRAMEBORDER="No" RESIZE="YES">--> <FRAME NAME="TOCFrame" SRC="TOCFrame.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="Auto" FRAMEBORDER="No" RESIZE="YES"> </FRAMESET> <FRAMESET COLS="400,*" FRAMEBORDER="Yes" BORDER=2 FRAMESPACING="0"> <FRAME NAME="ModeFrame" SRC="bottom.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="No" FRAMEBORDER="No" NORESIZE> <FRAME NAME="ModeFrame" SRC="bottom.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="No" FRAMEBORDER="No" NORESIZE> </FRAMESET> <FRAME NAME="PostFrame" SRC="jsForm.htm" MARGINWIDTH="0" MARGINHEIGHT="0" SCROLLING="No" FRAMEBORDER="No" NORESIZE FRAMESPACING="0" BORDER="2"> </FRAMESET> <NOFRAMES> <BODY> <P> </BODY> </NOFRAMES> </HTML> Hi, a friend of mine has a problem on several (German) Legend of the Green Dragon (lotgd) servers. Sometimes, mostly after she has loged in and out for a few times during a day, she suddenly gets the message that Javascript must be enabled to log in. But it definetely IS enabled - otherwise she'd never be loged in! The error occurs - on 2 different PCs - with 2 different internet providers - with IE, FF and Opera - only on lotgd servers - any other page using Javescript are working fine We - updated and downgraded Javascript - disabled and/or uninstalled all antivirus and firewall programms - cleaned cache with CCleaner - disabled browser add ons - reinstalled Windows - disabled auto-insert passwords Even a reboot doesn't change anything. Sometimes, when she waits a few hours, she can log in again. Sometimes the error doesn't occur for days, sometimes it's there every day. That's why it is so strange. Although she doesn't change anything, the error comes and goes completely irregular. The games' admins can't or don't want to help, they say that she's the only one with that problem and that it's not a mistake in the script. What might occur that error? And what can we do to stop it?? That's what the Opera error console says: JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' CSS - http://lotgd.demonstone.org/templates/yarbrough.css Linked-in stylesheet xbackground-color is an unknown property Line 1: eight:auto;padding:1px;line-height:18px;float:left;clear:none;xbackground-color: --------------------------------------------------------------------------------^ JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' JavaScript - http://lotgd.demonstone.org/index.php Uncaught exception: ReferenceError: Undefined variable: calcMD5 Error thrown at line 1, column 0 in <anonymous function>(event): document.forms.loginform .hidden_pw.value = calcMD5(document.forms.loginform .password.value); JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' JavaScript - http://lotgd.demonstone.org/index.php Uncaught exception: ReferenceError: Undefined variable: calcMD5 Error thrown at line 1, column 0 in <anonymous function>(event): document.forms.loginform .hidden_pw.value = calcMD5(document.forms.loginform .password.value); JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' JavaScript - http://lotgd.demonstone.org/index.php Uncaught exception: ReferenceError: Undefined variable: calcMD5 Error thrown at line 1, column 0 in <anonymous function>(event): document.forms.loginform .hidden_pw.value = calcMD5(document.forms.loginform .password.value); JavaScript - http://lotgd.demonstone.org/index.php Inline script compilation Syntax error at line 21 while loading: b|(~d)),a,b,x,s,t);}*/ --------------------^ expected expression, got '*' I hope someone is able to help. Thank you! EDIT: Posted in the wrong forum. Here's my code: Code: // Lab09GRFX04st.java // This is the student, starting file for the Lab09GRFX04st assignment. // The Lab09 practice and graded assignment is open ended. // No code will be provided in the student, starting file. // There are also no files with solutions for the different point versions. // Check the Lab assignment document for additional details. import java.awt.*; import java.applet.*; public class Lab09GRFX04st extends Applet { public void paint(Graphics g) { Meal order1 = new Meal(g,0,0); } } class Tray { public Tray(Graphics g, int x, int y) { g.setColor(Color.lightGray); g.fillRect(x+10,y+100,400,200); g.setColor(Color.black); g.drawRect(x+25,y+115,370,170); } } class Utensil { public Utensil(Graphics g, int x, int y) { g.setColor(Color.gray); g.fillRect(x+60,y+200,10,60); } } class Fork extends Utensil { private int x; private int y; public Fork(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawFork(g); } public void drawFork(Graphics g) { g.setColor(Color.gray); g.fillRect(x+50,y+185,30,15); Polygon prong1 = new Polygon(); prong1.addPoint(x+50,y+185); prong1.addPoint(x+56,y+185); prong1.addPoint(x+53,y+165); g.fillPolygon(prong1); Polygon prong2 = new Polygon(); prong2.addPoint(x+61,y+185); prong2.addPoint(x+67,y+185); prong2.addPoint(x+64,y+165); g.fillPolygon(prong2); Polygon prong3 = new Polygon(); prong3.addPoint(x+74,y+185); prong3.addPoint(x+80,y+185); prong3.addPoint(x+77,y+165); g.fillPolygon(prong3); } } class Spoon extends Utensil { private int x; private int y; public Spoon(Graphics g,int x1,int y1) { super(g,x1,y1); x = x1; y = y1; drawSpoon(g); } public void drawSpoon(Graphics g) { g.setColor(Color.gray); g.fillOval(x+50,y+175,30,40); } } class Knife extends Utensil { private int x; private int y; public Knife(Graphics g, int x1,int y1) { super(g,x1,y1); x = x1; y = y1; drawKnife(g); } public void drawKnife(Graphics g) { g.setColor(Color.gray); g.fillArc(x+55,y+165,30,60,90,180); } } class Napkin { public Napkin (Graphics g, int x, int y) { g.setColor(Color.white); g.fillRect(x+50,y+170,60,100); g.setColor(Color.darkGray); g.drawLine(x+95,y+170,x+95,y+270); } } class MainDish { private int x; private int y; public MainDish(Graphics g, int x1, int y1) { x = x1; y = y1; g.setColor(Color.white); g.fillOval(x+155,y+215,150,50); g.setColor(Color.cyan); g.drawArc(x+175,y+225,110,30,170,210); } } class Burger extends MainDish { private int x; private int y; public Burger(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawBun(g); drawBurger(g); } public void drawBun(Graphics g) { g.setColor(Color.orange); g.fillArc(x+180,y+180,100,70,0,180); g.fillRect(x+182,y+230,96,15); } public void drawBurger(Graphics g) { Color brown = new Color(150,75,0); g.setColor(brown); g.fillRect(x+185,y+215,90,15); } } class Cheeseburger extends Burger { private int x; private int y; public Cheeseburger(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawCheese(g); } public void drawCheese(Graphics g) { g.setColor(Color.yellow); Polygon cheese = new Polygon(); cheese.addPoint(x+195,y+215); cheese.addPoint(x+265,y+215); cheese.addPoint(x+230,y+225); g.fillPolygon(cheese); } } class Hamburger extends Burger { private int x; private int y; public Hamburger(Graphics g, int x1, int y1) { super(g,x1,y1); x = x1; y = y1; drawSesameSeeds(g); drawLettuce(g); } public void drawSesameSeeds(Graphics g) { g.setColor(Color.yellow); g.fillOval(x+190,y+200,3,3); g.fillOval(x+200,y+190,3,3); g.fillOval(x+210,y+197,3,3); g.fillOval(x+220,y+207,3,3); g.fillOval(x+260,y+193,3,3); g.fillOval(x+230,y+185,3,3); g.fillOval(x+240,y+195,3,3); g.fillOval(x+253,y+200,3,3); g.fillOval(x+267,y+202,3,3); g.fillOval(x+220,y+193,3,3); } public void drawLettuce(Graphics g) { g.setColor(Color.green); Polygon lettuce = new Polygon(); lettuce.addPoint(x+185,y+215); lettuce.addPoint(x+275,y+215); lettuce.addPoint(x+285,y+225); lettuce.addPoint(x+275,y+220); lettuce.addPoint(x+265,y+225); lettuce.addPoint(x+255,y+220); lettuce.addPoint(x+245,y+225); lettuce.addPoint(x+235,y+220); lettuce.addPoint(x+225,y+225); lettuce.addPoint(x+215,y+220); lettuce.addPoint(x+205,y+225); lettuce.addPoint(x+195,y+220); lettuce.addPoint(x+185,y+225); lettuce.addPoint(x+175,y+220); g.fillPolygon(lettuce); } } class Drink { private int x; private int y; private Color drinkColor; public Drink(Graphics g, Color c1, int x1, int y1) { x = x1; y = y1; drinkColor = c1; drawCup(g); } public void drawCup(Graphics g) { Polygon cup = new Polygon(); cup.addPoint(x+305,y+190); cup.addPoint(x+365,y+190); cup.addPoint(x+370,y+80); cup.addPoint(x+300,y+80); g.setColor(drinkColor); g.fillPolygon(cup); } } class Soda extends Drink { private int x; private int y; private Color drinkColor; public Soda(Graphics g, Color c1, int x1, int y1) { super(g,c1,x1,y1); x = x1; y = y1; drinkColor = c1; drawTop(g); } public void drawTop(Graphics g) { g.setColor(Color.red); g.fillRect(x+335,y+25,7,45); g.fillRect(x+335,y+25,30,7); g.setColor(Color.white); g.fillRect(x+295,y+70,80,10); g.setColor(Color.black); g.drawRect(x+295,y+70,80,10); } } class CocaCola extends Soda { private int x; private int y; public CocaCola(Graphics g, int x1, int y1) { super(g,Color.red,x1,y1); x = x1; y = y1; drawCupDesign(g); } public void drawCupDesign(Graphics g) { g.setColor(Color.white); g.drawString("C",x+310,y+100); g.drawString("O",x+310,y+110); g.drawString("C",x+310,y+120); g.drawString("A",x+310,y+130); g.drawString(" ",x+310,y+140); g.drawString("C",x+310,y+150); g.drawString("O",x+310,y+160); g.drawString("L",x+310,y+170); g.drawString("A",x+310,y+180); g.drawOval(x+325,y+85,5,5); g.drawOval(x+335,y+100,3,3); g.fillArc(x+340,y+36,30,90,180,180); g.fillArc(x+340,y+125,27,130,0,180); g.setColor(Color.lightGray); g.drawArc(x+340,y+36,30,90,270,90); g.drawArc(x+340,y+125,27,130,95,85); g.drawArc(x+340,y+36,29,90,270,90); g.setColor(Color.red); g.fillArc(x+340,y+36,20,90,180,180); g.fillArc(x+350,y+125,17,130,0,180); } } class Sprite extends Soda { private int x; private int y; public Sprite(Graphics g, int x1, int y1) { super(g,Color.cyan,x1,y1); x = x1; y = y1; drawCupColor(g); drawCupDesign(g); } public void drawCupColor(Graphics g) { for (int blue = 170; blue <= 210; blue++) { g.setColor(new Color(0,100,blue)); g.drawLine(blue+260,81,blue+255,189); } for (int gr = 160; gr <= 200; gr++) { g.setColor(new Color(0,gr,0)); g.drawLine(gr+240,81,gr+245,189); } } public void drawCupDesign(Graphics g) { g.setColor(Color.green); g.fillArc(x+340,y+157,20,15,5,170); g.fillArc(x+340,y+155,20,15,-5,-170); g.setColor(Color.yellow); g.fillArc(x+336,y+150,20,15,5,170); g.fillArc(x+336,y+148,20,15,-5,-170); g.setColor(Color.white); g.drawString("S",x+315,y+160); g.drawString("p",x+322,y+150); g.drawString("r",x+329,y+140); g.drawString("i",x+336,y+130); g.drawString("t",x+343,y+120); g.drawString("e",x+350,y+110); } } class HotDog extends MainDish { private int x; private int y; public HotDog(Graphics g, int x1,int y1) { super(g,x1,y1); x = x1; y = y1; drawHotDog(g); } public void drawHotDog(Graphics g) { g.setColor(Color.orange); g.fillRect(x+180,y+220,20,20); g.fillRect(x+200,y+220,60,20); g.fillRect(x+260,y+220,20,20); g.fillArc(x+170,y+220,20,20,90,180); g.fillArc(x+270,y+220,20,20,270,180); g.fillArc(x+180,y+235,100,10,180,180); g.fillRect(x+180,y+230,20,20); g.fillRect(x+200,y+230,60,20); g.fillRect(x+260,y+230,20,20); g.fillArc(x+170,y+230,20,20,90,180); g.fillArc(x+270,y+230,20,20,270,180); g.fillArc(x+180,y+245,100,10,180,180); g.setColor(Color.red); g.fillArc(x+180,y+224,100,12,180,180); g.setColor(Color.white); g.fillArc(x+187,y+214,86,10,180,180); } } class Powerade extends Soda { private int x; private int y; public Powerade(Graphics g, int x1, int y1) { super(g,Color.blue,x1,y1); g.setColor(Color.black); g.drawString("POWERADE",x+301,y+120); g.setColor(Color.white); g.drawString("POWERADE",x+302,y+121); } } class Meal { private Utensil utensil; private Tray tray; private Fork fork; private Spoon spoon; private Knife knife; private Napkin napkin; private Hamburger plainBurger; private Cheeseburger wCheese; private Powerade bigK; private Sprite coke; private HotDog dog; public Meal(Graphics g, int x, int y) { tray = new Tray(g,x,y); napkin = new Napkin(g,x,y); fork = new Fork(g,x+20,y); spoon = new Spoon(g,x,y); knife = new Knife(g,x+50,y); dog = new HotDog(g,x,y); bigK = new Powerade(g,x,y); coke = new Sprite(g,x+100,y); } } It compiles; however, once I switch to the HTML window and try to run it, a screen appears and the status bar is giving me the "Start: applet not initialized error." Here's my HTML code: Code: <APPLET CODE = "Lab09GRFX04st.class" WIDTH=1000 HEIGHT=650> </APPLET> Does anyone know what's wrong? Hi everyone, I'm using a JavaScript to upload multiple files, namely this one: http://valums.com/ajax-upload/ The script has the ability to post additional parameters to the server, by calling the function setParams Code: var doktyp = "default"; var uploader = new qq.FileUploader({ element: document.getElementById('file-uploader-scope'), action: 'uploads.php', // additional data to send, name-value pairs debug: true, onSubmit: uploader.setParams ({ dateityp: getCheckedValue(document.forms['doktyp'].elements['dateityp']), comment: jQuery('#dateityp').val() }) }); Without the onSubmit: part the script works well and does as it's supposed to, but with it FireBug reports "uploader is undefined" und the script seizes to function. Now JavaScript istn't my strong suit, so I have been reading up on this for the last two hours, tried calling that function from a different place, tried to modify it, but no luck; the error remains the same (or slightly different; if I point at the class in question directly, the function doesnt work...). I would appreciate any advice you could give. |