473,830 Members | 1,938 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Object Expected, need help

23 New Member
Line 22 Char 1 says object expected in the following code. For the life of me I can't figure out what it is. I'm sure I'm just overlooking some stupid bit of formatting or something.


Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2.  
  3. <script type="text/javascript">
  4.  
  5. function ZoomIn() {
  6. if document.getElementById('MyIFrame').style.zoom!='100%' {
  7.   newZoom= parseInt(MyIFrame.style.zoom)+10+'%';
  8.       MyIFrame.style.zoom =newZoom;
  9.     ZoomInID=window.setTimeout("ZoomIn()",1000);}
  10. else  window.clearTimeout(ZoomInID);
  11.   } 
  12.  
  13. function ZoomOut() {
  14. if document.getElementById('MyIFrame').style.zoom!='50%' {
  15.   newZoom= parseInt(MyIFrame.style.zoom)-10+'%';
  16.       MyIFrame.style.zoom =newZoom;
  17.     ZoomOutID=window.setTimeout("ZoomIn()",1000);}
  18. else  window.clearTimeout(ZoomOutID);
  19.   } 
  20. </script>
  21. </head><body>
  22. <iframe src="MyIFrame.htm" ID="MyIFrame" Name="MyIFrame" style="zoom:50%" onmouseover="ZoomIn();" onmouseout="ZoomOut();"></iframe>
  23.  
  24. </body></html>
Oct 10 '07 #1
8 1983
dmjpro
2,476 Top Contributor
Line 22 Char 1 says object expected in the following code. For the life of me I can't figure out what it is. I'm sure I'm just overlooking some stupid bit of formatting or something.


Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2.  
  3. <script type="text/javascript">
  4.  
  5. function ZoomIn() {
  6. if document.getElementById('MyIFrame').style.zoom!='100%' {
  7.   newZoom= parseInt(MyIFrame.style.zoom)+10+'%';
  8.       MyIFrame.style.zoom =newZoom;
  9.     ZoomInID=window.setTimeout("ZoomIn()",1000);}
  10. else  window.clearTimeout(ZoomInID);
  11.   } 
  12.  
  13. function ZoomOut() {
  14. if document.getElementById('MyIFrame').style.zoom!='50%' {
  15.   newZoom= parseInt(MyIFrame.style.zoom)-10+'%';
  16.       MyIFrame.style.zoom =newZoom;
  17.     ZoomOutID=window.setTimeout("ZoomIn()",1000);}
  18. else  window.clearTimeout(ZoomOutID);
  19.   } 
  20. </script>
  21. </head><body>
  22. <iframe src="MyIFrame.htm" ID="MyIFrame" Name="MyIFrame" style="zoom:50%" onmouseover="ZoomIn();" onmouseout="ZoomOut();"></iframe>
  23.  
  24. </body></html>
Did you forget to close the "()" in both "if" controls, or it is your code?

Debasis Jana
Oct 10 '07 #2
vee10
141 New Member
Hi ,
Ur problem will be solved
Expand|Select|Wrap|Line Numbers
  1. if (document.getElementById('MyIFrame').style.zoom!='100%' )
and

Expand|Select|Wrap|Line Numbers
  1. if (document.getElementById('MyIFrame').style.zoom!='50%' )
in javascript if condition should have open and close braces

syntax:
Expand|Select|Wrap|Line Numbers
  1. if(condition)
  2. {
  3.  
  4. }
  5.  
  6. else
  7. {
  8.  
  9. }
Line 22 Char 1 says object expected in the following code. For the life of me I can't figure out what it is. I'm sure I'm just overlooking some stupid bit of formatting or something.


Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2.  
  3. <script type="text/javascript">
  4.  
  5. function ZoomIn() {
  6. if document.getElementById('MyIFrame').style.zoom!='100%' {
  7.   newZoom= parseInt(MyIFrame.style.zoom)+10+'%';
  8.       MyIFrame.style.zoom =newZoom;
  9.     ZoomInID=window.setTimeout("ZoomIn()",1000);}
  10. else  window.clearTimeout(ZoomInID);
  11.   } 
  12.  
  13. function ZoomOut() {
  14. if document.getElementById('MyIFrame').style.zoom!='50%' {
  15.   newZoom= parseInt(MyIFrame.style.zoom)-10+'%';
  16.       MyIFrame.style.zoom =newZoom;
  17.     ZoomOutID=window.setTimeout("ZoomIn()",1000);}
  18. else  window.clearTimeout(ZoomOutID);
  19.   } 
  20. </script>
  21. </head><body>
  22. <iframe src="MyIFrame.htm" ID="MyIFrame" Name="MyIFrame" style="zoom:50%" onmouseover="ZoomIn();" onmouseout="ZoomOut();"></iframe>
  23.  
  24. </body></html>
Oct 10 '07 #3
dmjpro
2,476 Top Contributor
Hi ,
Ur problem will be solved
Expand|Select|Wrap|Line Numbers
  1. if (document.getElementById('MyIFrame').style.zoom!='100%' )
and

Expand|Select|Wrap|Line Numbers
  1. if (document.getElementById('MyIFrame').style.zoom!='50%' )
in javascript if condition should have open and close braces

syntax:
Expand|Select|Wrap|Line Numbers
  1. if(condition)
  2. {
  3.  
  4. }
  5.  
  6. else
  7. {
  8.  
  9. }
This is a syntactical problem.
The error message never comes with Syntactical problem.
Having runtime error it happens .............
I think he mistyped.

Debasis Jana
Oct 10 '07 #4
Z1P2
23 New Member
Thanks, I changed it to:

Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2.  
  3. <script type="text/javascript">
  4.  
  5. function ZoomIn() {
  6.   if (document.getElementById('MyIFrame').style.zoom!=' 100%') {
  7.     newZoom= (parseInt(MyIFrame.style.zoom)+10)+'%';
  8.     MyIFrame.style.zoom =newZoom;
  9.     ZoomInID=window.setTimeout("ZoomIn()",1000);
  10.   } else {
  11.     window.clearTimeout(ZoomInID);
  12.   } 
  13. }
  14.  
  15. function ZoomOut() {
  16.   if (document.getElementById('MyIFrame').style.zoom!=' 50%') {
  17.     newZoom= (parseInt(MyIFrame.style.zoom)-10)+'%';
  18.     MyIFrame.style.zoom =newZoom;
  19.     ZoomOutID=window.setTimeout("ZoomOut()",1000);
  20.   } else {
  21.     window.clearTimeout(ZoomOutID);
  22.   } 
  23. }
  24. </script>
  25.  
  26. </head><body>
  27.  
  28. <iframe src="MyIFrame.htm" style="zoom:50%" ID="MyIFrame" onmouseover="ZoomIn();" onmouseout="ZoomOut();"></iframe>
  29.  
  30. </body></html>
  31.  
But Now I get Lines 7, 8, 17, & 18 chars 5 'MyIFrame.style .zoom' is null or not an object which I can get rid of that by removing the .style from there, but it still won't do what I want it to, which is to change the zoom on the iframe. I must be missing something.
Oct 10 '07 #5
dmjpro
2,476 Top Contributor
Thanks, I changed it to:

Expand|Select|Wrap|Line Numbers
  1. <html><head>
  2.  
  3. <script type="text/javascript">
  4.  
  5. function ZoomIn() {
  6.   if (document.getElementById('MyIFrame').style.zoom!=' 100%') {
  7.     newZoom= (parseInt(MyIFrame.style.zoom)+10)+'%';
  8.     MyIFrame.style.zoom =newZoom;
  9.     ZoomInID=window.setTimeout("ZoomIn()",1000);
  10.   } else {
  11.     window.clearTimeout(ZoomInID);
  12.   } 
  13. }
  14.  
  15. function ZoomOut() {
  16.   if (document.getElementById('MyIFrame').style.zoom!=' 50%') {
  17.     newZoom= (parseInt(MyIFrame.style.zoom)-10)+'%';
  18.     MyIFrame.style.zoom =newZoom;
  19.     ZoomOutID=window.setTimeout("ZoomOut()",1000);
  20.   } else {
  21.     window.clearTimeout(ZoomOutID);
  22.   } 
  23. }
  24. </script>
  25.  
  26. </head><body>
  27.  
  28. <iframe src="MyIFrame.htm" style="zoom:50%" ID="MyIFrame" onmouseover="ZoomIn();" onmouseout="ZoomOut();"></iframe>
  29.  
  30. </body></html>
  31.  
But Now I get Lines 7, 8, 17, & 18 chars 5 'MyIFrame.style .zoom' is null or not an object which I can get rid of that by removing the .style from there, but it still won't do what I want it to, which is to change the zoom on the iframe. I must be missing something.
Is this "MyIFrame.style .zoom" a standard attribute.
I don't know.
Actually I am not very much familiar with CSS :-)
Can't you do it using change the size of "IFrame"?
Means ..... "style.heig ht" and "style.widt h".

Debasis Jana
Oct 10 '07 #6
Z1P2
23 New Member
Well, if I change just the height and width, then the contents of the frame won't shrink or grow with the frame, it will only change the viewable area. That's why I've got to change the zoom style somehow.

The effect I'm going for here is to have a background image of (for example) a face, and the iframe will start out super-small, like around 2% of it's original size, and it will be placed over the pupil of the eye without borders, so that it almost looks like it's part of the picture, but when you mouse over the eye, it zooms the iframe in, which would contain a rotating ad such as a google adsense ad. I have done that already with just putting the final zoom size in the onmouseover event handler, but that doesn't provide the smooth zooming effect that I'm going for here.

As far as I know, .style.zoom is ok... there's a script here: http://msdn2.microsoft.com/en-us/library/ms535169.aspx

That uses it, and that script works (although they named their ID ozoom instead of MyIFrame, so in theirs it's ozoom.style.zoo m, but it should work the same).
Oct 10 '07 #7
dmjpro
2,476 Top Contributor
Well, if I change just the height and width, then the contents of the frame won't shrink or grow with the frame, it will only change the viewable area. That's why I've got to change the zoom style somehow.

The effect I'm going for here is to have a background image of (for example) a face, and the iframe will start out super-small, like around 2% of it's original size, and it will be placed over the pupil of the eye without borders, so that it almost looks like it's part of the picture, but when you mouse over the eye, it zooms the iframe in, which would contain a rotating ad such as a google adsense ad. I have done that already with just putting the final zoom size in the onmouseover event handler, but that doesn't provide the smooth zooming effect that I'm going for here.
Then you have to wait for a CSS experts.

Debasis Jana
Oct 10 '07 #8
Z1P2
23 New Member
Ok, so I changed and simplified the code, everything works now with no errors, with only one problem. If I mouse out before the iframe has finished zooming in, it stays at it's zoomed in size until I re-mouseover and mouseout again. If it absolutely has to work like that, ok, but I'd prefer it not to. I need one command to get this part to work as well, I need an IF statement that checks to see if the mouse is still over the object. Does such a thing exist? I know it's a long shot due to the redundancy between that and an onmouseout event, but I can hope, right?
Oct 10 '07 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

4
44878
by: Bill | last post by:
I call a function in my .js file like this: onClick="location.href='blank.html' + generateSearchStringFromForm('section')" where section is the name of my form. The function is defined as follows: myFunction(k) {
54
4627
by: tshad | last post by:
I have a function: function SalaryDisplay(me) { var salaryMinLabel = document.getElementById("SalaryMin"); salaryMinLabel.value = 200; alert("after setting salaryMinLabel = " + salaryMinLabel.value); } I also have an asp.net object:
30
3767
by: jimjim | last post by:
Hello, This is a simple question for you all, I guess . int main(){ double *g= new double; *g = 9; delete g; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl; *g = 111; cout<< sizeof(g)<<" "<<sizeof(double)<<" "<<sizeof(*g)<<" "<<*g<<" "<<endl;
1
2589
by: David Veeneman | last post by:
Hi-- I'm trying to databind a business object to several controls using the DataBindings property of the controls, like this: textBoxStartDate.DataBindings.Add("Text", CurrentStep, "StartDate", true, DataSourceUpdateMode.OnValidation, String.Empty, "d"); Where CurrentStep is a business object of type ProjectStep, with several properties, such as the StartDate property shown above.
26
5699
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized several parts of the DOM, but this does not include the window object. Thank you
12
5562
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. Foo = function(type) { this.num = 0; this.type = type this.trigger(); } Foo.prototype.trigger = function() {
12
1834
by: TS | last post by:
If I was to have my biz layer ask the data layer to load a particular object based on key field info i pass to it, and it cannot create the object becaues it isnt' in the Db, should the data layer pass back an exception or a null reference? if an exception, i would imagine i should catch this and display a message to the user? thanks
6
10300
by: MayBoy | last post by:
Hi There I am trying to use the Goto method of the Word ActiveX object. I am trying to open a document and go to a named bookmark. If I use this code in VB it works, so I'm sure the approach is possible, I just can't get JavaScript to work with it. Here is the code I am using, the error I get from IE is Object Expected: Hope someone can help! Any help would be much appreciated
2
5747
by: thj | last post by:
Hi. I've got this form that I'm trying to validate: <form id="periodForm" action="" method="post"> <p> Periode: <input id="startDate" name="startDate" type="text" size="7" value="<%= ViewData %>" /> -
23
3155
by: tonytech08 | last post by:
What I like about the C++ object model: that the data portion of the class IS the object (dereferencing an object gets you the data of a POD object). What I don't like about the C++ object model: that most OO features are not available for class object design without loss of POD-ness. So, I'm more than leaning toward "bad" because of the limitations and
0
9777
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10763
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10473
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10518
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9307
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7737
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6939
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5614
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3954
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.