473,386 Members | 1,715 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,386 software developers and data experts.

IE: "Expected Identifier" error :(

Hi Everyone,
Here is a part of javascript code that works well in FF2 but shows
above error in IE6 and error "missing name after . operator" in NS8
Expand|Select|Wrap|Line Numbers
  1. function PopUp(idf,stepX,stepY,speed){
  2.  
  3.  
  4.  
  5. this.idf=idf;
  6.  
  7. this.popXStep=stepX;
  8.  
  9. this.popYStep=stepY;
  10.  
  11. this.popSpeed=speed;
  12.  
  13. this.popLeft=0;
  14.  
  15. this.popTop=0;
  16.  
  17. };
  18.  
  19. PopUp.prototype.relocX=function() {
  20.  
  21. if(xon==0){this.popLeft=this.popLeft-this.popXStep;}
  22.  
  23. else{this.popLeft=this.popLeft+this.popXStep;}
  24.  
  25.  
  26.  
  27. if(this.popLeft<0){xon=1;this.popLeft=0;}
  28.  
  29. if(this.popLeft>=(chX-ohX)){xon=0;this.popLeft=(chX-ohX);}
  30.  
  31. if(ie){
  32.  
  33. window.alert("here!");
  34.  
  35. this.idf.style.left=this.popLeft
  36. +document.body.scrollLeft;
  37.  
  38. this.idf.style.top=this.popTop;
  39.  
  40. }
  41.  
  42. else if (ns4){
  43.  
  44. document.(this.idf).pageX=this.popLeft
  45. +window.pageXOffset;
  46.  
  47. document.(this.idf).pageY=this.popTop;
  48.  
  49. }
  50.  
  51. else if (ns6){
  52.  
  53. document.getElementById(this.idf).style.left=this.
  54. popLeft+window.pageXOffset
  55.  
  56. document.getElementById(this.idf).style.top=this.p
  57. opTop
  58. }
  59.  
  60.  
  61. };
  62.  
  63.  

Here is the error copied from NS JS Console:
Error: missing name after . operator
Source File: file:///C:/templates/test.html
Line: 105, Column: 17
Source Code:
document.(this.idf).pageX=this.popLeft+window.page XOffset;
Well it's not because of a reserved word use. Its an addition in my
project,
I am generating a no. of pop ups on one page. Deadline is in 10 hrs!
Can someone please help?

May 29 '07 #1
3 7310
ASM
ha**************@gmail.com a écrit :
Hi Everyone,
Here is a part of javascript code that works well in FF2 but shows
above error in IE6 and error "missing name after . operator" in NS8
[code]
if(ie){

window.alert("here!");

this.idf.style.left=this.popLeft
+document.body.scrollLeft;
perhaps :
document.all[this.idf].style.left = ...
>
this.idf.style.top=this.popTop;

}

else if (ns4){

document.(this.idf).pageX=this.popLeft
+window.pageXOffset;
perhaps :
document.layers[this.idf].pageX = ...
or :
document.this.idf.pageX = ...
>
document.(this.idf).pageY=this.popTop;

}


--
Stephane Moriaux et son (moins) vieux Mac déjà dépassé
Stephane Moriaux and his (less) old Mac already out of date
May 29 '07 #2
On May 29, 12:17 pm, harshadanarve...@gmail.com wrote:
Hi Everyone,
Here is a part of javascript code that works well in FF2 but shows
above error in IE6 and error "missing name after . operator" in NS8

[code]
function PopUp(idf,stepX,stepY,speed){

this.idf=idf;
What is idf? Is it an ID or a reference to a DOM element? Given the
issues you have later, why not resolve it right here and make it a
reference to a DOM element? The best way to do that depends on how
you are calling PopUp().

this.popXStep=stepX;
this.popYStep=stepY;
this.popSpeed=speed;
this.popLeft=0;
this.popTop=0;
};
PopUp.prototype.relocX=function() {
if(xon==0){this.popLeft=this.popLeft-this.popXStep;}
What is xon? Consider:

if ( !xon ){ this.popLeft -= this.popXStep;}

else{this.popLeft=this.popLeft+this.popXStep;}
if(this.popLeft<0){xon=1;this.popLeft=0;}
if(this.popLeft>=(chX-ohX)){xon=0;this.popLeft=(chX-ohX);}
if(ie){
Browser sniffing is *never* a good idea. Use feature detection.

window.alert("here!");
this.idf.style.left=this.popLeft
Presumably this.idf is an ID (a string) that you are expecting to be
resolved to a DOM object reference. Strings don't have a style
property (unless you've extended the built-in String object). A much
more sensible idea is to use feature detection along the lines of:

var domElement;
if (document.getElementById) {
domElement = document.getElementById(this.idf);
} else if (document.all){
domElement = document.all[this.idf];
} else if (document.layers){
domElement = document.layers[this.idf];
}

or similar strategy. You might create your own 'getElement' function
that is initialised onload and subsequently uses the appropriate
method.

Learn to use and deploy feature detection, it will save you many hours
of frustration. There is an example you might find useful here:

<URL: http://www.jibbering.com/faq/faq_notes/alt_dynwrite.html >
--
Rob

May 29 '07 #3
On May 28, 8:17 pm, harshadanarve...@gmail.com wrote:
Hi Everyone,
Here is a part of javascript code that works well in FF2 but shows
above error in IE6 and error "missing name after . operator" in NS8
replace all "document.(this.idf)" with "document[this.idf]"

May 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Rick | last post by:
I wrote the following code as part of a page where users can reorder a list of items by highlighting an item in a list box and clicking an "up" or "down" button to move the items around. The code...
2
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
6
by: craigbeanhead | last post by:
Hi, I'm teaching myself C from K&R2. I've come across something that I really don't understand. When I try to compile the following code (in VC++7), I get an "undeclared identifier" error. When...
3
by: rdi | last post by:
The import statements weren't copy/pasted, but everything INSIDE the class WAS copy pasted from the help file. Starting with the myMail.From line and going down to the SmtpMail.Send line, EVERY line...
3
by: Jon | last post by:
I'm learning about datatables. When using the example provided by MS in the ..NET Framework Class Library for DATATABLE (see below) I get an error on line 3 that says "Type expected". Is something...
8
by: trappedIntoCode | last post by:
Hi Everyone, Here is a part of javascript code that works well in FF2 but shows above error in IE6 and error "missing name after . operator" . function...
1
by: mknoll217 | last post by:
I am recieving this error from my code: The multi-part identifier "PAR.UniqueID" could not be bound. The multi-part identifier "Salary.UniqueID" could not be bound. The multi-part identifier...
2
by: jman | last post by:
i'm getting an "object expected" error in ie - not ff. in the BODY onload attribute i call a function that's loaded from an external file. i've narrowed the error down to the fact it cannot...
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="<%=...
9
by: Rohit | last post by:
I am trying to initialize an array whose initializers depend on value of Enums. I take enum and then decide the initializer value, so that even if enum value changes because of addition to list...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.