javascript library i made does not work

enox10mx

New Member
Messages
29
Reaction score
0
Points
0
Hello.
I have made a javascript library called enolib.js
here is the code:
Code:
/*------------------------------------------------------
ENO javascript library
Version 1.0
(c) HTMLGUY999
All Rights Reserved
For documentation place the eno.doc(); function on your page to write a link to the documentation.
*/
//start code:
/*
places a link to the ENO documentation on the page
*/
function eno.doc()
{
document.write('<br /> <a href="http://enoservices.zxq.net/enolib/doc.html" target="_blank">ENOLIB documentation</a>');
document.write('<br />');
}
/*
Writes the version info for enolib to the page.
*/
function eno.version()
{
document.write('<br /> <a href="http://enoservices.zxq.net/enolib">ENOLIB</a><br />');
document.write('Version:1.0');
document.write('<br />');
document.write('<a href="http://enoservices.zxq.net/enolib/bugs">Bugs</a> <br />');
document.write('Made by:HTMLguy999 <br />');
document.write('(c)');
document.write(' HTMLguy999 <br />');
document.write('All rights reserved.<br />');
}
/*
writes up to four lines of text on the screen
*/
function doc.write(line1,line2,line3,line4)
{
if(line1 = null)
{
document.write('ENOLIB ERROR: doc.write must have at least 1 argument!<br />');
}
else
{
document.write('<br />');
document.write(line1);
}
if(line2 = null)
{
document.write('<br />')
}
else
{
document.write('<br />');
document.write(line2);
}
if(line3 = null)
{
document.write('<br />');
}
else
{
document.write('<br />');
document.write(line3);
}
if(line4 = null)
{
document.write('<br />');
}
else
{
document.write('<br />');
document.write(line4);
document.write('<br />');
}
}

I am testing all the functions on another html doc:
HTML:
<script type="text/javascript" language="javascript" src="enolib.js"></script><script type="text/javascript" language="javascript">eno.version();eno.doc();doc.write('testing','multi','line','writing');</script>
When i view the HTML page, it is blank.
May somebody help me!
 

essellar

Community Advocate
Community Support
Messages
3,295
Reaction score
227
Points
63
1) The variable doc is neither declared nor set anywhere; it does not, therefore, have a write() method.

2) All of your equality checks are actually assigning null to the variables they are testing. Use an existence check instead; nulls are "falsy", so if(!someValue){...}.

3) Nobody in his or her right mind is going to use a library that prints a huge "I used this library" notification on the web page. A copyright notice in the source is enough.

4) There are very few excuses for using document.write() anymore, and this is certainly not an example of one of them.

I'd like to help further, but this is copyright code for which I haven't been granted an explicit license to create derivative works ("All rights reserved" means I can't touch it).
 
Top