PDA

View Full Version : Javascript and NIS 2007 issues?



crypto99
Feb 16th, 2007, 04:37 PM
I have a simple HTML page that calls a .js file. This runs with no problem on my laptop but has issues on my desktop PC. My desktop has Norton Internet Security 2007. I have read that NIS may have ad blocking quirks that alter javascript code. I do not see any undesired code in my HTML page when I right-click and "View Source". The script works fine if I include it directly in the HTML file.

Here is the .js code


function greetGuest()
{
alert("Welcome to the JavaScript development site");
}


function getName(ctrl)
{
var guestName = prompt("Please enter your name. "); //get the guest's name
document.getElementById(ctrl).value = guestName; //transfer guest name to txt1
}


function changeBackground(ctrl)
{
var select = document.getElementById(ctrl);
var index = select.selectedIndex;
var selectedTxt = select.options[index].text;
var selectedVal = select.options[index].value;
var msg = "The " + (index+1) + " option is selected. \n";
msg += "It is the option " + selectedTxt;
msg += " and has the value " + selectedVal + ".";
msg += " Is this correct?";
var confirmVal = confirm(msg);
if (confirmVal == true)
{
switch(selectedVal)
{
case "black":
document.body.text="white";
document.body.bgColor=selectedVal;
break;
case "white":
document.body.text="black";
document.body.bgColor=selectedVal;
break;
default:
document.body.text="black";
document.body.bgColor=selectedVal;
break;
}
}
}




Here is the HTML page.



<!--

<html>

<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Test Page 1</title>
<script type="text/javascript" src="testScript.js"></script>


</head>

<body onload="greetGuest();">


<p>
<input type="button" name="btn1" value="Press me greeting" onclick="getName('nameBox');" />
<input type="text" name="nameBox" id = "nameBox" value=" " size="30" /> </p>
<center>
<p>Select a background color</p>
<p><select name="selectColors" id = "selectColors" onChange="changeBackground('selectColors');">
<font color="aqua">
<option value="aqua">AQUA</font></option>
<font color="black">
<option value="black">BLACK</font></option>
<font color="blue">
<option value="blue">BLUE</font></option>
<font color="fuschia">
<option value="fuschia">FUSCHIA</font></option>
<font color="gray">
<option value="gray">GRAY</font></option>
<font color="green">
<option value="green">GREEN</font></option>
<font color="lime">
<option value="lime">LIME</font></option>
<font color="maroon">
<option value="maroon">MAROON</font></option>
<font color="navy">
<option value="navy">NAVY</font></option>
<font color="olive">
<option value="olive">OLIVE</font></option>
<font color="purple">
<option value="purple">PURPLE</font></option>
<font color="red">
<option value="red"></font>RED</option>
<font color="light blue">
<option value="silver">SILVER</font></option>
<font color="light blue">
<option value="teal">TEAL</font></option>
<font color="light blue">
<option value="white"></font>WHITE</option>
<font color="light blue">
<option value="yellow">YELLOW</font></option>
</select></p>
</center>


</body>

</html>

-->


I hope this doesn't come out looking funny. My question is, does anyone know what could cause this phenomenon?

Again. On the laptop it works either in script or as a src file. On desktop it only works in script tags.

Any help is appreciated.

Thanks:confused:

crypto99
Feb 16th, 2007, 04:39 PM
Above, I put HTML comments in because I was not sure how it would be handled. these do not exist in the orinal html file.
:)