How To Read Dynamically Generated XML With Javascript And ActiveX XMLHTTP Object?

Jul 23, 2005

Ive been banging my head on the wall for hours with this one, hopefully
someone will know what Im doing wrong here :

The Goal:

I have an xml file that is generated on the fly via JSP which I want to
load into a Microsoft.XMLHTTP ActiveX object and manipulate via
javascript on the client side. Data is retreived from the server at the
request of the javascript without having to reload the page.

The Problem:

For the JSP to dynamically output xml, the file must have the extension
JSP, which is set to the mime type of dynamo-internal/html on the
server side (as we are using ATG Dynamo). But the javascript on the
client side will not retrieve anything unless the file extension is
..xml (or the mime type is recognized as text/xml). So the only way I
can get it to work is to change the extension to .xml, which then of
course amkes it so that the server will not process any of the JSP
code.

Ive tried to override the mime type within the javascript, using the
setRequestHeader method after opening the file, but no luck. A call to
alert the value of req.responseXML.xml after the send() turns up empty.
Ive only gotten it to work if I use a static xml file in palce of the
jsp. Sample of the javascript code is below:

if (window.XMLHttpRequest) {
// branch for native XMLHttpRequest object - THIS WORKS
req = new XMLHttpRequest();
req.overrideMimeType("text/xml");
req.onreadystatechange = processReqChange;
req.open("GET", "models.jsp?cId=300006&mId=TAC24", true);
req.send(null);
alert(req.responseXML.xml); //this gives me the resulting xml file
} else if (window.ActiveXObject) {
// branch for IE/Windows ActiveX version - NOT WORKING
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = processReqChange;
req.open("GET", "models.jsp?cId=300006&mId=TAC24", true);
req.setRequestHeader("Content-Type","text/xml");
req.send();
alert(req.responseXML.xml); //this gives me nothing
}
}

In looking at the following example the Microsoft gives (bottom of
page):

http://support.microsoft.com/defaul...B;EN-US;Q290591

I just dont see what could be going wrong here.


I should note that I successfully got the script to work using the
XMLHttpRequest object and the overrideMimeType() method. This works
with FireFox and I think some Mozilla clients, but not with the all
important IE5, which instead uses the XMLHTTP ActiveX control.=

View 2 Replies


ADVERTISEMENT

Trying To Use The GoTo Method Of The Word.Application ActiveX Object In JavaScript

Dec 11, 2006

I am trying to use the Goto method of the Word ActiveX object. I am
trying to open a document and go to a named bookmark. If I use this
code in VB it works, so I'm sure the approach is possible, I just can't
get JavaScript to work with it.

Here is the code I am using, the error I get from IE is Object
Expected:
Hope someone can help! Any help would be much appreciated

function PageLoad()
{
var WordApp = new ActiveXObject('Word.Application');
WordApp.Visible = true;
var documentlocation = crmForm.all.new_documentlocation.DataValue;
var wd = WordApp.Documents.Open(documentlocation);
wd.Select();
var Name = 'TestFred'
var wr = wd.Selection.GoTo(What : Word.WdGoToItem.wdGoToBookmark,Name :
'TestFred');
}

View 6 Replies View Related

Dynamically Change Row Colour On Dynamically Generated Table Rows

Nov 25, 2005

At this point I have been able to add the row. But what I want to do and am having trouble with is alternating the row colour to the dynamically added row element.

Sample of code I am using:

Code:
var tbody = document.getElementById('tableItems');

var row = document.createElement("tr");

var remainder = tbody.rows.length % 2;
if(remainder) {
row.setAttribute("class", "rowLightGreen");
}

var td1 = document.createElement("td");
td1.appendChild(document.createTextNode(qty));
td1.setAttribute("class","qty");
row.appendChild(td1);
tbody.appendChild(row);
One thing that puzzles me, is that even after adding a row the table my table.rows.length still = 0.

Does anyone know how I can determine the appropriate amount of rows so that I can apply the appropriate class?

Or is there just something blatantly wrong in my approach?

View 2 Replies View Related

Convert Xmlhttp Object Into Downloadable Object

Jan 19, 2010

I've been trying to create a 'loading page' for a from. When a user submitts a form, a loading animation is displayed on the page. Then I have javascript connecting to a url on my server that generates a dynamic file and returns it from memory. My problem is that I can display the text from this new file, but what I want to do is prompt the user to save the file locally. Is there a way to make this sort of conversion in javascript?

View 1 Replies View Related

ActiveX Object

Jul 20, 2005

I have a ActiveX object. This is working fine in English windows and IE, But causes IE to crash in Chinese windows.

View 1 Replies View Related

Fading An ActiveX-object Into The Background

Oct 22, 2005

How can I create a fade with javascript that fade an activex object
(quicktime) to the background and not to the IE windowed control.

I call this function several times, each time decreasing the "opacity".
id is the quicktime activex object.

I have tried to set background:tranparent and
background-color:transparent in my style sheet.

//change the opacity for different browsers
function changeOpac(opacity, id) {
var object = document.getElementById(''+id+'').style;
if (object.opacity) {
object.opacity = (opacity / 100);
} else if (object.MozOpacity) {
object.MozOpacity = (opacity / 100);
} else if (object.MKhtmlOpacity) {
object.KhtmlOpacity = (opacity / 100);
} else if (object.filter) {
object.filter = "alpha(opacity=" + opacity + ")";
}
}

View 1 Replies View Related

Calling ActiveX Object From JSP Using ActiveXObject Method

Jun 13, 2004

I am trying to call a ActiveX object from JSP using the ActiveXObject method in javascript. I have a dll filed named Patchgenerator.dll which is registered and assigned a prog id "Patchgenerator.PatchGen.1" which is being passed as an argument to the ActiveXObject method. Below is the code i am trying to execute..

[Code]...

When i write the above code and save it as an html file it works fine..the activex object is created and the methods are called , but when i copy the same code to a file and save it as jsp file under webapps folder under tomcat it doesnt work and reports a javascript error with the error being: Automation server cant create the object at line : var SSOObj = new ActiveXObject("Patchgenerator.PatchGen.1");

View 6 Replies View Related

Object Doesn't Support This Property Or Method - ActiveX

Jul 12, 2011

We are having a javascript which is throwing the foll error

"Object doesn't support this property or method".

The javascript function being called is using a Scanner API. So this is using some ActiveX.

Below is the code for javascript:

There is a object tag in html:

The javascript functions are called from body tag.

View 6 Replies View Related

JavaScript Being Detected As ActiveX??

Mar 9, 2007

I built a form that utilizes arrays for storing data, prototype objects stored in arrays, and DOM using getElementByID and getElementByName. Now, in XP SP2 with the security center turned on, I get alerted by IE6/7 that there is an ActiveX script on the page and it asks to be allowed.

I don't want users IE to see this ActiveX warning. First, the users going to be using this form are not exactly tech savvy enough to know to allow it. Second, I had no idea JavaScript was related to ActiveX--which begs the question, what sort of things cause JavaScript to be flagged as ActiveX?

View 3 Replies View Related

Custom Properties On Xmlhttp Object

Jan 2, 2008

Say x in a XML Http Request Object ... meaning it's either XMLHttpRequest (firefox) or ActiveXObject (IE)

This line of code works in firefox...
x.someProp = "someValue";
alert(x.someProp);

But in IE I get "Object doesn't support this property or method" I need to place a custom property on the object. Is there any way I can do that in IE?

I've already tried ActiveXObject.prototype.someProp = "";

View 1 Replies View Related

Is XMLHTTp Object Browser Dependent?

Aug 10, 2005

alert(xmlhttp.responseText);

gives a system error number: -1072896658

I have declared the object using:

var xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");

It works with IE version 6.0.2600 but not with IE version 6.0.2800

Couldnt find wat tis error code 1072896658.

View 4 Replies View Related

ActiveX Control In HTML/JavaScript

Jul 23, 2005

Is there any way i can show my excel chart on my web page.

View 2 Replies View Related

How To Capture ActiveX Exe Event In Javascript?

Jul 19, 2006

I know this question has been asked a million times but I still can't
get an event from an embedded ActiveX Exe to be caught in javascript.
I am able to access all the properties and methods of the ActiveX Exe,
I just can't seem to catch the event.

I've declared my object as follows:

<OBJECT
ID = "Test3"
CODEBASE = "http://www.amys-attic.com/Test3.exe"
CLASSID = "CLSID:2ACAEF35-445C-4717-8ACB-A3423E8D64EB"
style="display:none;">
</OBJECT>

My javascript event handler is as follows:

<script language="javascript" for="Test3"
event="PipeEvent(bIsPresent)">
alert("Pipe Detect");
</script>

The event handler never fires. I debugged the ActiveX Exe and verified
that the event is indeed being raised. I am able to catch the event in a VB6 test container project as well. Any ideas?

View 3 Replies View Related

Returning Multiple Values Using XMLHTTP Object?

Apr 6, 2006

I'm just starting to try out "Ajax" web programming and I've got a question.

AJAX is fairly straightforward. Javascript creates an XMLHttp object and
then uses that to generate a hidden webpage with your results.

What I'd like to know is, how can I retrieve multiple values from an XMLHttp
request?For example, if my request generated an SQL query that returned a
Name, Address and PhoneNumber, could I get those values directly instead of
parsing them out of the ResponseText?

This is my current handler:

function showResult(pge) {
var url="getResult.asp?sid=" + Math.random() + "&q=" + pge
xmlHttp=GetXmlHttpObject(stateChanged)
xmlHttp.open("GET", url , true)
xmlHttp.send(null)
}

function stateChanged() {
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete") {
//Complete, so show results.
document.getElementById("myResult").innerHTML=xmlHttp.responseText;
//How to get mulitple values here?
}
}

View 3 Replies View Related

Php, Sql, And Dynamically Generated Listboxes?

Jan 19, 2011

I want to dynamically generate list box options using the content of an sql database in real time. More specifically, i have a page with a couple of listboxes, when i click on an option in the first list box, i want the second list box to update with options that reflect the first one, in real time generated by the sql database.now i was wondering if it might be possible for javascript to send some thing to php which php could decode and search the database and return the results of that search. here is how i imagine the process to look in psudeo code:- user clicks on an option (say the 3rd option) in the 1st listbox- javascript catches the event, and sends some data to php indicating the 3rd option from the 1st listbox has been clicked- php tells sql to search for records that correlate with the 3rd option from listbox 1- php sends search result back to javascript- javascript populates the 2nd listbox with search resultsi want to do this with out having to refresh the webpage, security issues aint high, cause this project probably aint gonna go on the web. I got the idea from the dynamic searching on google, so i guess such technology is possible some how.

View 2 Replies View Related

Loading Javascript With XMLHTTP...?

Jul 26, 2005

Using XMLHTTP and DOM I'm able to load new HTML page content.

I'd now like to load small snippets of javascript with the HTML markup
and have that <script> incorporated into the page. If any of the loaded
script exists outside a function definition (eg: a call to a function),
I'd like that code to be executed as soon as its added to the DOM.

Can anyone suggest the best way to do this? I've Googled but not found
anything comprehensive. Do I need to use the eval() method or is there
a better way?

View 10 Replies View Related

Dynamically Generated Function Names

Jul 23, 2005

Does anyone know how to make this work?

var sectionId = 5;
repeat_section_sectionId();

function repeat_section_5(){
alert("firing");
}

The function's name contains the variables value, so how do we make
the engine see that?

View 8 Replies View Related

JQuery :: Get Dynamically Generated ID By Class Name?

Sep 1, 2010

I'm stumped on a jQuery related development task. I'm using jQuery in a SharePoint Web Part...The web part pulls data from a list and displays each item as a link button. When the link button is clicked it uses the jQuery-UI to display the body of the list item in a dialog box. I have this working perfectly when all of the class names are hardcoded. So in this code dialog0 is the class name for the body of the first article. newTitle0 is the linkbutton so they correspond 1:1 (and so on Dialog1, newsTitle1 etc..)

$('.dialog0').dialog({
height: 500,
width: 990,
autoOpen: false,

[Code].....

Problem is, when I have more than 1 instance of the web part on a page, because they use the same class names (2nd web part would also use Dialog0, newTitle0), if I click on an item in one web part, the item with the same class name opens in the other web part as well.

I've implemented it so each item now has a unique ID but I don't know where to go from here, so multiple instances of the web part can be on the page, and have the jQuery know which body to display when a link is clicked.

View 7 Replies View Related

Dynamically Generated Form Names In IE6 / IE7?

Mar 2, 2011

I'm having a problem with the page at http://www.bathfringe.co.uk/contributors2011_2.php
The user is able to add new performances to the form. This functionality is provided by cloning elementsPart of the code should add a 'counter' array key to the names of the cloned form inputs (full code obviously available at the page linked above):

Code:
counter++;
// Find the element to be copied

[code]....

View 2 Replies View Related

How To Access Dynamically Generated Array Name?

Feb 24, 2007

I am dynamically generating javascript arrays in my custom tag

This is the java code
autoCompleteResult += "<script> var valuesInListOf" + displayProperty + " = new Array();";

I can see this variable in debug on client side in javascript, just not sure how to access it.

in javascript
var values = "valuesInListOf" + displayProperty;

this gives String variable whereas I want to access JavaScript Array that I created in my tag.

View 5 Replies View Related

Loop For A Dynamically Generated Form

Jan 4, 2008

Here is the code:

function selectDefaults(buttonGroup){
for (i=0; i < buttonGroup.length; i++) {

if (buttonGroup[i].checked == true) {
for (count=1;count < document.addForm.recordCount.value; count++) {
var doc = document.addForm.feature1[i]
var featureVal = doc.value;
featureVal = featureVal.substring(0,2);
if ( featureVal == "SF"){
doc.checked = true}
} }}}

I need help in the second 'for' loop. Currently it is hard coded to replace the value of document.addForm.feature1 - but this field name is dynamically generated via the page it resides within. That being said, its name/id will increment depending on how large the recordset is. i.e. feature2, feature3, feature4 etc....

How do I get this to work in the javascript? I need to use this script to search all the 'feature#' fields in the form when the script is triggered. All I could think of was this: var doc = document.addForm.feature+count+[i]
which gives me a syntax error.

The purpose of this script, for those who will wish to know, is to automatically select all the features of the product that have the text "SF" (standard feature) in their value.

View 2 Replies View Related

Cant Reference Dynamically Generated Iframe In FF?

Apr 14, 2011

I cant seem to get the reference to the 'header' IFrame that is dynamically created. I can reference one called 'footer' that is created in the same line of code as the other IFrames however (oddly enough). I've tried numerous ways with no luck. Since this is inherited code and designed years ago to run on IE only it's a mess. You'll see I've tried alerting out various different ways and simply left it in to show my feabile attempts.

Code:
function mit(e) {
var iframeElement = document.getElementById('header');

[code]....

View 2 Replies View Related

Acessing Dynamically Generated Form Elements..

Apr 5, 2006

I have form elements which dynamically generated like this...

<form name="formA" ...>
<input type="select" name="text_1" ...>
<input type="select" name="text_2" ...>
<input type="select" name="text_3" ...>
<input type="select" name="text_4" ...>
</form>

And I doing some validation like this.
function checkvalue()
{
var f = document.forms['formA'];
var eLen = f.elements.length;
for (var i=0; i<eLen; i++) {
if(f.elements[i].name == "text_" + i)
{ alert ( f.elements[i].name); }
else { alert (f.elements[i].name); }
}

It never goes into first part of if statement.. Is there a way I can
access these kind form elements..

View 1 Replies View Related

JQuery :: Reload Content In A Div That Is Generated Dynamically?

Oct 22, 2010

I have a jsp file that is used to display data from Java objects running on my server. I'm using JQuery for tabs and to handle the ajax calls to a servlet that affects the Java server I have running.Each tab represents a service, and has a corresponding java object on the server side. These are generated from the spring configuration, and is working fine. The page is used to control some aspects of the service, and I have a few buttons that can be clicked. I'm trying to get it so that when a button is pressed, the appropriate Java function is called on the service's object (this happens using ajax) and then refresh the current tab.

My js code is like this:

function doPause(params) {
//some additional params set
doAjax(params);

[code]....

Right now, I'm using the window.location.reload(true) to refresh the whole page but I'd like to just redo the div for the tab that contains the button that has been clicked.I have tried:

$("#"+params.client).load("monitor.jsp#"+params.client);

instead of the window.location calls above, but that puts the whole page into the tab.

View 1 Replies View Related

JQuery :: Validating Dynamically Generated Fields

Dec 3, 2010

I'm trying to validate a set of dynamically created field names, for example

Name: <input type='text' name="s1[name]" id="s1[name]">
Image: <input type='text' name="s1[image]" id="s1[image]">
Name: <input type='text' name="s2[name]" id="s2[name]">
Image: <input type='text' name="s2[image]" id="s2[image]">

[Code].....

There can be any number of 'groups' but I would want to apply some validation for each item in a group. I can only see that the validation is done by specifying a id? however as the id's are going to be dynamically created how can I do this? can you validate for a css class?

View 1 Replies View Related

Storing Text From Dynamically Generated Output?

Jan 23, 2011

I have script that is dynamically generating updates on my page. The code is this:

Code:

<a id="cc_stream_info_song" target="new">Loading...</a>

The id tag links to a js script on a remote server and replaces the "loading" text with the song title of the currently playing song on my shoutcast server, and refreshes this every 60 seconds. I want to be able to grab this song title and put it in a php variable. I don't have access to the remote server, so I don't have any other way of getting the updated song title outside of this little snippet. I tried using php output buffering but all that does is grab the html I posted above, and not the javascript-generated song title.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved