The IE developer toolbar's DOM inspector shows the OBJECT tag and the PARAM
tags inside it, and if I don't have the Javascript in an external file, I'll
get the "click here to activate" tooltip and the border around what is
supposed to be the Flash movie. If I right-click inside the border, I get the
Flash context menu. The movie just doesn't load.
<html><head><title>foo</title>
<script>
function foo() {
var p=document.createElement("param");
p.name="movie";
p.value="flashtest.swf";
AXObject.appendChild(p);
var p=document.createElement("param");
p.name="quality";
p.value="high";
AXObject.appendChild(p);
I have situation that when my page is loaded i create js object <html> ... <script> function Page() { this.page = 0; this.result = 0 this.resultCount =1; this.currentPage =1; } MyPage= Page() </script> then in my javascript function i use object like this:
function getPage() { if(!MyPage) { MyPage = new Page(); } return MyPage; }
but there is one problem: MyPage lost one of the property, currentPage. When i do alert(MyPage.cuurentPage) shows mi undefined. After object initialization everything seems to be alright, currentPage is set to 1 but when i Try use MyPage in my js code is already set to undefined. What happen? What I'm doing wrong?
function Obj() { obj.squares = new Array(); } Obj.prototype.Load= function(xdoc) { var goat = "head"; xdoc.ProcessNodes("squares/square", function(node) { alert(goat); // <-- this works fine this.squares.push( // do processing on node, create a square ); }); }
Now the xdoc is another object I have, with a method called ProcessNodes. The only important thing to know about ProcessNodes is that it does some things, and calls its second argument (which is a function) successively.
The problem I am running into here is once I get into the callback function, "this.squares" is returning null ... even though it has been initialized to an Array. For whatever reason, its like the object loses scope when I get into the callback function. For all other intents and purposes however, the callback function has the same scope as the calling block (i.e. the goat variable is still accessible).
I'm trying to utilized a more object-oriented approach to managing window events in javascript. Thus, I am creating a "controller" object to handle events and interact with the server. However, I apparently don't fully understand what "this" refers to. In the code below I was expecting that when the button was clicked (handleDeleteButtonClicked function) that "this" would be pointing at a ViewController object. Instead it was the Button (HtmlInputElement).
I just released javascript lib that really helps to develop robust and clear js-scenarios following the OOP directions. The library is compatible with wide range of browsers on different platforms, including Netscape 4.x, Netscape 6.x, Netscape 7.x, Opera 6, Opera 7, Mozilla 1.0, IE 4, IE 5, IE 6.
I am creating a JavaScript object which I want to use to respond to user input on a web page. The object will basically be made up of a constructor and then a selection of functions which will use the DOM to alter the appearance of the page according to the user's input. I am getting stuck because I want a form element that is being created by the object to have an 'onkeyup' event attached to it which will call another function from the same object.
Now, I understand how to attach the 'onkeyup' event to the input element I have created using the DOM. If I tell the event to call a normal function (alert() etc) then it does exactly that. What I am having trouble with is getting the event to call another function from the object that created the input box in the first place. (I don't even know if this is possible / a wise thing to do!). Code:
I have a fairly complex javascript object - containing strings and arrays - which I need to pass along to a second PHP page. Is there a way to pass this object along via POST to be picked apart by the receiving PHP script?
I could dynamically create a form, populate it with the contents of the object, then pass it along via submit(), but frankly that's an awful pain.
I'm having trouble getting the following code to work properly. Every time I try to access the private testing variable from the priveleged MyMethod it gives an error. Says it can't find testing and that it has no properties so I can't run a push() command on it.
function MyClass() { var testing = new Array();
// define the method function MyMethod() { this.testing.push("hello"); }
// make the method priveledged this.MyMethod = MyMethod; }
// a test function it ensure the variables declared here are isolated function Start() { var myClass = new MyClass();
I got two ASP pages. One is ASP email form (I'm using Persist ASP Email component). Another one has all file links in it. For example, when user click Outlook course hyperlink. It will pop up another window with outlook course PDF file. (All PDF files are already in the server).
What I am trying to do is: When user click the "Add Email" hyperlink, it will add that course name and filepath into ASP/VBScript Dictioanry Object. After the user finish and click "Attach to email" button. All the files will be attached in the email as an attachment.
Because I am not familar with VBScript. So, can Javascript add items to ASP Dictionary Object?
Is this possible? Basically I need to grab all the flash objects on the page (done) and then set the wmode to transparent so it doesn't mess up my DHTML menu.
If the user entered an invalid UserName/Password I display the page again. When this happens I want to give the user a different message then the one displayed when the page was initially displayed.
I use the Response.Redirect method from the page checking the submition. When I do that I call the page with a parameter like this Response.Redirect("Page.asp?FROM=1").
When I get the parameter in the page I know I need to show a different message.
The problem is that if the page is called without the parameter, I cannot determine that the parameter is missing.
The codse is very simple:
from_flag = Request.QueryString("FROM")
Now is the problem -
if I use if(from_flag == 'undefined') - this condition return false. but if I display from_flag using Response.Write(from_flag) I get "undefined"
if I use if(typeof from_flag == "undefined") - this does not work since the typeof return "object" in both cases when I call the page with the parameter or without the parameter.
also I tried to comnpare with null does not work.
By the way if I use VBScript as the script lang - it works fine I just need to compare the from_flag with vbNullString and all is well....
I stumbled upon a strange behaviour of the XMLHttpRequest.. Maybe I'm just not well informed enough about its possibilities, so could someone please confirm my question?
When I put plain javscript in a file that is read-in through a XMLHttpRequest-object, it's like it is totally ignored. Eg. I have the file ajax_include.html with in it's body the following lines <script type="text/javascript" language="javascript"> alert('some alert'); </script>
when I directly surf to the file, the alert pops up as expected, but when I use a simple XMLHttpRequest to replace the contents of a div with the contents of this page, the alert is not popping up, although when I view the selection's source (Thank you, Firefox!), it is there!
When I place an anchor with an onclick-action (eg. alert('onclick')), it works when I click it. So my "conclusion" is that it seems like inline javascript commands are ignored (functions not recognized etc.). All actions assigned to other events work nice though.
Can someone confirm this strange behaviour? Or is it just normal with the use of an XMLHttpRequest opbject?
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):
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.=
The scenario is of two different web servers. The parent frame (html page orginates from server 1) has script like function x1() { ..... alert('parent invoked'); .... }
Inside child frame (html orginates from server 2) the html refers to parent script like { ..... parent.x1(); .... }
It throws Microsoft Jscript runtime error: permission denied. I am using IE based on WinCE 4.2 version platform.
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'); }
When I put the in, I get the error message "object doesn't support this action". I've also tried putting in after the </body> tag as another script...no go.
I'm setting the cookie with these lines in another function: varScroll = document.body.scrollTop;document.cookie("Position") = varScroll;
Any clues/suggestions greatly appreciated. I recently posted a similar question, but rearranged how I was doing it, still no luck, so I'm trying again.