XML Document Passed As Jsp Parameter In Javascript Ok With Mozilla, Not In IE!!
Sep 27, 2007
I have a strange problem... I have a form with a text area that contains an XML document. This document can be modified by the user.
Once the document has been modified, the user pressed the "Submit" button to submit the modification (onclick=modify())... and go to another jsp page.... in my javascript, I have the following code:
function modify()
{
myRand=parseInt(Math.random()*99999999); // cache buster
var docXML=document.forms[0].xml.value;
var plist="myRand="+myRand+"&docXML="+escape(docXML);
url="modify_xml.jsp?"+plist;
document.forms[0].action=url;
document.forms[0].submit();
}
With Firefox, the problem does not occur.... but with Explorer, the form is not even submitted!!!!! Is there a workaround for this? The XML document is not even very big.
I have an XML page I'm trying to load with javascript to display on Mozilla Firefox. I can get this to work on Internet Explorer but it would not work on Firefox. I can't figure out what I'm doing wrong. Can someone glance at my short piece of code below and tell me why this wouldn't work on firefox? Code:
I have downloaded 2 html pages that give me page1 with a drop down box for a list, and a 'show' button. this then passes dropdown value to page2 and JS presents the text on the page, but I want to use the passed parameter to change the src of an img with ID=img1.can post all the JS if you like but assume i am missing just a one liner replacing the ....
var name = getValue("name"); document.write(name);
I'm passing the id of a div as a parameter. I'm not sure how to refer to it with Jquery. The following does not work: Code: function updatemail(param1, param2) { $("#param2").animate({ opacity: "show" }, 300); } I also tried $(param2) but it did not work.
New to JS. Have ordered some new books, but need to get somethings going in the mean time. What I wanted to do is to link to a new page having a date range input in the form of 6 text boxes, 2 sets of mm-dd-yy, from and to, where the upon loading the page box 1 of the from would auto focus and then auto tab and then post where php could take over on the server side. Setting up the form and the lay out, no problem. Auto focusing went just like expected using the following code, included because on the next step everything fell apart.
So then the wheels came off and in response, began to simplify what was trying to be done to find where the issues were. As far as I can get working is: Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "[URL]"> <html> <head> <script type="text/javascript" > window.onload=function() { document.getElementById("input1").focus(); } </script> <script type="text/javascript" > function myFunc() { alert("is this working"); } </script> </head> <body> <input id="input1" name="input1" type="text" onkeyup="myFunc()" maxlength="2" value="type a No." /> </body> </html>
First issue with this: When I first get to the page everything is just as ordered. The focus is on the text box and the default value is "type a No." When I press a key onkeyup, I bring up the alert box with "is this working" in it. But when I refresh the page with the refresh button, after clicking the "ok" on the alert box, the character that was typed in is still displayed. If I use the link to the page, or the URL from the address bar, then the page reloads properly with the default value, "type a No".
How do you get the default textbox value using the refresh button as apposed to reloading the page using a link or from the address bar? Using Firefox 8.0 more important at the moment: If I change the script to pass an argument to the function the script crashes. It does not pull up an alert box and freezes. My guess is that I'm doing something wrong on a concept level. Changed the default value of the text box to " ". Looked like to me there was an issue with the size specification and the default string length as you could only enter in a key stroke by highlighting the text and replacing it.
var myDIVnode1 = document.createElement("DIV"); // etc myDIVnode1.appendChild(document.createTextNode("a")); // this shows "a" alert(myDIVnode1.firstChild.nodeValue);
I posted a similar thread about this in the .NET forum, but I thought maybe there was a javascript way of doing what I need to do.Is there a way to redirect a user to another page while keeping the passed in #parameter?For example, if the user clicks the link:
I am trying to match a passed parameter on a url to an area on an image map. So far I can find the correct area using Code: $('#mediummap area').each(function(i){ href = $(this).attr('href'); if (href == id) { alert('Found ID ' + id); }});}});
But next I need to retrieve the co-ordinates for the Area. I have tried Code: coords = $('this').attr('coords'); And Code: coords = $('this').coords();
I can not seem to get the value back, just an undefined return. What I want to do is to find the point on the image map and then centre that point with in the viewport for the image (large image, small viewport).
I normally use Mozilla 1.4 on Windows XP Pro. As I was developing some test webpages, I discovered that the SRC parameter doesn't seem to work when a path is used with the filename.
In one example, when I want to run a JavaScript from an external file (i.e., not inline), I would do the following ...
If "program.js" were in a different subdirectory than the .htm file referring to it, the filename would have to be prefixed by the pathname as follows ...
But when I ran the above from within an .htm file loaded locally into Mozilla, it did not work. (The result was as if the above code weren't there). However, when I ran the identical code on Internet Explorer (v.6), it worked. Code:
What I wanted to do is to link to a new page having a date range input in the form of 6 text boxes, 2 sets of mm-dd-yy, from and to, where the upon loading the page box 1 of the from would auto focus and then auto tab and then post where php could take over on the server side. Setting up the form and the lay out, no problem. Auto focusing went just like expected using the following code, included because on the next step everything fell apart.
function wr(s) { //Just got tired of writing document.write, //so I created a shorthand version document.write(s); }
function lm() { //I know this can be shorter but the original script //tried to format the outputstring, wichh did not //work in Mozilla, so I commented a lot out //and this is what's left of it... var s = document.lastModified; return s; }
function lmstring() { var s = "This page was last modified at: "; s += lm(); s += "."; return s; }
This _should_ return the date and time the document was last modified (saved), however in Mozilla (1.4; Windows ME) it will return the actual current date and time (as if I'd used "new Date()"). In IE (5.50) it behaves as I expect.
What am I doing wrong (or is it a Mozilla bug?).
(The script is in an external .js file, if that should make any difference)
I'm a perplexed nube, and I can't understand how document.getElementById evaluates to true when no parameter is passed to getElementById. This code alerts 'foo' if (document.getElementById) {alert('foo')} else {alert('bar')}
Just to double check, this code alerts 'bar'
if (!document.getElementById) {alert('foo')} else {alert('bar')}
can somebody give me a minimal example of how to read xml file into mozilla AND run some Javascript funcion?
Mozilla can read xml files directly and css files can be included as well, that works for me. But I would like to do some operations with the DOM tree.
My question is Mozilla only, I would apperciate some minimal example (like alert(1)) and especially some URL pointers.
Determine what the previous page was that the user was viewing, even if the user arrived at my site by through the use of a browser function (history, location bar, refresh, etc.). Is this possible?
I'm not wuite sure how document.history functions - what degree of privacy is given to the user and to what extent can web pages get URLs from the user's history?
could you kindly help me to solve a compatibility problem that involves Internet Explorer and NN/Mozilla.
I created a html page that contains a form (its name is "Modulo") and some text boxes. After clicking on a button, a popup appears. I tried to modify the text of "Testo" textbox from the popup windows by using the following javascript code:
window.opener.Modulo.Testo.value=window.opener.Mod ulo.Testo.value + " This will be added to Testo textbox!";
The code is correctly run by Internet Explorer and the "Testo" textbox in the calling html page is successfully updated.
When I try to open these pages with Mozilla, the javascript code that should update the textbox is ignored. How can I solve this problem?
I have looked into creating a javascript that will do a PopUp "Exit Poll" when the client backs out or links forward from the domain. It is a moderated script I found through discussions on this forum.
Now it works great in MSIE5.2.2 on MacOS10.1.5, but I'm finding I better also make sure it works in Mozilla if I have any chance of making it work on the PC side. When i try it in Mozilla, I get Javascript console saying "loadpopup() is not defined"
I've found a couple javascripts that work in MSIE but not Mozilla..this is getting irritating to say the least.
For MacOS10.3 owners using Safari, is the browser compatibility with javascript any better? I feel like I need to get away from MSIE5.2.2 altogether now. And no..I'm not buying a PC. Code:
The following information is passed to a script to generate an email from a form. <INPUT TYPE="hidden" name="param_recipient" value="me@mycompany.org">
In the form further down on the page, a user enters a value in the ru field. I want to write something similar to: if ru=122 then sendformto="me@mycompany.org" if ru=144 then sendformto="you@mycompany.org"
the paramater above would then become something like: <INPUT TYPE="hidden" name="param_recipient" value=sendformto>
The following posts back properlty from an "onclick" in IE, but not in Mozilla 1.7. Can anyone explain to me why not? The style class works the same in both environments.
Everything works fine with Opera and IE, but not with Mozilla 1.7.3 and Firefox 1.0 PR. When I call a function previously defined inside another function I've got "function is not defined". Why?
We've got a server-side page (status.php) that dynamically generates a GIF image. The displayed image depends on the value of a boolean field in a database. Just calling the page displays the current value of the boolean, calling it with a parameter switch (status.php?switch) flips the database value and generates a new image. We've included headers to prevent caching of the image by the browser.
Whenever our HTML page is displayed in the browser, we just include an image that shows the current status: img src='status.php'/
We want to allow the user to click the image, which then inverts the boolean status in the database: img src='status.php' onclick='this.src=status.php?switch;'/
This works great in Internet Explorer, but both Mozilla and Opera only allow to switch once. My idea of the problem is that those browsers think like this; after one click, the src is already 'status.php?switch', so changing the src again would be redundent in their eyes, so they won't do it.
We found a temporary solution by generating the current time as a parameter in the image URL: img src='status.php' onclick='this.src=status.php?switch+(new Date());'/ However, this is not a very elegant solution.
Does anyone know a proper solution to this? This means, forcing Mozilla and Opera to load an image using JavaScript, even though the URL of the image didn't change?
Firefox has a Javascript Console that has 3 panels besides "All" and "Clear": "Errors", "Warnings", "Message".
Does anyone know a way to log a message in the Message panel with JavaScript? That would really help debugging. I know there's a way involving XPCOM, but that only works with "trusted" scripts, and scripts loaded thru html aren't trusted.