473,748 Members | 6,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

erroe while updating XML file using ASP and javascript

1 New Member
Hi,
I need to update an XML file using ASP and javascript/vbscript.

But this is not working.It is showing the error – ‘document’ is not defined –in the line
str1=document.g etElementById(' D1').value;

Kindly someone can help me regarding this.


Here is my Code using ASP and javascript:
[Note: here I have not written the HTML in detail as there are many controls in the page.]

<% @LANGUAGE="java script" %>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Update </title>
<script language="javas cript">

<%
function update_test()

{
xmlDoc = Server.CreateOb ject("Microsoft .XMLDOM");
xmlDoc.async = false;
xmlDoc.load (Server.MapPath ("config_data.x ml"));
%>
confirm('Do you want to update this value');

str1=document.g etElementById(' D1').value;
str2=document.g etElementById(' D2').value;
str3=document.g etElementById(' T8').value;
str_script=docu ment.getElement ById('T11').val ue;
str_path=docume nt.getElementBy Id('T12').value ;
str_suit=docume nt.getElementBy Id('T13').value ;
str_dir=documen t.getElementByI d('T14').value;

x1= xmlDoc.getEleme ntsByTagName(st r1)[0].getElementsByT agName('tests') ;
for (i=0;i<x1.lengt h;i++)
{
if((x1.item(i). attributes[0].value)==str2)
{
old_value=x1.it em(i).attribute s[0].name;
x1[i].setAttribute(o ld_value,str3);
x2=x1.item(i).g etElementsByTag Name("prerequis itescript")
for (l=0;l<x2.lengt h;l++)
{
x2[l].text=str_scrip t;
}
x3=x1.item(i).g etElementsByTag Name("acbuildpa th")
if(x3[0].hasChildNodes( ))
{
x3[0].text=str_path;
}
x4=x1.item(i).g etElementsByTag Name("testsuits cript")

if(x4[0].hasChildNodes( ))
{
x4[0].text=str_suit;
}
x5=x1.item(i).g etElementsByTag Name("testdir")

if(x5[0].hasChildNodes( ))
{
x5[0].text=str_dir;
}

}
}

<%
xmlDoc.save("co nfig_data.xml") ;
%>

alert("Data Updated");
<%
}
%>

</script>
<body>
<form method="POST" action="--WEBBOT-SELF--" onSubmit="">

<img border="0" id="img6" src="images/button50.gif" height="20" width="100" alt="Update" fp-title="Update" onclick=<%updat e_test()%>></a></p>
</form>
</body>
</html>

Thanks……….
Aug 15 '09 #1
0 1728

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2116
by: billrdio | last post by:
I am trying to make a JavaScript animation of real-time images - i.e. images that will periodically change on the server. The problem I am having is that the JavaScript animation I have created is always using the images from the cache, even though I have set the HTTP response header on the server (via .htaccess) so that the browser should validate the image in the cache against the image on the server for freshness. I have tested the...
1
1152
by: TGriffith | last post by:
I have a function and OPEN.WINDOW event that occurs when the suer presses a button. I want to set a value in the New Window and upate a value on the parent form. Is this a javascript solution only? If so, does anyone have examples of updating the server side controls or an HTML (extra form)?
14
2307
by: maidane | last post by:
Hi, I got the following situation using the AC_Quicktime library. Apple recommend to use a Javascript call to generate the OBJECT tag (http://developer.apple.com/internet/ieembedprep.html). I am storing String entries representing the innerHTML of a div that I will update at runtime. As a result, some of these string entries are actually loooking like: <script language="JavaScript" type="text/javascript">
2
1546
by: Roo | last post by:
Hi - apologies for ASP newbie question. I have a form which has two fields, "details" and "score", the first of which can be edited by the user and the second of which is hidden. When "details" is updated, I need to update "score" and then call a javascript routine to do some client-side calculations using "score". I was going to use ASP to search a text file containing the corresponding values (there are thousands) of "details" and...
2
1217
by: psybert | last post by:
Ok. I'm new to the programming / developing scene. I usually teach myself what I need to learn. So anyway this is what i'm trying to accomplish. I've created a site (HTML/JavaScript) that displays different video clips, and along with each clip there can be a different text, images, links, and advertisements associated with it. I'm currently using just ordinary JavaScript arrays to store the values, file names, etc for the 100 or so video...
9
4031
by: mevryck | last post by:
Greetings I have a huge Javascript with inclusion of external scripts and all. I got this by doing a XSLT . Now I have the contents in a Javascript variable, but I'm not able to update the element with the javascript contents. But when viewed as a seperate HTML file with the below contents I'm able to see the milonic menu http://www.milonic.com . <div>
5
5353
by: rosaryshop | last post by:
I'm working a jewelry/rosary design web site at http://www.rosaryshop.com/rosariesAndKits2.php. As the user makes selections, it updates images of various parts, giving them a preview of the finished item. The preview resides within a div and is simply a series of <br>-separated images. Simple html. The system is working fine with FireFox and Safari, but some MSIE 6 and 7 users are reporting that only the first image is updating and the...
16
2980
by: Stevo | last post by:
I'm guessing this is a laughably obvious answer to many here, but it's not to me (and I don't have a server or any knowledge of PHP to be able to try it). It's not strictly a PHP question, but something that PHP guys would know the answer to. I can't think of a more appropriate forum to try. I've heard the ASP and JSP guys aren't as friendly ;-) Let's say we have a HTML page from domain example.com, and that HTML page makes a request to...
2
5717
by: =?Utf-8?B?TUNN?= | last post by:
I have an asp.net page that contains an update panel. Within the update panel, controls get added dynamically. During partial page post backs the controls within the panel will change. I have a javascript function that uses the ClientID of the dynamic controls to perform certain operations on the client-side. With each partial page post back, I dynamically recreate the javascript function using the ClientIDs of the newly added controls....
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9374
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...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
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...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4876
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3315
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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.