Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you interpret this NS6 error???

Status
Not open for further replies.

GregLanders

Programmer
Jul 9, 2001
17
US
Hello, I am doing some pretty complex array loops and passing of variables in a script that I am writing.... Works like a champ in IE, but I am getting the following error in NS6.2 and am not sure what to make of it... lib85 is the name of a function on line 64 but that is as far as my interpretation goes... Any input from you guys would greatly appreciated!

Code:
Error: uncaught exception: [Exception... "Could not convert JavaScript argument arg 0 [nsIDOMHTMLBodyElement.appendChild]"  nsresult: "0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS)"  location: "JS frame :: file:///C:/Inetpub/GREGLA~1/scripts/X12_PU~1/scripts/nsie.js :: lib85 :: line 64"  data: no]
 
The function looks like this:

Code:
function lib85(var13,var14){
    alert(var13+"--"+var14)
    var15=document.createElement("DIV");
    if(var13) var15.setAttribute("style",var13);
    if(var14) var15.innerHTML=var14;document.body.appendChild(var14);
    return var15;
}

The values that are being sent to the arguments are:

var13 =
Code:
position:absolute;overflow:hidden; clip:rect(0,0,0,0);layer-background-color:#ffffff;visibility:hidden;background-color:#ffffff; z-index:100

var14 =
Code:
<div id=&quot;divpump0_0&quot; class=&quot;clpump0&quot;><b>Fruit</b></div>
 
Really peculiar. I can't see wrong here. Try this :

function lib85()
{
alert(arguments[0], arguments[1])
}

maybe you have other variables called var13 and var14 somewhere else and there is a scope problem (this was a bug in IE4 but I didn't think I would see it in NS6).

Try renamming your arguments to something that means something :

function divCreation(style, innerHtml) Gary Haran
 
Well thanks any way....I ran an alert on that function in order to the values I posted above... I have a function and variable naming system that works really well for me...(abstraction promotes reusability)...I will keep troubleshooting...

Peace.
Greg
 
I removed everything that was unneeded. appendChild is not supported by NS4 so I removed anything that had to do with NS4. Also I made your div visible for testing purposes and found your div within a div a bit convoluted so I put a span inside. Coded with my coding convention as well cause I am so used to it.

<html>
<head>
<title>Appending to body</title>
<script>

function divCreator(style, content)
{
myDiv = document.createElement(&quot;DIV&quot;);

if(style)
{
myDiv.setAttribute(&quot;style&quot;, style);
}

myDiv.innerHTML = content || &quot;&quot;;

return document.body.appendChild(myDiv);
}

var13 = &quot;position:absolute; visibility:visible; background-color:#ffffff; z-index:100&quot;
var14 = &quot;<span id=divpump0_0 class=clpump0><b>Fruit</b></span>&quot;

</script>

</head>
<body onload=&quot;divCreator(var13, var14)&quot;>

</body>
</html>

Hope this helps. Gary Haran
 
I don't see how a name like lib85 makes the divCreator function any better.

You are free to use whatever convention you like but to many people reading divCreator(style, content) tells a whole lot more than lib85(varxx, varxxx).

If ever you have lots of code and you want to create a second function that creates divs you will probably name it the same and see that hey you already have one!

Anyways it's your code. do as you wish :) Gary Haran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top