• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Problem using document. getElementById(). style;

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I try to use a script a friend gave me and I have the following error message while clicking on the link who opens the popup :
skin has no properties

Error is pointing to the code: skin.width=popwidth;

no idea on what the problem can be ... seems that style property is not correct but seems to be ok according to the doc I found.

Any idea is welcome

html code from jsp page :
<html>
<head>
<SCRIPT LANGUAGE="JavaScript" SRC="popup.js"></SCRIPT>
</head>
<body>
<div id='pup'></div>
<a href="javascript opitup('toto','white')">
</body>
</html>


popup.js :

var popwidth = 400; // popup width
var skin=document.getElementById("pup").style;
...
function popitup(omsg,bak) {
...
skin.width=popwidth;
...
}
 
Christophe Basse
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
of course I did not put any smiley inside my code

you should read javascript: popitup (whitout the blank space)
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think you need to place this line inside of your function: var skin=document.getElementById("pup").style;

do an alert(skin) and see what it says.

Eric
 
Christophe Basse
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I tried and I have the following error instead :
skin is null or not an object

In fact I'm doing that :
if(nav) skin=document.pup;
if(iex) skin=pup.style;
if(n_6) skin=document.getElementById("pup").style;

But it seems not to be working with ie6 and mozilla firefox.

Maybe you know a different way to retrieve this style in order to do the following afterwards :
skin.top
skin.left
skin.visibility
. . .
 
Christophe Basse
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
before the ifs I do that :
var iex=(document.all);
var nav=(document.layers);
var old=(navigator.appName=="Netscape" && !document.layers && !document.getElementById);
var n_6=(window.sidebar);
 
Christophe Basse
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your help but I found another script doing the same thing with same method calls which is working so .....
 
Don't get me started about those stupid light bulbs.
    Bookmark Topic Watch Topic
  • New Topic