JavaScript - Object Expected, Code: 0 Error In I.e., But Not Firefox
Please help, I'm getting this error, Object expected, Code: 0 in Internet Explorer (not in Firefox, though). Here is the link to the page:
http://www.uatparts.com/miva/merchan...Category_Code= I'm worried that my customers might shy away and not buy from me when they see this error. What do I need to do in order to stop this error from appearing? Note: I tried including the code in this thread but it was too long, the forum wouldn't let me. Similar Tutorialsi keep getting this error in explorer, while on chrome and on Firefox, it is just not working. this is the html table, (the relevant part is bold) Code: <table align="center"> <tr> <td> שם: </td> <td> <input type="text" id="uname" name="txtname" value="שדה חובה" onmouseout="chkfld('uname')" onclick="this.value='';" /> </td>] </tr> <tr> <td> טלפון: </td> <td> <input id="phone" type="text" name="txtphone" /> </td> </tr> <tr> <td> אימייל: </td> <td> <input type="text" id="usermail" name="txtemail" value="שדה חובה" onmouseout="chkfld('usermail')" onclick="this.value='';" /> </td> </tr> <tr> <td> סיבת הפניה: </td> <td> <select id="reason"> <option>סדנאות</option> <option>טיפול</option> <option>הורדת משקל</option> <option>ניקוי רעלים</option> <option>כללי</option> </select> </td> </tr> <tr> <td> פרטים: </td> <td> <textarea id="TextArea1" cols="20" rows="10"></textarea> </td> </tr> <tr> <td align="center"> <input type="submit" value="שלח" /> </td> </tr> </table> and this is the JS: Code: <script type="text/javascript"> function chkfld(id) { if (document.getElementById(id).value == "" || "שדה חובה") { document.getElementById(id).style.backgroundcolor = "yellow"; document.getElementById(id).value == "שדה חובה"; } else { return true; } } </script> Hi, I'm trying to get the below code working... But it seems to be throwing an error when the function hitcount(fn) is called... Im trying to call an ASP function within Javascript... Can any one please help with this : Code: -- Javascript code -- <script LANGUAGE="JavaScript1.2" > function checkurl(fn) { str = "http://webhost.in/PNM/Book/<%=gotorpt%>/" + fn; if (str.indexOf ("web//") > 0) { alert("Please Select a Month!"); } else { str2 = "http://webhost.in/PNM/Book/counter.asp?choserpt=Y&whichyrmth=" + str; hitcount(fn); -- Error occurs here : Object Expected self.location.href = str; } return; } </script> --ASP function -- <% function hitcount(fn) set conn=Server.CreateObject("ADODB.Connection") conn.Provider="Microsoft.Jet.OLEDB.4.0" conn.Open "..\Hits\hitcounter.mdb" -- Database conn.Mode = 3 set rs = Server.CreateObject("ADODB.Recordset") set SQL = "UPDATE Application_counter SET Application_counter.[Counter] = Application_counter.Counter+1 where pdf='"+fn.substring(0,8)+"';" rs.Open SQL,conn,1,3 document.write(rs(0)) rs.Close() cn.Close() end function %> Hi guys i am trying to make my form out put inputs to the table below. however when i debug in ie9 it tells me error object expected for Code: <button onclick="document.getElementById('tablename').value= document.getElementById('name').value">Submit</button> how do i properly declare the object? the full code is below (i will obviously have more input fields just working it all out first) thanks david 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" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-type" content="text/html;charset=UTF-8" /> <title> HiQuote </title> <!-- Local JavaScripts --> <script type="text/javascript"> // -------------------------------------------- // the 'program' - the CONTROL LAYER function getElementById(" " ) { button onclick="document.getElementById(" ") } // --------------------------------------------- // The global variables - the PERSISTENCE LAYER (sort of!) var Name; var Number; var button onclick="document.getElementById(" ") // --------------------------------------------- // The processing functions - the LOGIC LAYER // --------------------------------------------- // The input/ output functions - the PRESENTATION LAYER // THIS enhanced presentation layer uses a web page form for input // and output. </script> </head> <body> <form name="form" action=" " > INPUT DATA:<br/><br/> Customer name (text): <input name="dataInputName" type = "text" size="30" /><br/><br/> Phone number (text): <input name="dataInputNumber" type ="text" size="10" /><br /><br /> <button onclick="document.getElementById('tablename').value= document.getElementById('name').value">Submit</button> </form> <table> <tr> <td id="tablename"> </td> </tr> <tr> <td id="tablenumber"> </td> </tr> </table> </body> </html> The website is CnJ-Tree.atwebpages.com The site works in everything, except, IE. Of course, never fails right. Anyway, the error is with the navigation. I keep getting object expected errors, on pretty much all of my onMouseOver, onMouseOut, and onClick events. Here is the html. Code: <tr> <td background="images/CnJ-Layout_04.png" width="720" height="28" valign="middle" align="center"> <div id="container" class="navigation"> <a href="#" onClick="openPage('home.php');"><div id="home" class="home" align="center" onMouseOver="navOpen('home');" onMouseOut="navClose('home');">Home</div></a> <a href="#" onClick="openPage('contact.php')"><div id="contact" class="contact" align="center" onMouseOver="navOpen('contact')" onMouseOut="navClose('contact')">Contact Us</div></a> <div id="service" class="service" align="center" onMouseOver="mopen('serviceDropDown'); navOpen('service');" onMouseOut="mclosetime(); navClose('service');" style="cursor:pointer">Services</div> <div id="serviceDropDown" class="serviceDropDown" align="center" onMouseOver="mcancelclosetime(); navOpen('service');" onMouseOut="mclosetime(); navClose('service');" style="visibility: hidden"> <div id="tree" style="cursor:pointer" onClick="openPage('tree-removal.php')" onMouseOver="navOpen('tree')" onMouseOut="navClose('tree')">Tree Removal</div> <div id="trimming" style="cursor:pointer" onClick="openPage('tree-removal.php')" onMouseOver="navOpen('trimming')" onMouseOut="navClose('trimming')">Tree Trimming</div> <div id="hauling" style="cursor:pointer" onClick="openPage('tree-removal.php')" onMouseOver="navOpen('hauling')" onMouseOut="navClose('hauling')">Any Hauling</div> </div> <div id="about" class="about" align="center" onMouseOver="navOpen('about')" onMouseOut="navClose('about')">About Us</div> <div id="gallery" class="gallery" align="center" onMouseOver="navOpen('gallery')" onMouseOut="navClose('gallery')">Gallery</div> </div> </td> </tr> And here is the JS for the related areas. Code: <script type="text/javascript"> var xmlhttp window.onload=function(){ var dotspan = document.getElementById('dots'); window.setInterval(function(){ if(dotspan.innerHTML == '...'){ dotspan.innerHTML = '.'; } else{ dotspan.innerHTML += '.'; } }, 200); // Initiate AJAX usage try { xmlhttp = new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari catch(e){ try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } // Internet Explorer catch(e){ try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } // Internet Explorer catch(e){ alert("Your browser does not support AJAX!"); return false; } } } } function navOpen(page) { document.getElementById(page).style.backgroundImage = "url(images/navi-rollover.png)"; document.getElementById(page).style.color = "#787864"; } function navClose(page) { document.getElementById(page).style.backgroundImage = ""; document.getElementById(page).style.color = "#9b9b80"; } var timeout = 500; var closetimer = 0; var ddmenuitem = 0; // open hidden layer function mopen(id) { // cancel close timer mcancelclosetime(); // close old layer if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; // get new layer and show it ddmenuitem = document.getElementById(id); ddmenuitem.style.visibility = 'visible'; } // close showed layer function mclose() { if(ddmenuitem) ddmenuitem.style.visibility = 'hidden'; } // go close timer function mclosetime() { closetimer = window.setTimeout(mclose, timeout); } // cancel close timer function mcancelclosetime() { if(closetimer) { window.clearTimeout(closetimer); closetimer = null; } } // close layer when click-out document.onClick = mclose; window.onload=function(){ // Initiate AJAX usage try { xmlhttp = new XMLHttpRequest(); } // Firefox, Opera 8.0+, Safari catch(e){ try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } // Internet Explorer catch(e){ try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } // Internet Explorer catch(e){ alert("Your browser does not support AJAX!"); return false; } } } } function openPage(id) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Your browser does not support XMLHTTP!"); return; } var url=id; xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState !=4){ document.getElementById("main").innerHTML=("<center><img src='http://upload.wikimedia.org/wikipedia/commons/4/42/Loading.gif'></center>"); } else{ document.getElementById("main").innerHTML=xmlhttp.responseText; } } ; xmlhttp.open("GET",url,true); xmlhttp.send(null); function GetXmlHttpObject() { if (window.XMLHttpRequest) { // code for IE7+, Firefox, Chrome, Opera, Safari return new XMLHttpRequest(); } if (window.ActiveXObject) { // code for IE6, IE5 return new ActiveXObject("Microsoft.XMLHTTP"); } return null; } } </script> An error 'Object expected' error occurs when loading the page online in IE.There is no error in any browser when it is in local.I need to show a popup when mouse is moved upwards...it works nice in all browsers offline but when it is made online it is not working properly in IE,when the mouse is moved upward popup shows with an error 'Object expected' and it fails to load that instant.In mozilla and other browsers it works properly.Please help to fix it, its very important for me. Thanx 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 there, I'm trying really hard to find the solution to this error I am getting in java. Im using blue j. I have a feeling its something other than just braces missing somewhere, I have looked carefully and I'm just having bad luck!! I cant proceed to the next stage of my code unless I get this bit perfected with no syntax errors. I really really appreciate someone helping me out. Code: import java.util.Scanner; import java.awt.Color; /** * Write a description of class stage2 here. * * @author (Gayethiri Guruthevan) * @version (Version 1.0) */ public class stage2 { public static void main(String[]args) { final int WIDTH = 500; // width of the sheet in pixels final int HEIGHT = 500; // height of the sheet in pixels int x; // the x-coordinate int y; // the y-coordinate String direction; // the direction chosen // Create a Scanner object for keyboard input. Scanner keyboard = new Scanner(System.in); // 1. Ask the user for the ant's x-coordinate System.out.print("Enter your ant's x-coordinate: "); x = keyboard.nextInt(); // 2. If the x-coordinate is outside the allowed range, // print an error message and exit if(x < 0 || x > WIDTH-1) { System.out.println("The x-coordinate must be between 0 and " + (WIDTH-1)); System.exit(-1); } // 3. Ask the user for the ant's y-coordinate System.out.print("Enter your ant's y-coordinate: "); y = keyboard.nextInt(); // 4. If the integer is outside the allowed range, // print an error message and exit if(y < 0 || y > HEIGHT-1) { System.out.println("The Y-coordinate must be between 0 and " + (HEIGHT-1)); System.exit(-1); } // 5. Ask the user for the direction System.out.print("Enter the direction the ant is facing: "); direction = keyboard.next(); System.out.print("How many steps should the ant take?: "); int numStepsToTake = keyboard.nextInt(); for(int i=0; i<numStepsToTake;i++) { if (direction.equalsIgnoreCase("DL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("DR")) { y-=1; x+=1; } else if (direction.equalsIgnoreCase("D")) { y-=1; } if (direction.equalsIgnoreCase("U")) { x+=1; } else if (direction.equalsIgnoreCase("UR")) { y+=1; x+=1; } else if (direction.equalsIgnoreCase("UL")) { y+=1; x-=1; } else if (direction.equalsIgnoreCase("L")) { x-=1; } else if(direction.equalsIgnoreCase("R")) { x+=1; } else { System.out.println("That is incorrect please enter the right direction"); } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(x < 0) { x += WIDTH; } else if(x > WIDTH-1) { x-=WIDTH; } if(y < 0) { y += HEIGHT; } else if(y > HEIGHT-1) { y-=HEIGHT; } //Here is the new method for antart. AntArt.init(WIDTH,HEIGHT,x,y); for(int i=0; i<numStepsToTake;i++) { int oldX = x; int oldY = y; Color paperColor = AntArt.getColor(x,y); antColor = nextColor(antColor,paperColor); AntArt.setColor(antColor); // Take a step direction = nextDirection(direction,antColor,paperColor); x = stepX(x,direction,WIDTH,HEIGHT); y = stepY(y,direction,WIDTH,HEIGHT); AntArt.paint(oldX,oldY); } AntArt.paint(x,y); System.out.println("The new x is " + x + " and y coordinate is " + y); } } } private static int stepx(int x, String direction, int WIDTH, int HEIGHT) { //this will be the answer int newx = x; // take a step in the right direction if(direction.equals("UR")) { newx += 1; } else if (direction.equals("R")) { newx += 1; } else if(direction.equals("DR")) { newx += 1; } else if(direction.equals("DL")) { newx -= 1; } else if(direction.equals("L")) { newx -= 1; } else if(direction.equals("UL")) { newx -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newx < 0) { newx += WIDTH; } else if(newx > WIDTH-1) { newx -= WIDTH; } return newx; } } } private static int stepY(int y, String direction, int WIDTH, int HEIGHT) { // this will be the answer int newy = y; // take a step in the right direction if(direction.equals("UR")) { newy += 1; } else if (direction.equals("R")) { newy += 1; } else if(direction.equals("DR")) { newy += 1; } else if(direction.equals("DL")) { newy -= 1; } else if(direction.equals("L")) { newy -= 1; } else if(direction.equals("UL")) { newy -= 1; } // "Wrap" the x and y-coordinates if the ant has walked over the edge of the paper if(newy < 0) { newy += HEIGHT; } else if(newy > HEIGHT-1) { newy -= HEIGHT; } return newy; } } Hi Chaps, I'm still having problems with a Javascript 'Lookup' function. Basically, I have a select menu 'Customer' which triggers a 3 JS functions, to populate 2 extra select menus. Code: <script type="text/javascript" language="javascript"> $(document).ready(function(){ $('#customer').change(function() { var option=$(this).val(); getCustContact(this); getCostCentreContact(this); $.get('getCostCentre.php',{select:option},function(data){ $('#result').html(data).hide().fadeIn(1000); }); }); }); </script> <script type="text/javascript" language="javascript"> var ajax_CustContact=new Array(); function getCustContact(sel) { var Customer=sel.options[sel.selectedIndex].value; document.getElementById('custcontact').options.length = 0; if(Customer.length>0){ var index=ajax_CustContact.length; ajax_CustContact[index]=new sack(); ajax_CustContact[index].requestFile='getCustomerContact.php?custid='+Customer; ajax_CustContact[index].onCompletion=function(){createCustContact(index)}; ajax_CustContact[index].runAJAX(); } } function createCustContact(index) { var obj=document.getElementById('custcontact'); eval(ajax_CustContact[index].response); } </script> <script type="text/javascript" language="javascript"> var ajax_CostCentreContact=new Array(); function getCostCentreContact(sel) { var Customer=sel.options[sel.selectedIndex].value; document.getElementById('costcentrecontact').options.length = 0; if(Customer.length>0){ var index=ajax_CostCentreContact.length; ajax_CostCentreContact[index]=new sack(); ajax_CostCentreContact[index].requestFile='getCostCentreContact.php?custid='+Customer; ajax_CostCentreContact[index].onCompletion=function(){createCostCentreContact(index)}; ajax_CostCentreContact[index].runAJAX(); } } function createCostCentreContact(index) { var obj=document.getElementById('costcentrecontact'); eval(ajax_CostCentreContact[index].response); } </script> <select id="customer" name="FK_cust_id"> <option value="">Select Customer</option> <option value="1">Customer A</option> <option value="2">Customer B</option> </select> <select id="custcontact" name="FK_contact_id"> <option value="">--Select Customer First--</option> </select> <select id="costcentrecontact" name="FK_cost_centre_contact_id"> <option value="">--Select Customer First--</option> </select> Using IE Developer Tools, during debugging, I get this error: Quote: Expected ';' Error This relates to either: Code: eval(ajax_CustContact[index].response); OR Code: eval(ajax_CostCentreContact[index].response); (it's a bit random, as sometimes it works, sometimes it doesn't) I have tried changing the 'custid' to 'custname' to check whether it was an integer causing the problem, but had the same problem. If anyone can tell me where I am going wrong, I'd gladly give out a bit hi-5! I just noticed that my pseudo-streaming movie code causes an error with IE7. I works fine with IE8, FireFox, Chrome... I have been looking on my own and found that it's likely a misplaced comma in my code, the other browser are debugging it, but IE7 will not. The error suggests it's where I have indicated below. I've tried removing the comma just after "about_us.jpg" and that causes the script to fail completely. Can anyone help me here, please? Code: <script type="text/javascript"> //<![CDATA[ flowplayer("player", {src: "http://www.mysite.org/flowplayer/flowplayer.commercial-3.2.5.swf", wmode: 'opaque'}, { // product key from your account key: '#$xxxxxxxxx', // configure clip to use "lighthttpd" plugin for providing video data playlist: [ { url: 'http://www.mysite.org/media/video/about_us.jpg', }, //<----error suggest here??? { url: 'http://www.mysite.org/flowplayer/streamer.php?file=about_us.flv', provider: 'lighttpd', bufferLength: "2", autoBuffering: false }], // streaming plugins are configured normally under the plugins node plugins: { lighttpd: { url: 'http://www.mysite.org/flowplayer/flowplayer.pseudostreaming-3.2.5.swf', // use ${start} as a placeholder for the target keyframe queryString:escape('&start=${start}') } } }); //]]> </script> public classTestGeometricObject{ /** Main Method */ public static void main(String[] args) { //Declare and initialize two geometric objects GeometricObject geoObject1 = new Circle(5); GeometricObject geoObject2 = new Rectangles(5,3); System.out.println("The two objects have the same area? " + equalArea(geoObject1, geoObject2)); //Display circle displayGeometricObject(geoObject1); //Display rectangle displayGeometricObject(geoObject2); } /**A method for comparing */ public static boolean equalArea(GeometricObject object1, GeometricObject object2) { return object1.getArea()==object2.getArea(); } /**A method for displaying a geometric object*/ public static void displayGeometricObject(GeometricObject object){ System.out.println(); System.out.println("The area is " + object.getArea()); System.out.println("The perimeter is " + object.getPerimeter()); } } I'm new to client side js, so I'm trying to figure out the relationship between the js frames object and the <frame></frame> tags. I have read and reread the information in my book on this subject and googled many examples, but still need clarification. if I have the following code in the body of an HTML document. Code: <frame name="f1"> </frame> <<frame name="f2"> </frame> Then I should get back 2 when I do this Code: alert(document.frames.length); Instead I get document.frames is undefined from Foxfire and get 0 from ie8. If I replace document with top, window, self or parent I get 0 in both Foxfire and ie8. I'm confused, J. 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. When I run this program is says I have an object error (not found?) in line 2, I went over the program which I copied from a book over and over and not finding anything wrong... Help!!! thanks HTML code he 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=utf-8" /> <title>Making Sums</title> <script type="text/javascript" src="jsb-08-01.js"></script> <script type="text/javascript" src="jsb-global.js"></script> </head> <body> <h1>Making Sums</h1> <form action="addit.php"> <p><input type="text" id="inputA" name="inputA" value="0" /></p> <p><input type="text" id="inputB" name="inputB" value="0" /></p> <p><input type="button" id="add" name="add" value="Add" /></p> <p><input type="text" id="output" name="output" /></p> </form> </body> </html> Javascript code he Code: // initialize when the page has loaded addEvent(window, 'load', initialize); // Here's where it says I have an error function initialize() { // do this only if the browser can handle DOM methods if(document.getElementById) { // point to critical elements var oInputA = document.getElementById('inputA'); var oInputB = document.getElementById('inputB'); var oButton = document.getElementById('add'); var oOutput = document.getElementById('output'); // if they all exist... if(oInputA && oInputB && oButton && oOutput) { //apply behaviors addEvent(oButton, 'click', addIt); } } } // add two input numbers & display results function addIt() { var value1 = document.getElementById("inputA").value; var value2 = document.getElementById("inputB").value; document.getElementById("output").value = value1 + value2; } Hi - New to Javascript - new to the forum... Here's one that I don't understand: Code: <script type="text/javascript"> fso = new ActiveXObject("Scripting.FileSystemObject"); myCollection = new Collection(); function FindFiles() { var path = "c:\\files\\"; var ext = ".csv"; var files = new Enumerator (fso.GetFolder(path).Files); //Collect all files in path do { var file = files.item(); if (file.Name.indexOf("_summary")<0) myCollection.add(file.Name,file.Type); files.moveNext(); } while (!files.atEnd()); } function Collection() { var collection = {}; var order = []; this.add = function(property, value) { if(!this.exists(property)) { collection[property]=value; order.push(property); } } this.exists = function(property) { return collection[property]!=null; } } function ListCollection() { var g = new Enumerator (myCollection); do { var colitem = g.item(); g.moveNext(); } while (!g.atEnd()); } </script> During execution, I get a "Object not a collection" error when I try to pass "MyCollection" to the Enumerator function. What am I missing? Thanks, Max Hi, I have an "Object Required" error that only appears in IE and refers to a js file that I got elsewhere, so I'm kind of lost as to how to debug it. The page (which works fine in Chrome and FF) is here and the error reported is: Line: 7 Error: Object Required Sometimes it doesn't pop an alert, but mostly it does. thanks in advance for any suggestions. Hi, I am getting an error on this code - sometimes! - and I'm not sure what it is. If I run this as is there is no error. If I add it into another page with other stuff it's ok for a while and then I get an error. So, I added my new page block my block to this code and waited for the error to appear so I could determine a conflict - but it was fine. And then a few clicks later the error. This is the error in IE. In Firefox it seems to be fine lol. Line 159 Char 3 'window.document.sendform.message_text' is null or not an object Can someone make any suggestions? Code: <script language="JavaScript" type="text/javascript"> maxlen = 160; countLen(); function countLen() { message_text = window.document.sendform.message_text.value; realLength = message_text.length; if (realLength>maxlen) { realLength = maxlen; window.document.sendform.message_text.value = message_text.substring(0,maxlen); } message_text = window.document.sendform.message_text.value; // del enter var m = message_text.match(/[\r\n]/); if (m !== null) { window.document.sendform.message_text.value = message_text.replace(/[\n\r]/g, '') } window.document.sendform.messlen.value=maxlen-realLength; } </script> <cfset thismessage = "Hi, is this a start"> <cfform action="step2.cfm" method="post" id="sendform" name="sendform"> <cfoutput><textarea id="styled" name="message_text" onkeypress=countLen() onkeydown=countLen() onkeyup=countLen() onchange=countLen() onmouseover=countLen() rows="4">#thismessage#</textarea></cfoutput> <table width="331" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="5"></td> <td width="26"><cfoutput> <input name="messlen" type="text" value="160" class="counterField" onFocus="this.form.message_text.focus();" /></cfoutput></td> <td width="300">characters remaining</td> </tr> </table> </cfform> Thanks! Much appreciated! Kind regards, jo Hi All, I always get "Object Required" error when using IE (all IEs). No error when using FF. Message: Object required Line: 62 Char: 178 Code: 0 URI: I am using WebFXTabPane JS and always get error on line 62 or 63. Below is the excerption for line 62 and 63: }; WebFXTabPane.prototype.getSelectedIndex = function () { return this.selectedIndex;}; WebFXTabPane.prototype.addTabPage = function ( oElement ) { if ( !hasSupport() ) return; if ( oElement.tabPage == this ) return oElement.tabPage; var n = this.pages.length; var tp = this.pages[n] = new WebFXTabPage( oElement, this, n ); tp.tabPane = this; this.tabRow.appendChild( tp.tab ); if ( n == this.selectedIndex ) Thank you in advance for any help. Cheers, Jo Hello I am using a timer which goes down from 2 minutes to zero when 'jsp' is called. Timer is written in javascript. I am getting an error that document.form1.timerMin.value=<%=min%> is null or not an object. Here is the code (t.jsp): <% /* Default timer */ int min = 2; int sec = 5; /* Check for timer params */ try { String timerMin = request.getParameter("timerMin"); if (timerMin==null)timerMin=""; if (timerMin != null) { min = Integer.parseInt(timerMin); } String timerSec = request.getParameter("timerSec"); if (timerSec==null)timerSec=""; if (timerSec != null) { sec = Integer.parseInt(timerSec); } } catch(Exception m) { System.out.println("generated exception..............:"+m); } %> <script language="JavaScript" type="text/javascript"> <!-- /* Initialise timer */ var min = <%=min%>; // set the minutes var sec = <%=sec%>; // set the seconds function countDown() { sec--; if (sec == -1) { sec = 59; min--; } /* Write timer state to hidden form fields */ document.form1.timerMin.value=<%=min%> document.form1.timerSec.value=<%=sec%>; time = (min<=9 ? "0" + min : min) + " min and " + (sec<=9 ? "0" + sec : sec) + " sec "; document.getElementById('theTime').innerHTML = time; SD=window.setTimeout("countDown()", 1000); if (min == 0 && sec == 0) { window.clearTimeout(SD); } } window.onload = countDown(); --> </script> <style type="text/css"> <!-- .timeClass { font-family:arial,verdana,helvetica,sans-serif; font-weight:normal; font-size:10pt; } --> </style> <table width="100%"> <tr><td width="100%" align="right"> <span id="theTime" class="timeClass"></span> </td></tr> <form method="post" name="form1" id="form1" action="t.jsp" <td width="50%" valign="middle"> <input type="hidden" name="timerMin" value="<%=min%>"> <input type="hidden" name="timerSec" value="<%=sec%>"> <div align="center"><a href="javascript:form1.submit()" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image3','','/lms/images/submit_0.gif',1)"><img name="Image3" border="0" src="/lms/images/submit_0.gif" width="70" height="30"></a></div> </td> </form> Looking forward for an early reply. Thanks Dim d set mw=CreateObject("Word.Application") set d=Description.Create d("micclass").value="Link" set a=Browser("Google").page("Google").childobjects(d) for i=0 to a.count-1 mw.WordBasic.filenew s=a(i).getROProperty("innertext") mw.WordBasic.insert s if mw.ActiveDocument.Spellingerrors.count>0 then Reporter.ReportEvent 1,"Spelling","spelling error :"&s end if mw.ActiveDocument.Close(False) next mw.quit set mw=nothing |