473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Object Expected, need help

23
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 1962
dmjpro
2,476 2GB
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 100+
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 2GB
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
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 2GB
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.height" and "style.width".

Debasis Jana
Oct 10 '07 #6
Z1P2
23
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.zoom, but it should work the same).
Oct 10 '07 #7
dmjpro
2,476 2GB
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
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
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...
54
by: tshad | last post by:
I have a function: function SalaryDisplay(me) { var salaryMinLabel = document.getElementById("SalaryMin"); salaryMinLabel.value = 200; alert("after setting salaryMinLabel = " +...
30
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 =...
1
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",...
26
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...
12
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. ...
12
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...
6
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...
2
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="<%=...
23
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...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.