Click to See Complete Forum and Search --> : Message box & JavaScript Error in IE


ammwebmaster2
04-27-2005, 02:17 PM
I am using a script for a link description box and the message box shows up in IE fine but in Mozilla only part of the text shows up. In IE the box is yellow in Mozilla the box is white. I have tried to increase the box size but it will not change in Mozilla. Also I am getting a JavaScript "Object not specified" Please help!!! I have tried script after script after script to find one that works in both IE and Mozilla and I am going crazy trying to figure this out. I am new to JavaScript so I don't know what to do to make it work. Any help would be much appreciated. The code is following:

Thanks,

This is the Script in the Head:

<style type="text/css">
<!--

a.ln
{
font-family: "Times New Roman";
font-size: 11pt;
color: #006699;
}

a.ln:hover
{
font-family: "Times New Roman";
font-size: 11pt;
color: #6699CC;
}

span.txt
{
font-family: "Times New Roman";
font-size: 12pt;
color: #6699CC;
}

.box
{
border: solid 1px #000000;
height: 300;
width: 400;
color: #FFFFCC;
}

-->
</style>



<script language="javascript" type="text/javascript">
/*****************************************************
THIS FUNCTION WILL GENERATE THE PREVIEW. IT TAKES 5
ARGUMENTS. THE FIRST ARGUMENT IS REQUIRED. OTHERS ARE
OPTIONAL.
******************************************************/
function showPreview(url, border, width, height, desc)
{

border = typeof(border) == "defined" ? 0 : border;
width = typeof(width) == "defined" ? 400 : width;
height = typeof(height) == "defined" ? 300 : height;
desc = typeof(desc) == "defined" ? "" : desc;

document.getElementById("sp").innerHTML = '<url + '" border="' + border + '" width="' + width + '" height="' + height '">' + desc;

}
/***************************************************
THIS FUNCTION WILL CLEAR THE GENERATED PREVIEW. IT
DOES NOT TAKE ANY ARGUMENTS.
****************************************************/
function clearPreview()
{

document.getElementById("sp").innerHTML = "Move you mouse over a link to generate a preview.";

}


//-->
</script>



This Script is in the Body:

<!-- CALLING THE imgPreview() FUNCTION WITH ALL PARAMETERS -->
<center>

<p><span id="sp" class="txt"><font size="4">Move you mouse over a link to generate a preview.</font></span></p>
<p>
<a href="http://home.amm.org/ecard/default.asp" onMouseOver='showPreview("Choose from several designs, including a card to send to someone in the military, each with a spiritual greeting, and space to add your own message.", 0, 400, 300, "Choose from several designs, including a card to send to someone in the military, each with a spiritual greeting, and space to add your own message.");' onMouseOut="clearPreview();" class="ln" title="Choose from several designs, including a card to send to someone in the military, each with a spiritual greeting, and space to add your own message.">Send an e-card to brighten up someone's day</a>

<a href="http://home.amm.org/submissions/tribute" onMouseOver='showPreview("Honor or commemorate that special person in your life with a Tribute Gift to our Lady’s Association. You and your loved one will share in the prayers of the Vincentian community.", 0, 400, 300, "Honor or commemorate that special person in your life with a Tribute Gift to our Lady’s Association. You and your loved one will share in the prayers of the Vincentian community.");' onMouseOut="clearPreview();" class="ln" title="Honor or commemorate that special person in your life with a Tribute Gift to our Lady’s Association. You and your loved one will share in the prayers of the Vincentian community."><br>
Remember Someone with a Tribute Gift</a>

Ultimater
04-27-2005, 02:34 PM
I see errors eveywhere!.... aaaaaah! :eek:
Let me just point-out several code segments and you can appy the same to all similar errors.




border = typeof(border) == "defined" ? 0 : border;

typeof is not a function but rather an opperator.
There is no type that is called "defined" but there is one called "undefined"
You'd best turn this arround:

border = (typeof border == "undefined") ? border : 0 ;





document.getElementById("sp").innerHTML = '<url + '" border="' + border + '" width="' + width + '" height="' + height '">' + desc;

Do you know of any tags called url?



I'll let you know if I notice any more errors.

ammwebmaster2
04-27-2005, 02:54 PM
I figured that the url they are referring to is bringing in the (a href=") like I said I am new to JavaScript so am just trying to get through this.

I made the corrections that you suggested. Still receiving the Object expected error in IE and no change in Mozilla. Mozilla's text stops at ea...

Ultimater
04-27-2005, 03:41 PM
document.getElementById("sp").innerHTML = '<url + '" border="' + border + '" width="' + width + '" height="' + height + '">' + desc;

There are just too many errors everywhere!

Here, have mercy on me for not explaining each and every error and just download this:
(attachment)
Also, rename it to something like myName.html