473,761 Members | 5,839 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot run this code


I am new to the DOM, but i try to figure out this simple tutorial on
the book, and make it extractly the same as it is written.
but when I run the program it okay, but when I click on the covert
button it says that it is output is undefined
Main File
---------------------------------------------------------------------
<html>
<head><title>
Currency Conversion
</title></head>

<FRAMESET COLS="40%,60%">
<FRAME SRC="conversion .html" NAME="conversio n">
<FRAME SRC="prices.xml " NAME="xml">
</FRAMESET>
</html>
---------------------------------------------------------------------
file:prices.xml
==============
<?xml version="1.0" ?>
<?xml-stylesheet href="prices.cs s" type="text/css"?>
<products>
<product>
<namexML editor</name>
<price45.33</price>
</product>

<product>
<name>ebook</name>
<price4.33</price>
</product>

<product>
<namejava</name>
<price145.33</price>
</product>

<product>
<namecocola</name>
<price34.3</price>
</product>
</products>
----------------------------------------------------------
file:prices.css
==============
product
{
display: block;
font-family: Palatino,Garamo nd, "Times New Roman", serif;
}

name
{
font-weight: bold;
}

---------------------------------------------------------------------
file:Conversion .html
=============== ====
<HTML><HEAD>
<TITLE>Conversi on</TITLE>
<SCRIPT LANGUAGE="JavaS cript">
function convert(form,xm ldocument)
{
var output= form.output;
rate = form.rate.value ;
output.value="" ;
var toplevel= xmldocument.doc umentElement;
searchPrice(top level,output,ra te)
}

function searchPrice(nod e,output,rate)
{
if(node.nodeTyp e==1)
{
if(node.nodeNam e == "price")
output.value +=(getText(node ) * rate) + "\r";
var children, i ;
children = node.childNodes ;
for(i=0; i < children.length ; i++)
searchPrice(chi ldren.item(i),o uput,rate);

}
}

function getText(node)
{
if(node.nodeTyp e == 1)
{
var text="",
children=node.c hilNodes, i;
for(i=0; i<children.leng th; i++)
if(children.ite m(i).nodeType== 3)
text+=children. item(i).data;

return text;
}
else
return "";
}
</SCRIPT>

</HEAD>
<BODY>
<CENTER>
<FORM ID="controls">
Rate: <INPUT TYPE="TEXT" NAME="rate" VALUE="0.9333" SIZE="4"><BR>
<INPUT TYPE="BUTTON"
ONCLICK="conver t(controls,pare nt.xml.document )" VALUE="Convert" >
<INPUT TYPE="BUTTON" VALUE="Clear" ONCLICK="output .value=''"><BR>
<TExTAREA NAME="output" ROWS="10" COLS="30"></TExTAREA>
</FORM>
</CENTER>
</BODY>
</HTML>

Aug 8 '06 #1
2 1306


tepaul wrote:
I am new to the DOM, but i try to figure out this simple tutorial on
the book, and make it extractly the same as it is written.
but when I run the program it okay, but when I click on the covert
button it says that it is output is undefined
Lots of code telling without telling us which line and which browser
yields that error.
Does the error occur here
searchPrice(chi ldren.item(i),o uput,rate);
^^^^^

That seems to be a typo, ouput instead of output.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 8 '06 #2
Sorry not clearly describe the problem
-When I try to run the code, and click the convert the alert popup say
that
in the function convert
output.value="" is undefine

thank you

Martin Honnen wrote:
tepaul wrote:
I am new to the DOM, but i try to figure out this simple tutorial on
the book, and make it extractly the same as it is written.
but when I run the program it okay, but when I click on the covert
button it says that it is output is undefined

Lots of code telling without telling us which line and which browser
yields that error.
Does the error occur here
searchPrice(chi ldren.item(i),o uput,rate);
^^^^^

That seems to be a typo, ouput instead of output.


--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 9 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
58112
by: Chris Herring | last post by:
Hi there: Well, let me start off by saying that I am a Visual Studio drag and drop weenie, not a real programmer. So I tend to get confused when things do not look like the instructions said they were going to look :) . Here is my current dilemma: I am having a strange problem with my ASP.NET application. I am building the application using Visual Basic .Net in Visual Studio.NET 2003. Lately, I have frequently been getting the following...
8
5479
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- Hello, I have a very simple problem but cannot seem to figure it out. I have a very simple php script that sends a test email to myself. When I debug it in PHP designer, it works with no problems, I get the test email. If
10
4468
by: Jean-David Beyer | last post by:
I have some programs running on Red Hat Linux 7.3 working with IBM DB2 V6.1 (with all the FixPacks) on my old machine. I have just installed IBM DB2 V8.1 on this (new) machine running Red Hat Enterplise Linux 3 ES, and applied FixPack fp5_mi00069.tar to it. After creating an instance, starting the database, creating a database, and entering the table definitions, all of which seems to work OK, I entered a tiny 8-row table and can do...
1
3126
by: Thomas Barnet-Lamb | last post by:
I was wondering if anyone could give me some help with the following. Consider the code snippet: struct qqq{typedef qqq* pointer;}; template<class al> struct foo : public al { template <class T> struct rebind { typedef foo<qqq> other;
5
5139
by: Nathan Sokalski | last post by:
When running a page I am working on, I recieve the following error: Cannot use a leading .. to exit above the top directory. I suspect this has something to do with the problem I posted in a recent posting "HyperLink.NavigateUrl always adds an extra ../ when going to a higher level directory" on Sunday, May 29, 2005 7:33 PM However, I cannot be sure because I cannot view the generated code since it gives the error before anything is...
1
6631
by: Peter | last post by:
I've purchased VS.NET 2005 Standard and have tried to install SQL Server 2005 Express, but get the following error in the error log. Please could someone help me.... Microsoft SQL Server 2005 Express Edition x86: Component Microsoft SQL Server 2005 Express Edition x86 returned an unexpected value. ***EndOfSession***? Microsoft SQL Server 2005 Express Edition x86: Component Microsoft SQL Server 2005 Express Edition x86 returned an...
2
7039
by: mudge | last post by:
Hi, I'm getting some very strange problems with some C# code. We're running an ASP.NET application on a local server in a DMZ. If I access it using the internal address, the application works fine, every time. But, if I access on it's public IP, from my office workstation, from home, over the VPN, a test machine on ADSL, or whatever else you please, it fails. But only about 60% of the time. I have tried everything to pin this down....
4
8282
by: sirjohnofthewest | last post by:
If I possessed the power to sway the mind of every user in the world to delete all forms of Internet Explorer I would die a happy man. Hi guys, I frequently visit this site to get answers to my problems and this one is really getting to me... I have a page that allows you to Browse Authors. There are three drop down boxes that auto-populate via AJAX. I have a file which it calls and returns the dynamically built XML file in the boxes...
3
17126
by: amanjsingh | last post by:
Hi, I am trying to implement Java Web Service using Apache Axis2 and Eclipse as a tool. I have created the basic code and deployed the service using various eclipse plugin but when I try to invoke the service using client stub, I get this error... Exception in thread "main" java.lang.Error: Unresolved compilation problems: org.apache cannot be resolved to a type org.apache cannot be resolved to a type org.apache cannot be resolved to a...
4
2407
by: dougmeece | last post by:
Morning Everyone... I have a table that needs to be append to and also updated. All the fields in the table are populated with data from the text boxes and combo boxes on a form. The Date Submitted defaults to 1/1/00 if the cboSubmittedBox field is "No". Otherwise it is selected from a calendar. The Date Entered field defaults to the current date. There are 3 sets of criteria that need to be checked for the update or append to take place. ...
0
9377
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10136
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9989
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8814
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2788
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.