Forum Moderators: open

Message Too Old, No Replies

Javascript problem writing to a document in Netscape?

         

jflballer

1:08 am on Apr 2, 2004 (gmt 0)

10+ Year Member



Aright...first post. I'm a student at UMass tryin to get a web design company runnin this summer (see [freshed.com...] ). I made a script to cycle through a few items in an array for a portfolio page, and it works like a charm in IE. Problem is, Netscape won't even load it and I have no clue why. It seems to be a problem passing string variables in a .write command or somethin. The script is located at [freshed.com...] , and I've pasted some of it in here. I've messed around w/this for a good 2 1/2 hours, and I honestly can't figure it out:

function portfolioitem(name, description, technologies, address, screenshot)
{
this.name = name;
this.description = description;
this.technologies = technologies;
this.address = address;
this.screenshot = screenshot;
}

portfolio = new Array();

portfolio[0] = (new portfolioitem("Adams-Cheshire Regional School District", "Official website for the Adams-Cheshire Regional School District. Included are policies, applications, photos, and other information.", "HTML, JavaScript, Cascading Style Sheets", "http://www.acrsd.net", "portfolio/acrsd.gif"));
portfolio[1] = (new portfolioitem("Hoosac Valley High School", "Official website for Hoosac Valley High School, located in Cheshire, MA. Included is the student handbook, scholarship bulletins, short sports movies, and plenty of pictures to give the viewer a feel for the school.", "HTML, JavaScript, Cascading Style Sheets", "http://hvhs.acrsd.net", "portfolio/hvhs.gif"));
portfolio[2] = (new portfolioitem("Adams Memorial Middle School", "Official website for Adams Memorial Middles School. Photos, a calendar, and the complete curriculum are all located in the site. This site was done in conjunction with the rest of the schools in the Adams-Cheshire Regional School District.", "HTML, JavaScript, Cascading Style Sheets", "http://amms.acrsd.net", "portfolio/amms.gif"));
portfolio[3] = (new portfolioitem("Cheshire Elementary School", "Official website for Cheshire Elementary School. The site is integrated with a previous version of the website in order to keep the original content -- but display it in a framework uniform with the other schools in its district.", "HTML, JavaScript, Cascading Style Sheets", "http://ces.acrsd.net", "portfolio/ces.gif"));
portfolio[4] = (new portfolioitem("C.T. Plunkett Elementary School", "Official website for C.T. Plunkett Elementary School in Adams, MA. This is the last in the array of schools that comprise the Adams-Cheshire Regional School District.", "HTML, JavaScript, Cascading Style Sheets", "http://ctp.acrsd.net", "portfolio/ctp.gif"));
portfolio[5] = (new portfolioitem("Stonybrook Properties, Inc.", "Internet presence for real estate/land development company Stonybrook Properties. This website was redesigned in October of 2003. Stonybrook continually updates their property listings through a customized program created by Freshed.", "HTML, JavaScript, Cascading Style Sheets, Active-X", "http://www.stonybrookland.com", "portfolio/stonybrook.gif"));

function drawportfolio(x)
{
portfolionavstring = "<a href='portfolio.html' class='printer'>go back</a> ¦ ";
for(q=0; q<portfolio.length; q++)
{
colorstring = "";
if(x == q)
{
colorstring = "style='color: #ff0000'";
}
portfolionavstring+=("<a href='javascript:drawportfolio(" + q + ")' " + colorstring + ">" + (q+1) + "</a> ¦ ");
}
newwin = document.open("text/html");
portfoliohtml = "<html><head><title></title><script language='javascript' src='scripts/portfolio.js'></script><link rel='stylesheet' href='styles/framestyle.css' type='text/css'></head><body><center><div class='topnav'>" + portfolionavstring + "</div><br><table cellpadding='5' style='border-spacing: 0px; border-collapse: collapse; margin: 0px' width='100%'><tr><td class='screenshot' rowspan='4'><img src='" + portfolio[x].screenshot + "'></td><td style='border-top: 2px solid #cccccc; border-right: 2px solid #cccccc; font-weight: bold'>" + portfolio[x].name + "</td></tr><tr><td style='border-right: 2px solid #cccccc'><span class='label'>Web Address: </span><a href='" + portfolio[x].address + "' target='blank'>" + portfolio[x].address + "</a></td></tr><tr><td style='border-right: 2px solid #cccccc'><span class='label'>Description: </span>" + portfolio[x].description + "</td></tr><td style='border-right: 2px solid #cccccc; border-bottom: 2px solid #cccccc'><span class='label'>Technologies: </span>" + portfolio[x].technologies + "</tr></td></table></center></body></html>";
newwin.write(portfoliohtml)
newwin.close();
}

I appreciate any ideas you can come up with...thanks guys.

Rambo Tribble

2:46 am on Apr 2, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You might try using the Venkman debugger, which was included in the latest versions of Netscape or has always been in Mozilla.

jflballer

3:55 am on Apr 3, 2004 (gmt 0)

10+ Year Member



tried it...it says that "portfoliohtml is undefined," but it's obviously assigned using proper syntax.

Rambo Tribble

2:18 pm on Apr 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'll bet dollars to donuts that the problem comes from your <script> tags embedded in the character string that makes the assignment. Try breaking it up like:
"<scr"+"ipt>" and I think you'll be okay.