JavaScript - Ff (and Ie) Has "illegal Character" Error In Error Console
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? Similar TutorialsHi 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 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 I'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 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> 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. 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. First post here so... I have a few functions called by a form. Two examples are onclick in a form input and onkeyup in a form button. Code: function checkUsernameForLength(whatYouTyped) { var fieldset = whatYouTyped.parentNode; var txt = whatYouTyped.value; if (txt.length > 2) { fieldset.className = "welldone"; return true; } else { fieldset.className = ""; return false; } } Code: onkeypress="checkUsernameForLength(this);" There are a couple of the above "validation" functions. Each sets an input fieldset's class. Code: function verifyit() { var fieldsets = document.getElementsByTagName("fieldset"); var i=0; while (i<count(fieldsets)){ if (fieldsets[i] != "") { i++; document.form.submit(); } } } Code: onclick="verifyit()" The function above is where I'm having the trouble. I want to iterate through the fieldsets and make sure each class isn't blank before allowing the button to submit the form. I get an "object expected" error when I trigger the "verifyit" function with ie if it helps. I appreciate any input, thanks in advance for any help. 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! 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> I've been writing calculators with Javascript for over ten years and using the "to.Exponential" function for formatting and rounding. Recently, it is causing a problem for me. Here is a very shortened version of a calculator on which I am working: http://www.1728.com/count.htm This works fine for the first time it is activated but it doesn't work for the second (or any number of additional) times. (Keep clicking "calculate" and you'll see what I mean.) I didn't want to link to the original calculator (because of its size) but the "to.Exponential" function causes yet another problem in that one. When the count ('ct') is equal to five or six, the program stops working. Any help with this would be greatly appreciated. Hello, this is my first post. The following code works in FF, Is there any way to have the code work correctly in IE 7? The error is on both the following lines, odoc.appendChild(ne);. Thank you for any assistance. Quote: <!--#include file="include/dbcommon.asp"--> <% set dbConnection = server.CreateObject ("ADODB.Connection") dbConnection.ConnectionString = strConnection dbConnection.Open %> <html> <head> <link REL="stylesheet" href="include/style.css" type="text/css"> <!--[if IE]> <link REL="stylesheet" href="include/styleIE.css" type="text/css"> <![endif]--> </head> <body> <table> <tr><td> Subject:</td> <td><input id=subject type=text size=40></td> <td align=right> Templates: <select id=templates style="width:300" onchange="doInsert(document.getElementById('templates').value);document.getElementById('templates'). selectedIndex=0;"> <option value="">Please select</option> <% Set rs = server.CreateObject ("ADODB.Recordset") rs.Open "select * from QuickTemplates", dbConnection,1,2 while not rs.eof fname=replace(rs("fname"),"""",""") if(len(rs("fname"))>40) then _ fname=replace(left(rs("fname"),30)&"...","""",""") response.write "<option value=""" & replace(rs("fname"),"""",""") & """>" & fname & "</option>" rs.movenext wend rs.close %> </select> </td></tr> <tr> <td valign=top>Body:</td><td colspan=2><textarea id=body cols=100 rows=20></textarea></td> </tr> <td align=center colspan=3> <SPAN class=buttonborder><input class=button type=button value="Send email" onclick="sendem();"></SPAN> <SPAN class=buttonborder><input class=button type=button value="Close" onclick="self.close();return false;"></SPAN> </td> </tr> </table> </body> <html> <script> function sendem() { odoc=opener.document.getElementById("frmAdmin"); opener.document.forms.frmAdmin.a.value="email"; ne=document.createElement("input"); ne.name="subject"; ne.type="hidden"; ne.value=document.getElementById("subject").value; odoc.appendChild(ne); ne=document.createElement("input"); ne.name="body"; ne.type="hidden"; ne.value=document.getElementById("body").value; odoc.appendChild(ne); opener.document.forms.frmAdmin.submit(); self.close(); } function doInsert(ibTag) { var uagent = navigator.userAgent.toLowerCase(); var is_safari = ( (uagent.indexOf('safari') != -1) || (navigator.vendor == "Apple Computer, Inc.") ); var is_opera = (uagent.indexOf('opera') != -1); var is_webtv = (uagent.indexOf('webtv') != -1); var ua_vers = parseInt(navigator.appVersion); var is_win = ( (uagent.indexOf("win") != -1) || (uagent.indexOf("16bit") !=- 1) ); var is_ie = ( (uagent.indexOf('msie') != -1) && (!is_opera) && (!is_safari) && (!is_webtv) ); if(ibTag!="") { var isClose = false; var obj_ta = document.getElementById("body"); obj_ta.focus(); if ( (ua_vers >= 4) && is_ie && is_win ) { var rng = document.selection.createRange(); rng.colapse; rng.text = ibTag; } else if ( obj_ta.selectionEnd>=0 ) { var ss = obj_ta.selectionStart; var st = obj_ta.scrollTop; var es = obj_ta.selectionEnd; if (es < 0) { es = obj_ta.textLength; } var start = (obj_ta.value).substring(0, ss); var end = (obj_ta.value).substring(es, obj_ta.textLength); obj_ta.value = start + ibTag + end; var p=0; var ent=0; while(p!=-1) { p=ibTag.indexOf('\n',p); if(p!=-1) { p++; ent++; } } var cpos = ss + (ibTag.length)-ent; obj_ta.selectionStart = cpos; obj_ta.selectionEnd = cpos; obj_ta.scrollTop = st; } obj_ta.focus(); return isClose; } } </script> import java.util.Scanner; public class Lab4_Ex2 { public static void main(String[] args) { String input; int firstTest; int secondTest; int thirdTest; int finalGrade; Scanner keyboard = new Scanner(System.in); // Get the fisrt test grade from the user System.out.print("Enter the first test grade: "); firstTest = keyboard.nextInt(); // Get the second test grade from the user System.out.print("Enter the second test grade: "); secondTest = keyboard.nextInt(); // Get the third test grade from the user System.out.print("Enter the third test grade: "); thirdTest = keyboard.nextInt(); if (firstTest < secondTest && firstTest < thirdTest) { finalGrade = secondTest + thirdTest; System.out.println("First Test: " + firstTest + "\nSecond Test: " + secondTest + "\nthirdTest: " + thirdTest); System.out.println("After dropping test 1, the final grade is " + finalGrade + "."); } else if (secondTest < firstTest && secondTest < thirdTest) { finalGrade = firstTest + thirdTest; System.out.println("First Test: " + firstTest + "\nSecond Test: " + secondTest + "\nthirdTest: " + thirdTest); System.out.println("After dropping test 2, the final grade is " + finalGrade + "."); } else if (thirdTest < firstTest && thirdTest < secondTest) { finalGrade = firstTest + secondTest; System.out.println("First Test: " + firstTest + "\nSecond Test: " + secondTest + "\nthirdTest: " + thirdTest); System.out.println("After dropping test 3, the final grade is " + finalGrade + "."); } if (finalGrade >= 90) System.out.println("The final letter grade is A."); else if(finalGrade < 90 && finalGrade >= 80) System.out.println("The final letter grade is B."); else if (finalGrade < 80 && finalGrade >= 70) System.out.println("The final letter grade is C."); else if (finalGrade < 70 && finalGrade >= 60) System.out.println("The final letter grade is D."); else if (finalGrade < 60) System.out.println("The final letter grade is F."); } } Hi I'm new to Javascript. This is how I get and set numeric values that are stored as character in object properties: Code: nIncrement = 5; nLeft = parseFloat(oObject.style.left); // get value as number nLeft = nLeft + nIncrement; // make some calcs... oObject.style.left = nLeft + 'px'; // convert numeric to character // or sometimes I just add a space: oObject.style.left = nLeft + ' '; // convert numeric to character Is that the correct way to do it? I feel uncomfortable doing it that way, could you advise me on how is the common way to do that in JS? Thanks. Hey guys, I got this line of code: Code: var headlines = document.getElementById("navigation").getElementsByTagName("ul").getElementsByTagName("li").getElementsByTagName("span"); My debugger gives me this error: "document.getElementById("navigation").getElementsByTagName("ul").getElementsByTagName is not a function". What am I doing wrong, and how do I fix it? (Background: As a school assignment I'm trying to do an expandable menu, and my idea is to run a for-loop, making every element in the array 'headlines' respond to onclick.) I had some code written for me. Basically it outputs something like this based on user input: Code: <span>name 1 - <a href=\"test1b\" rel="nofollow" target=\"_blank\">test1a</a> - $12</span><br/> <span>name 2- <a href=\"test2b\" rel="nofollow" target=\"_blank\">test2a</a> - $24</span><br/> What it used to look like: Code: /** * @FUNCTION: finalize :: PUBLIC * This is a shorter version of the codes you * had before and also have a more faster speed */ $.finalize = function(g) { /* Setting global variables */ var i,k,d,p,j,n=0,t=[],f=[],preview=false,addbr='',addExtra='', o=document.getElementsByTagName('div'), s=document.getElementById(g), /* Creating getName function */ getName=function(o){ /* Setting getName global variables */ var i,n= ['Motherboard','CPU','RAM','Video Card', 'Hard Drive','Power Supply','Case', 'Operating System','Other'] ; /* Obtaining and returning the result */ for(i=0;i<n.length;i++){if(n[i].toLowerCase()== o.toLowerCase().replace('_',' ')){return n[i];}} }; /* Obtaining the full total */ $.findTotal(); /* Looping through all active boxes */ for(i=0;i<o.length;i++) { /* Splitting current box class by spaces */ k = o[i].className.split(' '); /* Looping through each class items */ for(j=0;j<k.length;j++) { /* Checking if this item is equal to itemBox */ if(k[j] == 'itemBox') { /* Setting d as the current box that contains itemBox in the class */ d = document.getElementById(o[i].id); /* If d's display is not empty and doesn't equal none */ if(d.style.display !== '' && d.style.display !== 'none') { /* Setting up the loops global variables */ var h=d.getElementsByTagName('input'),name='', text='',link='',quantity='',price='',run=false; /* Looping through each of the inputs and obtaining the correct information */ for(p=0;p<h.length;p++) { /* If current input name contains [name] and is not disabled */ if(h[p].name.indexOf('[name]') !== -1 && !h[p].disabled) { /* Obtaining the correct name for the current box */ name = getName(h[p].name.match(/computer\[(\w+)\]\[name\]/)[1]); /* IF current input value is not empty and Setting the variable as the current inputs value */ if(h[p].value !== '') {text = ' '+h[p].value;run = true;} /* If current input name contains [link] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[link]') !== -1 && !h[p].disabled && h[p].value !== '') { /* If variable text is not empty output the forum URL and Custom text string */ if(text.substr(1) !== '') {link = ' <a href="'+h[p].value+'" rel="nofollow" target="_blank">'+text.substr(1)+'</a>';} /* If variable text is empty output the forum URL string */ else {link = '" rel="nofollow" target="_blank">'+h[p].value+'</a>';} run = true; /* If current input name contains [quantity] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[quantity]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ quantity = ' ('+parseInt(h[p].value)+')'; run = true; /* If current input name contains [price] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[price]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ var add = (text !== '' | link !== '' | quantity !== '')?' -':''; price = add+' $'+parseInt(h[p].value); run = true; } } /* Checking if link is not empty, if it is check if text is not empty and if that is then set as empty */ link = (link !== '')?link:(text !== '')?text:''; name = (run)?name+' -':''; /* Add this full string to the global array */ f[n] = "<span>"+name+''+link+''+quantity+''+price+"</span><br/>"; /* Add 1 to the number n */ n++; /* Allowing preview */ preview = true; } } } } if(total && f.join('') !== '') {addExtra+="\n\n<p>Total Price: $"+total+"</p>";} /* If s exists set the innerHTML as the full f array imploded by \n at the end of each array item */ if(s) {for(i=0;i<f.length;i++){if(f[i]!==''){t[i]=f[i];}}s.value=t.join("\n")+addExtra;} /* Updating the total */ $.findTotal(); /* Checking if preview is true */ if(preview && f.join('') !== '') { /* Displaying the preview to the user */ $.preview('display','preview'); } else { /* Hiding the preview from the user */ $.preview('hide','preview'); } }; But for some reason, when I change the part in red, it starts saying undefined: Code: /** * @FUNCTION: finalize :: PUBLIC * This is a shorter version of the codes you * had before and also have a more faster speed */ $.finalize = function(g) { /* Setting global variables */ var i,k,d,p,j,n=0,t=[],f=[],preview=false,addbr='',addExtra='', o=document.getElementsByTagName('div'), s=document.getElementById(g), /* Creating getName function */ getName=function(o){ /* Setting getName global variables */ var i,n= ['Speakers 1','Speakers 2','AMP','Source Comp. 1', 'Source Comp. 2','Source Comp. 3','Other'] ; /* Obtaining and returning the result */ for(i=0;i<n.length;i++){if(n[i].toLowerCase()== o.toLowerCase().replace('_',' ')){return n[i];}} }; /* Obtaining the full total */ $.findTotal(); /* Looping through all active boxes */ for(i=0;i<o.length;i++) { /* Splitting current box class by spaces */ k = o[i].className.split(' '); /* Looping through each class items */ for(j=0;j<k.length;j++) { /* Checking if this item is equal to itemBox */ if(k[j] == 'itemBox') { /* Setting d as the current box that contains itemBox in the class */ d = document.getElementById(o[i].id); /* If d's display is not empty and doesn't equal none */ if(d.style.display !== '' && d.style.display !== 'none') { /* Setting up the loops global variables */ var h=d.getElementsByTagName('input'),name='', text='',link='',quantity='',price='',run=false; /* Looping through each of the inputs and obtaining the correct information */ for(p=0;p<h.length;p++) { /* If current input name contains [name] and is not disabled */ if(h[p].name.indexOf('[name]') !== -1 && !h[p].disabled) { /* Obtaining the correct name for the current box */ name = getName(h[p].name.match(/computer\[(\w+)\]\[name\]/)[1]); /* IF current input value is not empty and Setting the variable as the current inputs value */ if(h[p].value !== '') {text = ' '+h[p].value;run = true;} /* If current input name contains [link] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[link]') !== -1 && !h[p].disabled && h[p].value !== '') { /* If variable text is not empty output the forum URL and Custom text string */ if(text.substr(1) !== '') {link = ' <a href="'+h[p].value+'" rel="nofollow" target="_blank">'+text.substr(1)+'</a>';} /* If variable text is empty output the forum URL string */ else {link = '" rel="nofollow" target="_blank">'+h[p].value+'</a>';} run = true; /* If current input name contains [quantity] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[quantity]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ quantity = ' ('+parseInt(h[p].value)+')'; run = true; /* If current input name contains [price] and is not disabled and the value is not empty */ } else if(h[p].name.indexOf('[price]') !== -1 && !h[p].disabled && h[p].value !== '') { /* Setting the variable as the current inputs value */ var add = (text !== '' | link !== '' | quantity !== '')?' -':''; price = add+' $'+parseInt(h[p].value); run = true; } } /* Checking if link is not empty, if it is check if text is not empty and if that is then set as empty */ link = (link !== '')?link:(text !== '')?text:''; name = (run)?name+' -':''; /* Add this full string to the global array */ f[n] = "<span>"+name+''+link+''+quantity+''+price+"</span><br/>"; /* Add 1 to the number n */ n++; /* Allowing preview */ preview = true; } } } } if(total && f.join('') !== '') {addExtra+="\n\n<p>Total Price: $"+total+"</p>";} /* If s exists set the innerHTML as the full f array imploded by \n at the end of each array item */ if(s) {for(i=0;i<f.length;i++){if(f[i]!==''){t[i]=f[i];}}s.value=t.join("\n")+addExtra;} /* Updating the total */ $.findTotal(); /* Checking if preview is true */ if(preview && f.join('') !== '') { /* Displaying the preview to the user */ $.preview('display','preview'); } else { /* Hiding the preview from the user */ $.preview('hide','preview'); } }; I have inherited some Javascript code from a colleague that was laid off recently, and I know very little about Javascript. I'm hoping someone here can help me out. I'm getting a Javascript error in IE for "Not implemented". Here is the full error that I get: Line: 34 Char: 1 Error: Not implemented Code: 0 And here is the Javascript code that I'm working with. It is located in a separate .js file. I'm not sure why the person who wrote it didn't use semicolons - I thought these were necessary. Anyway, the Javascript: Code: // List all the image files below with the corresponding HTML code var item=new Array() item[0]="<p><a href='case_study.pdf' target='_blank'><img src='graphics/frame1.gif' border='0'></a></p><p class='homepage_quotes_para_pad'><b>“</b>It translates to a quick learning curve and fast product development.<b>”</b></p><p class='homepage_box_para_pad'><i>Developer</i><br>Foo Inc.</p>" item[1]="<p><a href='r_case_study.pdf' target='_blank'><img src='graphics/r-frame2.gif' border='0'></a></p><p class='homepage_quotes_para_pad'><b>“</b>We needed the glue to hold, and it supplied that glue.<b>”</b></p><p class='homepage_box_para_pad'>Systems Manager<br><i>R, Inc.</i></p>" var current=0 var ns6=document.getElementById&&!document.all function changeItem(){ if(document.layers){ document.layer1.document.write(item[current]) document.layer1.document.close() } if(ns6)document.getElementById("customer_logos").innerHTML=item[current] { if(document.all){ customer_logos.innerHTML=item[current] } } // The number of images being rotated is list here if (current==2) current=0 else current++ setTimeout("changeItem()",10000) // Set the time between rotations } window.onload=setTimeout("changeItem()",10000) //--> Now I've looked around the web, and it seems like the error is happening because of that last line (the "window.onload") -- IE doesn't like the way it's written, I guess. I've tried some different suggestions that I found, but they all seem to break the functionality that the Javascript is used for (rotating an image and quote). Any help you can give me is greatly appreciated. Thanks in advance. Hey, I've been getting an error on my JavaScript code that says Expected ";". I'm new to JavaScript and I'm trying to use it to create a user interface that resizes like its zooming in and out when the window resizes. I looked around my code and it looked like I put the semi-colons in all the right places. I know that JavaScript doesn't need Semi-Colons, but I like it for an organization purpose and from past experience, the Semi-Colons didn't mess it up. From past experience, I also know that when a JavaScript error comes up in IE, the cause isn't always what the error says. Here's my code: HTML: 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> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>FSA Hight Student Council</title> <script type="text/javascript" src="interface.js"></script> <link href="interface.css" type="text/css" rel="stylesheet" /> </head> <body id="body" onload="resize()"> <div id="LayerHead"> <div id="LayerTopAd"> <div align="center"> <p class="style1">AD!</p> </div> </div> </div> <div id="LayerLeft"> <div id="LayerLeftAd"> <p class="style1">AD!</p> </div> </div> <div id="LayerRight"> <div id="LayerRightAd"> <img src="Sample.png" alt="Smapskldf" width="120" height="600" /> </div> </div> <div id="LayerFoot"></div> <div id="LayerContent"> <iframe src="page.html" id="IFrame"></iframe> </div> </body> </html> JavaScript: Code: //**********The following function resizes all the divs to fit on the screen, no matter what the browser window size is.********** function resize() { //Define Browser Size var width = 0; var height = 0; //For the AMAZING browsers if (typeof (window.innerWidth) == 'number') { width = window.innerWidth; height = window.innerHeight; } //For Internet Explorer 6 and up else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { width = document.documentElement.clientWidth; height = document.documentElement.clientHeight; } //For Internet Exploer 4 type else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) { width = document.body.clientWidth; height = document.body.clientHeight; } //Variable for Zoom (This is the ratio of how the browser must zoom) var zoom = 745 / height; //DefineDivs /* **The Following defines the numbers that correspond to each Div Layer as defined below** 0: LayerHead 1: LayerLeft 2: LayerRight 3: LayerFoot 4: LayerContent 5: LayerTopAd 6: LayerLeftAd 7: LayerRightAd */ var Divs = new Array(); var Divs[0] = document.getElementById('LayerHead'); var Divs[1] = document.getElementById('LayerLeft'); var Divs[2] = document.getElementById('LayerRight'); var Divs[3] = document.getElementById('LayerFoot'); var Divs[4] = document.getElementById('LayerContent'); var Divs[5] = document.getElementById('LayerTopAd'); var Divs[6] = document.getElementById('LayerLeftAd'); var Divs[7] = document.getElementById('LayerRightAd'); //Define get Div Sizes and Location for Ads for the new zoom for (var i in Divs) { Divs[i].style.height = Divs[i].style.height / zoom; Divs[i].style.width = Divs[i].style.width / zoom; Divs[i].style.top = Divs[i].style.top / zoom; Divs[i].style.bottom = Divs[i].style.bottom / zoom; Divs[i].style.left = Divs[i].style.left / zoom; Divs[i].style.right = Divs[i].style.right / zoom; } } CSS: Code: #LayerHead { position:absolute; left:0px; top:0px; width:100%; height:100px; z-index:4; background-color: #FF0000; } #LayerLeft { position:absolute; left:0px; top:0px; width:150px; height:100%; z-index:2; background-color: #0000FF; } #LayerRight { position:absolute; right:0px; top:0px; width:150px; height:100%; z-index:1; background-color: #00FF00; } #LayerFoot { position:absolute; left:0px; bottom:0px; width:100%; height:15px; z-index:3; background-color: #FFFF00; } #LayerContent { position:absolute; left:150px; top:100px; right:151px; bottom:16px; z-index:0; } #IFrame { position:absolute; left:0px; top:0px; height:100%; width:100%; z-index:0; } #LayerTopAd { position:absolute; right:5px; top:5px; width:728px; height:90px; z-index:6; background-color: #00FFFF; } #LayerLeftAd { position:absolute; left:15px; bottom:20px; width:120px; height:240px; z-index:6; background-color: #00FFFF; } #LayerRightAd { position:absolute; left:15px; top:115px; width:120px; height:600px; z-index:6; background-color: #00FFFF; } .style1 { font-size: xx-large } I know the code isn't perfect for the purpose, but I'd like to get past this error so that I can do testing before I continue. |