help required to debug the java script errors in the webpage

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

help required to debug the java script errors in the webpage

Postby rakeshkv » Mon 20 Nov, 2006 5:25 pm

hi
this is the webpage i am currently working on. there are java script errors listing that ther no properties for menuitem1.
i really dont understand what it means
here id the website address

http://www2.fac.ilstu.edu/campusservices/index.shtml
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8
rakeshkv
new member
new member
 
Posts: 3
Joined: Mon 20 Nov, 2006 5:20 pm

Postby Antony » Mon 20 Nov, 2006 10:49 pm

I can't see any error from Safari.

However, one of the image is linked to your local file
Code: Select all
<img alt="" src="file:///Y|/My%20Documents/www.fac.ilstu.edu/css/glbnav_right.gif" height="32" width="4" id="gnr" />

Please upload the image file and change the code.
UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby rakeshkv » Tue 21 Nov, 2006 1:49 pm

but when i see it in mozilla fireofx i see java script errors.
i have webdeveloper addon to my firefox. it shows if there are any errors.
if you open my webpage there is a loink called RECYCLING MAP if you click on hte pictures a new browser window should open .it is a image map. it works fine in firefox but it doesnot in IE 6

please help me
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8
rakeshkv
new member
new member
 
Posts: 3
Joined: Mon 20 Nov, 2006 5:20 pm

Postby Antony » Tue 21 Nov, 2006 11:47 pm

rakeshkv wrote:but when i see it in mozilla fireofx i see java script errors.
i have webdeveloper addon to my firefox. it shows if there are any errors.
if you open my webpage there is a loink called RECYCLING MAP if you click on hte pictures a new browser window should open .it is a image map. it works fine in firefox but it doesnot in IE 6

please help me
Yes, I clicked the Recycling Map (with Firefox), and when I click the image map of that, I got new windows showing pictures. No JavaScript errors.

Exactly what was the error message you see in Firefox?

Also tested in Safari, no problems either.
UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Antony » Sun 26 Nov, 2006 2:17 am

In PM,
rakeshkv wrote:the recycling map is fixed
but not the java script errors
if you can look in to the code
the error is
menuitem1.div doesnot have any properties
i dont understand that
thats the error which is really bothering me
i dont know javascript
can you plese look in to the code
UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1) Gecko/20061010 Firefox/2.0
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby Antony » Sun 26 Nov, 2006 2:31 am

Hmm, I guess the problem starts with
[tt]<body onmousemove="closesubnav(event);">[/tt]
Try change that with [tt]<body>[/tt] (i.e. remove [tt]onmousemove="closesubnav(event);"[/tt] all together, and be careful when calling JavaScript.

Sorry, this only a very quick fix.
UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9 (KHTML, like Gecko) Safari/419.3
User avatar
Antony
diamond member
diamond member
 
Posts: 14509
Joined: Tue 18 Jun, 2002 11:36 pm
Location: Sydney, Australia

Postby rakeshkv » Tue 28 Nov, 2006 3:04 pm

Antony wrote:Hmm, I guess the problem starts with
[tt]<body onmousemove="closesubnav(event);">[/tt]
Try change that with [tt]<body>[/tt] (i.e. remove [tt]onmousemove="closesubnav(event);"[/tt] all together, and be careful when calling JavaScript.

Sorry, this only a very quick fix.

[FONT="Arial Narrow"][SIZE="2"][SIZE="6"][FONT="Arial"][FONT="Century Gothic"]thanks for replying


here is the actual java script code for the dreamweaver left halo template which i used to build my website. i have deleted subglobal links in my website which i dont want. i need to delete such a way so that i wont ask for subglobal. that is wat my prblem is

<script type="text/javascript">
<!--
var time = 3000;
var numofitems = 7;

//menu constructor
function menu(allitems,thisitem,startstate){
callname= "gl"+thisitem;
divname="subglobal"+thisitem;
this.numberofmenuitems = 7;
this.caller = document.getElementById(callname);
this.thediv = document.getElementById(divname);
this.thediv.style.visibility = startstate;
}

//menu methods
function ehandler(event,theobj){
for (var i=1; i<= theobj.numberofmenuitems; i++){
var shutdiv =eval( "menuitem"+i+".thediv");
shutdiv.style.visibility="hidden";
}
theobj.thediv.style.visibility="visible";
}

function closesubnav(event){
if ((event.clientY <48)||(event.clientY > 107)){
for (var i=1; i<= numofitems; i++){
var shutdiv =eval('menuitem'+i+'.thediv');
shutdiv.style.visibility='hidden';
}
}
}
// -->
</script>
</head>
<body onmousemove="closesubnav(event);">
<div class="skipLinks">skip to: <a href="#content">page content</a> | <a href="pageNav">links on this page</a> | <a href="#globalNav">site navigation</a> | <a href="#siteInfo">footer (site information)</a> </div>
<div id="masthead">
<h1 id="siteName">Site Name</h1>
<div id="utility">
<a href="#">Utility Link</a> | <a href="#">Utility Link</a> | <a href="#">Utility
Link</a>
</div>
<div id="globalNav">
<img alt="" src="gblnav_left.gif" height="32" width="4" id="gnl"> <img alt="" src="glbnav_right.gif" height="32" width="4" id="gnr">
<div id="globalLink">
<a href="#" id="gl1" class="glink" onmouseover="ehandler(event,menuitem1);">global
link</a><a href="#" id="gl2" class="glink" onmouseover="ehandler(event,menuitem2);">global
link</a><a href="#" id="gl3" class="glink" onmouseover="ehandler(event,menuitem3);">global
link</a><a href="#" id="gl4" class="glink" onmouseover="ehandler(event,menuitem4);">global
link</a><a href="#" id="gl5" class="glink" onmouseover="ehandler(event,menuitem5);">global
link</a><a href="#" id="gl6" class="glink" onmouseover="ehandler(event,menuitem6);">global
link</a><a href="#" id="gl7" class="glink" onmouseover="ehandler(event,menuitem7);">global
link</a>
</div>
<!--end globalLinks-->

</div>
<!-- end globalNav -->
<div id="subglobal1" class="subglobalNav">
<a href="#">subglobal1 link</a> | <a href="#">subglobal1 link</a> | <a href="#">subglobal1
link</a> | <a href="#">subglobal1 link</a> | <a href="#">subglobal1 link</a> | <a href="#">subglobal1
link</a> | <a href="#">subglobal1 link</a>
</div>
<div id="subglobal2" class="subglobalNav">
<a href="#">subglobal2 link</a> | <a href="#">subglobal2 link</a> | <a href="#">subglobal2
link</a> | <a href="#">subglobal2 link</a> | <a href="#">subglobal2 link</a> | <a href="#">subglobal2
link</a> | <a href="#">subglobal2 link</a>
</div>
<div id="subglobal3" class="subglobalNav">
<a href="#">subglobal3 link</a> | <a href="#">subglobal3 link</a> | <a href="#">subglobal3
link</a> | <a href="#">subglobal3 link</a> | <a href="#">subglobal3 link</a> | <a href="#">subglobal3
link</a> | <a href="#">subglobal3 link</a>
</div>
<div id="subglobal4" class="subglobalNav">
<a href="#">subglobal4 link</a> | <a href="#">subglobal4 link</a> | <a href="#">subglobal4
link</a> | <a href="#">subglobal4 link</a> | <a href="#">subglobal4 link</a> | <a href="#">subglobal4
link</a> | <a href="#">subglobal4 link</a>
</div>
<div id="subglobal5" class="subglobalNav">
<a href="#">subglobal5 link</a> | <a href="#">subglobal5 link</a> | <a href="#">subglobal5
link</a> | <a href="#">subglobal5 link</a> | <a href="#">subglobal5 link</a> | <a href="#">subglobal5
link</a> | <a href="#">subglobal5 link</a>
</div>
<div id="subglobal6" class="subglobalNav">
<a href="#">subglobal6 link</a> | <a href="#">subglobal6 link</a> | <a href="#">subglobal6
link</a> | <a href="#">subglobal6 link</a> | <a href="#">subglobal6 link</a> | <a href="#">subglobal6
link</a> | <a href="#">subglobal6 link</a>
</div>
<div id="subglobal7" class="subglobalNav">
<a href="#">subglobal7 link</a> | <a href="#">subglobal7 link</a> | <a href="#">subglobal7
link</a> | <a href="#">subglobal7 link</a> | <a href="#">subglobal7 link</a> | <a href="#">subglobal7
link</a> | <a href="#">subglobal7 link</a>
</div>
<div id="subglobal8" class="subglobalNav">
<a href="#">subglobal8 link</a> | <a href="#">subglobal8 link</a> | <a href="#">subglobal8
link</a> | <a href="#">subglobal8 link</a> | <a href="#">subglobal8 link</a> | <a href="#">subglobal8
link</a> | <a href="#">subglobal8 link</a>
</div>
</div>
<!-- end masthead -->

<script type="text/javascript">
<!--
var menuitem1 = new menu(7,1,"hidden");
var menuitem2 = new menu(7,2,"hidden");
var menuitem3 = new menu(7,3,"hidden");
var menuitem4 = new menu(7,4,"hidden");
var menuitem5 = new menu(7,5,"hidden");
var menuitem6 = new menu(7,6,"hidden");
var menuitem7 = new menu(7,7,"hidden");
// -->
</script>




url -

www2.fac.ilstu.edu/campusservices/index.shtml[/FONT][/FONT][/SIZE][/SIZE][/FONT]
UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8
rakeshkv
new member
new member
 
Posts: 3
Joined: Mon 20 Nov, 2006 5:20 pm


Return to Web Design and Page Coding

Who is online

Registered users: Google [Bot]