Javascript not working in xhtml

This is a discussion on "Javascript not working in xhtml" within the JavaScript Forum section. This forum, and the thread "Javascript not working in xhtml are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 4th, 2007, 23:24
New Member
Join Date: Aug 2007
Location: netherlands
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Javascript not working in xhtml

Hi There,

I'm new tot the board and new to javascript. I modified a "sticky menu" script, which I'm only going to use in IE (because of the lack of css fixed positioning). The script works when there is no doctype declared. However I need tot declare the doctype because I use moo.fx smoothscrolling. Does anyone understand why the below script doesn't work with xhtml transitional (or html 4, and only works in 3.2)?
Hope somebody has some time to look at it:

Thanks in advance!

Code: Select all
function setVariables(){
y1=-50;ob=1;max=20 // this max sets the distance from the top of the page

if (navigator.appName == "Netscape") {
v=".top=";h=".left=";dS="document.";sD="";
y="window.pageYOffset";x="window.pageXOffset";iW="window.innerWidth";iH="window.innerHeight"
}
else {h=".pixelLeft=";v=".pixelTop=";dS="";sD=".style";
y="document.body.scrollTop";x="document.body.scrollLeft";iW="document.body.clientWidth";iH="document.body.clientHeight"
}


object="object1";
checkLocationA()
}
movex=0,movey=0,xdiff=0,ydiff=0,ystart=0,xstart=0


function checkLocation(){
//  innerX=eval(iW)-112 // place to the right
 innerX=35 // controls the horizontal from the left side of the page

//  innerY=eval(iH)-32 // place at the bottom
  innerY=50 // controls the verticle from the top of the page
if (document.layers){innerY-=10;innerX-=10}
yy=eval(y);
xx=eval(x);
ydiff=ystart-yy;
xdiff=xstart-xx;
if ((ydiff<(-0.01))||(ydiff>(0.01))) movey=Math.round(ydiff/10),ystart-=movey
if ((xdiff<(-0.01))||(xdiff>(0.01))) movex=Math.round(xdiff/10),xstart-=movex


N=(document.layers)?1:0
V=(N) ? 4:2
if (V==4){
object="object1"
eval(dS+object+sD+v+(ystart+innerY+10));
eval(dS+object+sD+h+(xstart+innerX+10));

object="object2"
eval(dS+object+sD+v+(ystart+innerY+spread+10));
eval(dS+object+sD+h+(xstart+innerX+10));


//eval(dS + objectX + sD + v + y);
}
else{
object=document.getElementById('object1')
object.style.top=ystart+innerY
object.style.left=xstart+innerX-30

object=document.getElementById('object2')
object.style.top=ystart+innerY+spread+275
object.style.left=xstart+innerX+4

}


setTimeout("checkLocation()",10)}

function checkLocationA(){
ystart=eval(y)+2;
xstart=eval(x)+2;}
spread=40
function scrollOn(){
items=2
if (ob<=items){
objectX="object"+ob;
y1+=10;

N=(document.layers)?1:0
V=(N) ? 4:2
if (V==4){
eval(dS + objectX + sD + v + y1);}
else{
object=document.getElementById(objectX)
object.style.top=y1}


//eval(dS + objectX + sD + v + y);


	if (y1<max) xx=setTimeout ("scrollOn()",20)
	else y1=-20, max+=spread, ob+=1, xx=setTimeout("scrollOn()",20) // this max sets the spacing
	}
if (ob>2){clearTimeout(xx);checkLocation();}
}
Reply With Quote

Reply

Tags
xhtml

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Some javascript not working in Firefox jonnymorris Web Page Design 4 Sep 18th, 2007 14:02
Some javascript not working in Firefox jonnymorris JavaScript Forum 4 Sep 18th, 2007 10:47
Develope scalable Web applications using XHTML/CSS, PHP, Javascript, MySQL, Web 2.0 surfacant Job Opportunities 0 Aug 24th, 2007 21:59
javascript working fine in IE but cannot work in Firefox web20tester JavaScript Forum 0 May 21st, 2007 17:37
javascript and xhtml validation nate2099 JavaScript Forum 9 May 1st, 2007 22:34


All times are GMT. The time now is 23:57.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43