473,772 Members | 2,349 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Passing xml element data to a javascript/asp variable

2 New Member
I have, what I believe, is a rather simple question. However, I cannot find the answer anywhere on the web nor in any of the library of xml or javascript/asp books available. How do I pass and store an xml element data (an interger) into a javascript/asp variable? I am not going to display the data (that I can do easily), rather the data is going to used to deteremine how the rest of the parent data is going to be displayed in any of 90 different places on the screen. It will determine not only the where but the size and the order of the display.
Aug 19 '07 #1
3 5590
vituko
48 New Member
1- XMLHttpRequest -> responseXML :

dom

var = node.firstChild .data ;

node : you can access it by id or tagName : getElementById / getElementsByTa gName (returns array).
firstChild or childNodes [i] : the textNode you are looking for

2- XMLHttpRequest -> responseText + regular expressions
Aug 20 '07 #2
TheLymner
2 New Member
"That was easy" I found a simple solution shortly after posting the request.

<xsl:template name="TEST" match="rack"> [place in head]

<script type="text/JavaScript">
var units='<xsl:val ue-of select="./slots"/>' [Stores the value of the element
/slots/ into js variable "units"]

var pxs=units * 30 [times the value of units by 30 and store it in variable "pxs"]

var nameNode='<xsl: value-of select="./hostName"/>' [Store the value of /hostName/ into js variable "nodeName"]

document.write ('<div class="host" style="position :absolute; z-index:42; top:0px; left:0px; width:200px; height:'+pxs+'p x">'+nameNode+' </div>')
[Write the div and the variables]
</script>


TheLymner
Aug 20 '07 #3
vituko
48 New Member
Cool, I've never worked with xsl. Interesting approach.
Aug 20 '07 #4

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

Similar topics

4
3483
by: Andy R. | last post by:
Hello everyone, I've spent quite some time now, looking for some information on how to get this done, sadly none has helped me much, though. I have a bit of java scrpt on a webpage (.php) to aquire the screen resolution of the visiting user. Now I need to pass the java variable to another variable on the same document. I have a feeling, this will not be easy - as java is client- and php server-sided. Now, if my assumption is corect,...
12
6558
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
58
10181
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of code... TCHAR myArray; DoStuff(myArray);
9
2171
by: Max | last post by:
I'm new with Javascript and can't seem to figure out what I'm doing wrong here as I'm not able to pass a simple variable to a function. In the head of doc I have: <script type="text/javascript"> function radioenable(value) { document.forms.search.elements.value.disabled=false;
11
8131
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line number) which is the last line of the following sub routine: ' procedure modifies elements of array and assigns ' new reference (note ByVal) Sub FirstDouble(ByVal array As Integer()) Dim i As Integer
3
3456
by: michael | last post by:
let me keep it clean, quick and simple. I am passing a variable into another window and am reassigning the value on the new page - window.document...value = opener.document. ....value and am wanting to then use this value within an element of a form on the current page -
3
6795
by: stahl.karl | last post by:
I have a CGI/Perl program that returns a string output. Is it possible to get this into a Javascript variable, where the name of the variable is defined in the Javascript and not in the Perl code? For example, it seems that the following should work, but it doesn't appear to. Is this valid code? CGI code --- get_string.pl ------ print "Content-type: text/plain\n\n";
5
5020
by: sfeher | last post by:
Hi All, I need to call a function(loaded with appendChild) for which I have the name as a string. .... var fnName = 'fn1'; var call = fnName + '('+ param +' )'; eval(call);
3
1663
by: carllucas | last post by:
I'm having issues trying to pass a variable basically I get information from an external xml document like this function run(file) { t = file.getElementsByTagName("category"); for(i=0; i<t.length; i++) { element = file.getElementsByTagName("category").childNodes.nodeValue;
0
9621
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
9454
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
10264
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
9914
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...
1
7461
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
6716
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
5355
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...
2
3610
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2851
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.