Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 19th, 2007, 03:49 AM
Authorized User
Join Date: Jun 2007
Location: Christchurch, , New Zealand.
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to hericles
Default Object expected error

I have a script in my web page that runs a cross browser transition effect. It works perfectly in FF and well in IE as long as the option to display script errors is off. If script errors is on I get a "Object expected" error relating to this line:

var object = document.getElementById(id).style;

which is generating a null value. Being a perfectionist I would like to be able to remove the bug. The line of code belongs to this function which checks for the various browser transition functions:

//change the opacity for different browsers
function changeOpac(opacity, id) {

    var object = document.getElementById(id).style;
    object.opacity = (opacity / 95);
    object.MozOpacity = (opacity / 95);
    object.KhtmlOpacity = (opacity / 95);
    object.filter = "alpha(opacity=" + opacity + ")";

id refers to the image element the effect is applied to. opacity is a number defining the current level of opacity.
Any help would be much appreciated.
Thank you,

\"I will prepare and one day my chance will come.\"
Reply With Quote
  #2 (permalink)  
Old July 19th, 2007, 10:21 AM
Authorized User
Join Date: Jun 2007
Location: Tehran, Tehran, Iran.
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts

Hi hericles

It seems that no element with given "id" exists in your document. Send your entire code. It could be more helpful

Ehsan Zaery Moghaddam
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting Object Expected error on mouseover event nrlahoti ASP.NET 2.0 Professional 10 March 15th, 2008 11:30 AM
Object expected darkhalf Javascript 1 September 28th, 2006 05:32 PM
Object Expected!! Apocolypse2005 Javascript 0 July 3rd, 2006 12:23 PM
error on page: object expected eggoose Javascript 5 April 19th, 2006 02:14 AM
run time error: Object expected shoakat Classic ASP Databases 5 September 22nd, 2004 03:17 PM

All times are GMT -4. The time now is 07:50 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.