Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - javascript assistanve needed
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Topic Closedjavascript assistanve needed

 Post Reply Post Reply
Author
big9er5 View Drop Down
Newbie
Newbie
Avatar

Joined: 02 April 2008
Location: england
Status: Offline
Points: 2
Direct Link To This Post Topic: javascript assistanve needed
    Posted: 02 April 2008 at 4:16pm
hi all iam learning javascript and i have been doing so for some time but i keep having a problem with one script i have written...it all works when i take out my "displayall" option and button..but when it is there not even the select list is working, i know there are errors all over the script and it does not work 100%, but i just need help with this area, the red text is the error problem....thanks to you all in advanced...for just pointing me in the right direction
 
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Computer Upgrade Solutons</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
  function computing(id,item,desc,price,image)
  {
    this.id = id;
    this.item = item;
    this.desc = desc;
    this.price = price;
    this.image = image;
    this.displayOne = displayOne;
    this.displayall = displayall
}
 
  var computers = new Array();
computers[0] = new computing("upgrade-01","core2 duo cpu","e4500 @ 2.20GHz, 1gb RAM @2.19GHz","£110","images/comp1.jpg","images/ram1");
computers[1] = new computing("upgrade-02","core2 duo cpu","e4600 @ 2.40GHz, 2gb ddr2 RAM @2.25GHz","£125","images/comp2.jpg","images/ram2");
computers[2] = new computing("upgrade-03","amd athlon 64x2cpu","4800+ @ 2.4GHz, 1gb ram @2.19GHz","£100","images/comp3.jpg","images/ram3.jpg");
computers[3] = new computing("upgrade-04","amd athlon 64x2cpu","6000+ @ 3.5GHz, 2gb ddr2 ram @3.5GHz","£120","images/comp4.jpg","images/ram4.jpg");
 
  var len = computing.length;
  function displayOne()
  {
    content="";
    content+="<HTML><HEAD><TITLE>" + this.item + "</TITLE></HEAD>";
    content+="<BODY BGCOLOR='#FFFFCC'><DIV ALIGN='center'>";
    content+="<TABLE WIDTH='90%'><TR><TD COLSPAN='2' ALIGN='center'>";
    content+="<H3>Item: " + this.item.bold() +  "</H3><HR>";
    content+="<TR><TD><B>ID:</B> " + this.id;
    content+="<TR><TD><B>desc:</B> " + this.desc;
    content+="<TR><TD><B>Price: &pound;</B> " + this.price.bold().fontcolor("#0000FF");
    content+= "<TR><TD><IMG SRC= '" + this.image + "' HEIGHT='75' WIDTH='75'>";
    content+="</TABLE><FORM>";
    content+="<INPUT TYPE='button' VALUE='OK' onClick='window.close();'>";
    content+="</FORM></DIV></BODY></HTML>";
    oneWindow = open("","OneWindow","width=450,height=225");
    newWindow(oneWindow);
    oneWindowStatus = true;
  }
  function displayall()
  {
    content="";
    content+="<HTML><HEAD><TITLE>" All Up Grade Solutions"</TITLE></HEAD>";
    content+="<BODY><DIV ALIGN=center>";
    content+="<TABLE WIDTH='90%' BORDER CELLPADDING='2'>";
    content+="<TR><TH> COLSPAN='4' ALIGN='centre'";
    content+="All Up Grades Options";
   
 for (var i = 0; i < len; i++) {
         content+="<TR><TD>";
  content+="<A HREF='javrscript:void(window.opener.computers[" + i + "].displayOne());'>";
  content+="computers.item + "</A>";
  content+="<TD>" + computers.price;
  content+="<TD>" + computers.description;
  content+="<TD>" + computers.image;
 
  }
 content+="</TABLE><FORM>";
 content+="<INPUT TYPE='button' VALUE='OK' i onClick=window.close();'>";
 content+="</FORM></DIV></BODY></HTML>";
 fullwindow = i open("","Allwindow","width=450,height=395,resizable=1");
 newwindow(fullwindow)
  function newWindow(x)
  {
    x.document.close();
    x.document.open();
    x.document.write(content);
    x.document.close();
    x.moveTo(20,20);
    x.focus();
  }
//-->
</SCRIPT>
</HEAD>
<DIV ALIGN="center">
<H2>YOUR ONE STOP SHOP FOR COMPUTER UPGRADES</H2>
<HR>
<FORM NAME="prodForm">
<TABLE WIDTH="100%">
<TR>
<TD WIDTH="50%" ALIGN="right">
<SELECT NAME="itemName">
<SCRIPT LANGUAGE="JavaScript">
<!--
for (var i = 0; i < len; i++)
{
  document.write("<OPTION>" + computers.item);
}
//-->
</SCRIPT>
</SELECT>
<TD>
<INPUT TYPE="button" VALUE="Get Info"
onClick="
var i = document.prodForm.itemName.selectedIndex;
computers.displayOne();">
<TR><TD ALIGN="right">
<INPUT TYPE="button" VALUE="Display All"onClick=displayall("");">
</TABLE>
</FORM>
</DIV>
</BODY>
</HTML>
 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.