Search Results

Search found 193 results on 8 pages for 'activexobject'.

Page 3/8 | < Previous Page | 1 2 3 4 5 6 7 8  | Next Page >

  • how to run XSL file using JavaScript / HTML file

    - by B. Kumar
    i want to run xsl file using javascript function. I wrote a javascrpt function which is working well with Firefox and Crom but it is not working on Internet Explorer function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",dname,false); xhttp.send(""); return xhttp.responseXML; } function displayResult() { xml=loadXMLDoc("NewXml.xml"); xsl=loadXMLDoc("NewFile.xsl"); // code for IE if (window.ActiveXObject) { ex=xml.transformNode(xsl); document.getElementById("example").innerHTML=ex; } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xsltProcessor=new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); resultDocument = xsltProcessor.transformToFragment(xml,document); document.getElementById("example").appendChild(resultDocument); } } Please help my by modifying this code or by another code so that i can work with Internet Explorer. Thanks

    Read the article

  • Panoramio API access using AJAX - error "Origin hxxp://foo.bar is not allowed by Access-Control-Allow-Origin."

    - by Marko
    Hello there! I am currently experiencing this issue, and am wondering why...? The error message is: "XMLHttpRequest cannot load http://www.panoramio.com/wapi/data/get_photos?v=1&key=dummykey&tag=test&offset=0&length=20&minx=-30&miny=0&maxx=0&maxy=150&callback=?. Origin hxxp://foo.bar is not allowed by Access-Control-Allow-Origin. test_panoramio.html:59Uncaught SyntaxError: Unexpected token )" "hxxp://foo.bar" refers to the site I am running the script from. The "test_panoramio.html" on the site contains e.g. the following : var url = "http://www.panoramio.com/wapi/data/get_photos? v=1&key=dummykey&tag=test&offset=0&length=20&minx=- 30&miny=0&maxx=0&maxy=150&callback=?"; function myScriptFn() { if (window.XMLHttpRequest) { myAjax = new XMLHttpRequest(); if ( typeof myAjax.overrideMimeType != 'undefined') { myAjax.overrideMimeType('text/xml'); } } else if (window.ActiveXObject) { myAjax = new ActiveXObject("Microsoft.XMLHTTP"); } else { alert('The browser does not support the AJAX XMLHttpRequest!!!'); } myAjax.onreadystatechange = function() { handleResponse(); } myAjax.open('GET', url, true); myAjax.send(null); } function handleResponse() { if (myAjax.readyState == 4){ // Response is COMPLETE if ((myAjax.status == 200) || (myAjax.status = 304)) { // do something with the responseText or responseXML processResults(); }else{ alert("[handleResponse]: An error has occurred."); } } } function processResults() { myObj = eval( '(' + myAjax.responseText + ')' ); ... doSomething() ... } The Panoramio URL works if typed directly to the browser. Please could you help me with this, I am running out of hope...:( Thank you in advance, Yours Marko

    Read the article

  • innerHTML in IE?

    - by froufrou
    I'm having trouble using innerHTML with my radio type button. <table align="center"> <div class='main'> <span id="js" class='info'> <label><input type="radio" name="js" value="0" size="<?php echo $row['size']; ?>" onclick="js(this.value, this.size);" /><img src="arrowup.png"/></label> <br /> <label><input type="radio" name="js" value="1" size="<?php echo $row['size']; ?>" onclick="js(this.value, this.size);" /><img src="arrowdown.png"/></label> </span> </div> </table> My .js looks like this: var xmlhttp; function getVote(a,b) { xmlhttp=GetXmlHttpObject(); if (xmlhttp==null) { alert ("Browser does not support HTTP Request"); return; } var url="js.php"; url=url+"?js="+a; url=url+"&id="+b; url=url+"&sid="+Math.random(); xmlhttp.onreadystatechange=stateChanged; xmlhttp.open("GET",url,true); xmlhttp.send(null); } function stateChanged() { if (xmlhttp.readyState==4) { document.getElementById("js").innerHTML=xmlhttp.responseText; } } function GetXmlHttpObject() { var objXMLHttp=null; if (window.XMLHttpRequest) { objXMLHttp=new XMLHttpRequest(); } else if (window.ActiveXObject) { objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP"); } return objXMLHttp; } This doesn't work in IE only! Any help?

    Read the article

  • Looks like COM object is created, but JScript fails to get a reference

    - by damix911
    I'm using the following code to create a COM component that I have developed and registered. var mycom = new ActiveXObject("Mirabilis.ComponentServices.1"); mycom.SetFirstNumber(5); mycom.SetSecondNumber(3); The first line runs fine, while if I alter the ProgID (that is, the string passed to ActiveXObject) I get the message Automation server can't create object. This suggests that at least the basics of the registration mechanism are working properly. I integrated some logging calls into the DLL. When I run the script I get the proof into the log file that both this call to QueryInterface: STDAPI DllGetClassObject( const CLSID &clsid, const IID &iid, void **ppv) { ... CAddFactory *pAddFact = new CAddFactory; ... HRESULT hr = pAddFact->QueryInterface(iid, ppv); if (hr == S_OK) writeToLogFile("Class QueryInterface returned S_OK"); else writeToLogFile("Class QueryInterface failed"); return hr; ... } and this one: HRESULT __stdcall CAddFactory::CreateInstance( IUnknown *pUnknownOuter, const IID &iid, void **ppv) { ... CAddObj *pObject = new CAddObj; ... HRESULT hr = pObject->QueryInterface(iid, ppv); if (hr == S_OK) writeToLogFile("Object QueryInterface returned S_OK"); else writeToLogFile("Object QueryInterface failed"); return hr; ... } return S_OK. However, when JScript gets to line 3 of the script, I get the following error message: 'mycom' is null or not an object Why is this happening? It looks like JScript should be able to obtain a reference. Some attempts I made I tried to return S_FALSE from DllCanUnloadNow to be sure that the DLL will not be unloaded, just in case, but with no luck.

    Read the article

  • How to access method variables from within an anonymous function in JavaScript?

    - by Hussain
    I'm writing a small ajax class for personal use. In the class, I have a "post" method for sending post requests. The post method has a callback parameter. In the onreadystatechange propperty, I need to call the callback method. Something like this: this.requestObject.onreadystatechange = function() { callback(this.responseText); } However, I can't access the callback variable from within the anonomous function. How can I bring the callback variable into the scope of the onreadystatechange anonomous function? edit: Here's the full code so far: function request() { this.initialize = function(errorHandeler) { try { try { this.requestObject = new XDomainRequest(); } catch(e) { try { this.requestObject = new XMLHttpRequest(); } catch (e) { try { this.requestObject = new ActiveXObject("Msxml2.XMLHTTP"); //newer versions of IE5+ } catch (e) { this.requestObject = new ActiveXObject("Microsoft.XMLHTTP"); //older versions of IE5+ } } } } catch(e) { errorHandeler(); } } this.post = function(url,data) { var response;var escapedData = ""; if (typeof data == 'object') { for (i in data) { escapedData += escape(i)+'='+escape(data[i])+'&'; } escapedData = escapedData.substr(0,escapedData.length-1); } else { escapedData = escape(data); } this.requestObject.open('post',url,true); this.requestObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); this.requestObject.setRequestHeader("Content-length", data.length); this.requestObject.setRequestHeader("Connection", "close"); this.requestObject.onreadystatechange = function() { if (this.readyState == 4) { // call callback function } } this.requestObject.send(data); }

    Read the article

  • javascript ajax help

    - by ngreenwood6
    I have the following code. var d3_ad = 1; function displayD3Ad(){ var query_string = '?d3_ad='+d3_ad; query_string += '&location='+escape(location); //document.write('<iframe src="index.php'+query_string+'"></iframe>'); var data = httpRequest('http://localhost/test/index.php','GET',query_string); document.write(data); } function httpRequest(strURL,type,query) { var request = false; if (window.XMLHttpRequest) {// Mozilla/Safari request = new XMLHttpRequest(); } else if (window.ActiveXObject) { //Internet Explorer request= new ActiveXObject("Microsoft.XMLHTTP"); } request.open(type, strURL + query, true); request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); request.onreadystatechange = function() { if (request.readyState == 4) { return request.responseText; } } request.send(null); } displayD3Ad(); now when it writes out the data it is saying undefined. It seems like it isnt returning the data. I looked in firebug and it completes and shows the response that shoudl be there. Any help is appreciated. I just need to set the data variable so that I can use it later on.

    Read the article

  • Javascript AJAX function not working properly

    - by Or W
    I have a function that sends a GET request to a php script and checks if the script returned any output. It works great, but when I try to add another function that checks for something similar, both of them fail. What am I missing? function checkUsername(usr,n) { var user = usr.val(), xmlhttp; //var str = document.getElementById('email').value; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { //document.getElementById("txtHint").innerHTML=xmlhttp.responseText; if (xmlhttp.responseText != "") { usr.addClass( "ui-state-error" ); updateTips( n ); return false; } else { return true; } } } xmlhttp.open("GET","ajaxValidate.php?type=user&q="+user,true); xmlhttp.send(); } The above works perfectly, when adding this function, none of them work: function checkEmail(em,n) { var email = em.val(), xmlhttp; //var str = document.getElementById('email').value; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { //document.getElementById("txtHint").innerHTML=xmlhttp.responseText; if (xmlhttp.responseText != "") { em.addClass( "ui-state-error" ); updateTips( n ); return false; } else { return true; } } } xmlhttp.open("GET","ajaxValidate.php?type=email&q="+email,true); xmlhttp.send(); }

    Read the article

  • Website. AJAX and FIREFOX problems. I dont think Firefox likes ajax..?

    - by DJDonaL3000
    Working on an AJAX website (HTML,CSS,JavaScript, AJAX, PHP, MySQL). I have multiple javascript functions which take rows from mysql, wrap them in html tags, and embed them in the HTML (the usual usage of AJAX). THE PROBLEM: Everything is working perfect, except when I run the site with Firefox (for once its not InternetExplorer causing the trouble). The site is currently in the developmental stage, so its offline, but running on the localhost (WampServer, apache, Windows XP SP3,VISTA,7). All other cross-browser conflicts have been removed, and works perfectly on all major browsers including IE, Chrome, Opera and Safari, but I get absolutely nothing from the HTTPRequest (AJAX) if the browser is Firefox. All browsers have the latest versions. THE CODE: I have a series of javascript functions, all of which are structured as follows: function getDatay(){ var a = document.getElementById( 'item' ).innerHTML; var ajaxRequest; try{//Browser Support Code: // code for IE7+, Firefox, Chrome, Opera, Safari: ajaxRequest = new XMLHttpRequest(); } catch (e){ // code for IE6, IE5: try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser is not compatible - Browser Incompatibility Issue."); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState < 4){ document.getElementById( 'theDiv' ).innerHTML = 'LOADING...'; } if(ajaxRequest.readyState == 4){ document.getElementById( 'theDiv' ).innerHTML = ajaxRequest.responseText; } } //Post vars to PHP Script and wait for response: var url="01_retrieve_data_7.php"; url=url+"?a="+a; ajaxRequest.open("POST", url, false);//must be false here to wait for ajaxRequest to complete. ajaxRequest.send(null); } My money is on the final five lines of code being the cause of the problem. Any suggestions how to get Firefox and AJAX working together are most welcome...

    Read the article

  • use of ajax in django problem with the code

    - by tazim
    I am new to ajax and using Django for web development. Now My Template contains : sample.html <html> <body> <script language="javascript" type="text/javascript"> //Browser Support Code function ajaxFunction(){ var ajaxRequest; // The variable that makes Ajax possible! try{ // Opera 8.0+, Firefox, Safari ajaxRequest = new XMLHttpRequest(); } catch (e){ // Internet Explorer Browsers try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ // Something went wrong alert("Your browser broke!"); return false; } } } // Create a function that will receive data sent from the server ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.myForm.time.value = ajaxRequest.responseText; } } ajaxRequest.open("GET", "/showtime/", true); ajaxRequest.send(null); } </script> <form name='myForm'> Name: <input type='text' onBlur="ajaxFunction();" name='username' /> <br /> Time: <input type='text' name='time' /> </form> </body> </html> In views.py my function is : def showtime(request): string = "Ajax Application" data = {"string" : string} pprint (data) return render_to_response("sample.html",data) Now, The output is not as expected . The template does not receives the response sent by the server What is wrong with the code ?

    Read the article

  • Javascript Object Properties go to undefined after ajax request returns

    - by adasdas
    if you have an object and set a property for it, you can access that property in a function called on that object. but if you call a function and do an ajax request such that a different function is called from onreadystatechange, that secondary response function does not have access to the property. Thats a little confusing so see what I mean here. The property this.name is the one that changes. //from W3Schools website function getXHR(){if (window.XMLHttpRequest){return new XMLHttpRequest();}if (window.ActiveXObject){return new ActiveXObject("Microsoft.XMLHTTP");}return null;} function TestObject() { this.name = ""; //public var xhr = null; //private var response = function() //private { if(xhr.readyState > 3) { alert("B: my name is " + this.name); } } this.send = function() //public { alert("A: my name is " + this.name); if(xhr === null) { xhr = getXHR(); } var url = "http://google.com"; xhr.onreadystatechange = response; xhr.open("GET", url, true); xhr.send(null); } } var o = new TestObject(); o.name = "Ice Cube"; o.send(); Results are: A: my name is IceCube B: my name is undefined If response is public this happens as well. If xhr is public this also happens. Something occurs so that the response function called doesnt have access to the same parameters.

    Read the article

  • Xml Conversion "Type mismatch" Error

    - by prema
    I am selecting a query in sql server 2005 SELECT 'Region' AS ELEMENT,(SELECT GeographyName,GeoID from @tmpTable FOR XML RAW, TYPE) FOR XML RAW('Root') This will give the output in xml as <Root ELEMENT="Region"> <row GeographyName="East" GeoID="2" /> <row GeographyName="West" GeoID="3" /> <row GeographyName="North" GeoID="4" /> <row GeographyName="South" GeoID="5" /> </Root> In aspx page, i want to get this function Populatedata(obj, val) { var xmlDom = new JXmlDom(obj, false); --> at this point i am getting error var nodeHeader = xmlDom.selectNodes("//row"); // my code goes here } function JXmlDom (xml,isFile) { this.load=load; this.loadXML=loadXML; this.selectNodes=selectNodes; this.text=text; this.selectSingleNode=selectSingleNode; this.documentElement=documentElement; this.transformNode=transformNode; if (isFile) { this.dom=this.load (xml); }else { this.dom=this.loadXML (xml); } function loadXML (xml) { if (window.ActiveXObject) { var dom=new ActiveXObject("Microsoft.XMLDOm"); dom.async=false; dom.loadXML (xml); } if (document.implementation && document.implementation.createDocument) { var domParser=new DOMParser(); var dom=domParser.parseFromString (xml,"text/xml"); } return dom; } But when i am calling this i am getting an error as Type mismatch.Can anyone help me

    Read the article

  • Optimize SQL connection?

    - by user1484035
    I am building a multi-page web project in HTML and Javascript that is constantly reading from AND writing to an SQL database. I can connect to the database and successfully run my project with this type of connection. var connection = new ActiveXObject("ADODB.Connection") ; var connectionstring="Data Source=<server>;Initial Catalog=<catalog>;User ID=<user>; Password=<password>;Provider=SQLOLEDB"; connection.Open(connectionstring); var rs = new ActiveXObject("ADODB.Recordset"); rs.Open("SELECT * FROM table", connection); rs.MoveFirst while(!rs.eof) { document.write(rs.fields(1)); rs.movenext; } rs.close; connection.close; Works great and runs fine. BUT, the first 5 lines (from var connection = to var rs =) causes the whole browser to freeze for a few seconds while it establishes the connection. I need to speed that up since I am constantly connecting to the database throughout my project. Is there a more effective way of connecting to a SQL database? or is my computer just bad and this should run faster?

    Read the article

  • Ajax request ERROR on IE

    - by tinti
    Hello all! I have a small problem on IE browser (actually on Google Chrome too) I have this js code function createDoc(url) { var xhttp = ajaxRequest(); var currentLocationBase = window.location.href; currentLocationBase = currentLocationBase.substr(0,currentLocationBase.lastIndexOf("/") + 1); var u = currentLocationBase + url; xhttp.open("GET", u, false); xhttp.send(null); var xml = xhttp.responseXML; return xml; } /** * Builds an AJAX reques handler. * * @return The handler. */ function ajaxRequest() { var xhttp = null; if (window.XMLHttpRequest) { xhttp = new XMLHttpRequest(); } else if (window.ActiveXObject){ // Internet Explorer 5/6 xhttp = new ActiveXObject("Microsoft.XMLHTTP"); } else { } return xhttp; } In Firefox this code works great, but not in IE and Google Chrome Seems that the error is given at the line xhttp.open("GET", u, false); Can anyone help me to understand what i'm doing wrong? Thanks

    Read the article

  • Clarification of a some code

    - by Legend
    I have come across a website that appears to use Ajax but does not include any js file except one file called ajax.js which has the following: function run(c, f, b, a, d) { var e = null; if (b && f) { document.getElementById(b).innerHTML = f } if (window.XMLHttpRequest) { e = new XMLHttpRequest() } else { if (window.ActiveXObject) { e = new ActiveXObject(Microsoft.XMLHTTP) } } e.onreadystatechange = function () { if (e.readyState == 4) { if (e.status == 200 || e.statusText == "OK") { if (b) { document.getElementById(b).innerHTML = e.responseText } if (a) { setTimeout(a, 0) } } else { console.log("AJAX Error: " + e.status + " | " + e.statusText); if (b && d != 1) { document.getElementById(b).innerHTML = "AJAX Error. Please try refreshing." } } } }; e.open("GET", c, true); e.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); e.send(null) } Like you might have guessed, the way it issues queries inside the page with queries like this: run('page.php',loadingText,'ajax-test', 'LoadSamples()'); I must admit that this is the first time I've seen a page from which I could not figure how things are being done. I have a few questions: Is this Server-Side Ajax or something similar? If not, can someone clarify what exactly is this? Why does one use this? Is it for hiding the design details? (which are otherwise revealed in plain text by javascript) How difficult would it be to convert my existing application into this design pattern? (maybe a subjective question but any short suggestion will do) Any suggestions?

    Read the article

  • How to check Isavailablity in ajax?

    - by udaya
    Hi This is what i have in my view page <td width=""><input type="text" name="txtUserName" id="txtUserName" /></td> <td><input type="button" name="CheckUsername" id="CheckUsername" value="Check Availablity" onclick="Check_User_Name();"/></td> Onclick of the button the Check_User_Name function in my ajax.js loads This is the Check_User_Name function function Check_User_Name(source) { var UserName = document.getElementById('txtUserName').value; if(window.ActiveXObject) User_Name = new ActiveXObject("Microsoft.XMLHTTP"); else if(window.XMLHttpRequest) User_Name = new XMLHttpRequest(); var URL = newURL+"ssit/system/application/views/ssitAjax.php"; URL = URL +"?CheckUsername="+UserName; User_Name.onreadystatechange = User_Name_Fun; User_Name.open("GET",URL,true); User_Name.send(null); } function User_Name_Fun() { document.getElementById('User_div').innerHTML=User_Name.responseText; } Then I can have the value in echo username then the $result has all the user name Hows can i checkIsavailablity of username from here if(($_GET['CheckUsername']!="") || (isset($_GET['CheckUsername']))) { echo $UserName = $_GET['CheckUsername'];//echo username $_SESSION['state'] = $State; $queryres = "SELECT dUser_name FROM tbl_login WHERE dIsDelete='0'"; $result = mysql_query($queryres,$cn) or die("Selection Query Failed !!!");

    Read the article

  • Download Canvas Image Png Chome/Safari

    - by user2639176
    Works in Firefox, and won't work in Safari, or Chrome. function loadimage() { var canvas = document.getElementById("canvas"); if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); xmlhttp2=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { rasterizeHTML.drawHTML(xmlhttp.responseText, canvas); var t=setTimeout(function(){copy()},3000) } } xmlhttp.open("GET","/sm/<?=$sm[0];?>",true); xmlhttp.send(); } function copy() { var canvas = document.getElementById("canvas"); var img = canvas.toDataURL("image/png"); document.getElementById('dl').href = img; document.getElementById('dl').innerHTML = "Download"; } Now I didn't write this, so I don't know too much javascript. But the script works in Firefox. In Chrome, getting: Uncaught Security Error: An attempt was made to break through the security policy of the user-agent. For toDataURL("image/png")

    Read the article

  • parentNode.parentNode.rowindex to delete a row in a dynamic table

    - by billy85
    I am creating my rows dynamically when the user clicks on "Ajouter". <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script> function getXhr(){ var xhr = null; if(window.XMLHttpRequest) // Firefox and others xhr = new XMLHttpRequest(); else if(window.ActiveXObject){ // Internet Explorer try { xhr = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } } else { // XMLHttpRequest not supported by your browser alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest..."); xhr = false; } return xhr } /** * method called when the user clicks on the button */ function go(){ var xhr = getXhr() // We defined what we gonna do with the response xhr.onreadystatechange = function(){ // We do somthing once the server's response is OK if(xhr.readyState == 4 && xhr.status == 200){ //alert(xhr.responseText); var body = document.getElementsByTagName("body")[0]; // Retrieve <table> ID and create a <tbody> element var tbl = document.getElementById("table"); var tblBody = document.createElement("tbody"); var row = document.createElement("tr"); // Create <td> elements and a text node, make the text // node the contents of the <td>, and put the <td> at // the end of the table row var cell_1 = document.createElement("td"); var cell_2 = document.createElement("td"); var cell_3 = document.createElement("td"); var cell_4 = document.createElement("td"); // Create the first cell which is a text zone var cell1=document.createElement("input"); cell1.type="text"; cell1.name="fname"; cell1.size="20"; cell1.maxlength="50"; cell_1.appendChild(cell1); // Create the second cell which is a text area var cell2=document.createElement("textarea"); cell2.name="fdescription"; cell2.rows="2"; cell2.cols="30"; cell_2.appendChild(cell2); var cell3 = document.createElement("div"); cell3.innerHTML=xhr.responseText; cell_3.appendChild(cell3); // Create the fourth cell which is a href var cell4 = document.createElement("a"); cell4.appendChild(document.createTextNode("[Delete]")); cell4.setAttribute("href","javascrit:deleteRow();"); cell_4.appendChild(cell4); // add cells to the row row.appendChild(cell_1); row.appendChild(cell_2); row.appendChild(cell_3); row.appendChild(cell_4); // add the row to the end of the table body tblBody.appendChild(row); // put the <tbody> in the <table> tbl.appendChild(tblBody); // appends <table> into <body> body.appendChild(tbl); // sets the border attribute of tbl to 2; tbl.setAttribute("border", "1"); } } xhr.open("GET","fstatus.php",true); xhr.send(null); } </head> <body > <h1> Create an Item </h1> <form method="post"> <table align="center" border = "2" cellspacing ="0" cellpadding="3" id="table"> <tr><td><b>Functionality Name:</b></td> <td><b>Description:</b></td> <td><b>Status:</b></td> <td><input type="button" Name= "Ajouter" Value="Ajouter" onclick="go()"></td></tr> </table> </form> </body> </html> Now, I would like to use the href [Delete] to delete one particular row. I wrote this: <script type="text/javascript"> function deleteRow(r){ var i=r.parentNode.parentNode.rowIndex; document.getElementById('table').deleteRow(i); } </script> When I change the first code like this: cell4.setAttribute("href","javascrit:deleteRow(this);"); I got an error: The page cannot be displayed. I am redirected to a new pagewhich can not be displayed. How could I delete my row by using the function deleteRow(r)? table is the id of my table Thanks. Billy85

    Read the article

  • How do HttpOnly cookies work with AJAX requests?

    - by Shawn Simon
    JavaScript needs access to cookies if AJAX is used on a site with access restrictions based on cookies. Will HttpOnly cookies work on an AJAX site? Edit: Microsoft created a way to prevent XSS attacks by disallowing JavaScript access to cookies if HttpOnly is specified. FireFox later adopted this. So my question is: If you are using AJAX on a site, like StackOverflow, are Http-Only cookies an option? Edit 2: Question 2. If the purpose of HttpOnly is to prevent JavaScript access to cookies, and you can still retrieve the cookies via JavaScript through the XmlHttpRequest Object, what is the point of HttpOnly? Edit 3: Here is a quote from Wikipedia: When the browser receives such a cookie, it is supposed to use it as usual in the following HTTP exchanges, but not to make it visible to client-side scripts.[32] The HttpOnly flag is not part of any standard, and is not implemented in all browsers. Note that there is currently no prevention of reading or writing the session cookie via a XMLHTTPRequest. [33]. I understand that document.cookie is blocked when you use HttpOnly. But it seems that you can still read cookie values in the XMLHttpRequest object, allowing for XSS. How does HttpOnly make you any safer than? By making cookies essentially read only? In your example, I cannot write to your document.cookie, but I can still steal your cookie and post it to my domain using the XMLHttpRequest object. <script type="text/javascript"> var req = null; try { req = new XMLHttpRequest(); } catch(e) {} if (!req) try { req = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) {} if (!req) try { req = new ActiveXObject("Microsoft.XMLHTTP"); } catch(e) {} req.open('GET', 'http://beta.stackoverflow.com/', false); req.send(null); alert(req.getAllResponseHeaders()); </script> Edit 4: Sorry, I meant that you could send the XMLHttpRequest to the StackOverflow domain, and then save the result of getAllResponseHeaders() to a string, regex out the cookie, and then post that to an external domain. It appears that Wikipedia and ha.ckers concur with me on this one, but I would love be re-educated... Final Edit: Ahh, apparently both sites are wrong, this is actually a bug in FireFox. IE6 & 7 are actually the only browsers that currently fully support HttpOnly. To reiterate everything I've learned: HttpOnly restricts all access to document.cookie in IE7 & and FireFox (not sure about other browsers) HttpOnly removes cookie information from the response headers in XMLHttpObject.getAllResponseHeaders() in IE7. XMLHttpObjects may only be submitted to the domain they originated from, so there is no cross-domain posting of the cookies. edit: This information is likely no longer up to date.

    Read the article

  • stop javascript execution

    - by alemjerus
    When I run javascript script file in windows command line environment, and there is a free text coming after my code. How can I stop javascript interpreter to run into it? For example: var fso = new ActiveXObject("Scription.FileSystemObject"); delete fso; exit(); // some kind of WORKING exit command Lazy frog ate a big brown fox.

    Read the article

  • javascript select box hanging on second select in ie7

    - by bsandrabr
    I have a drop down select box inside a div. When the user clicks on change, a dropdown box appears next to the change/submit button and the user makes a selection which then updates the db and the selection appears instead of the dropdown. All works fine in IE8 and firefox but in IE7 it allows one selection (there are several identical dropdowns) but the second time a selection is made it hangs on please wait. This is the relevant code <td width=200> <input type="button" onclick="startChanging(this)" value="Change" /></td> <script type="text/javascript"> var selectBox, isEditing = false; var recordvalue; if( window.XMLHttpRequest ) { recordvalue = new XMLHttpRequest(); } else if( window.ActiveXObject ) { try { recordvalue = new ActiveXObject('Microsoft.XMLHTTP'); } catch(e) {} } window.onload = function () { selectBox = document.getElementById('changer'); selectBox.id = ''; selectBox.parentNode.removeChild(selectBox); }; function startChanging(whatButton) { if( isEditing && isEditing != whatButton ) { return; } //no editing of other entries if( isEditing == whatButton ) { changeSelect(whatButton); return; } //this time, act as "submit" isEditing = whatButton; whatButton.value = 'Submit'; var theRow = whatButton.parentNode.parentNode; var stateCell = theRow.cells[3]; //the cell that says "present" stateCell.className = 'editing'; //so you can use CSS to remove the background colour stateCell.replaceChild(selectBox,stateCell.firstChild); //PRESENT is replaced with the select input selectBox.selectedIndex = 0; } function changeSelect(whatButton) { isEditing = true; //don't allow it to be clicked until submission is complete whatButton.value = 'Change'; var stateCell = selectBox.parentNode; var theRow = stateCell.parentNode; var editid = theRow.cells[0].firstChild.firstChild.nodeValue; //text inside the first cell var value = selectBox.firstChild.options[selectBox.firstChild.selectedIndex].value; //the option they chose selectBox.parentNode.replaceChild(document.createTextNode('Please wait...'),selectBox); if( !recordvalue ) { //allow fallback to basic HTTP location.href = 'getupdate.php?id='+editid+'&newvalue='+value; } else { recordvalue.onreadystatechange = function () { if( recordvalue.readyState != 4 ) { return; } if( recordvalue.status >= 300 ) { alert('An error occurred when trying to update'); } isEditing = false; newState = recordvalue.responseText.split("|"); stateCell.className = newState[0]; stateCell.firstChild.nodeValue = newState[1] || 'Server response was not correct'; }; recordvalue.open('GET', "getupdate.php?id="+editid+"&newvalue="+value, true); recordvalue.send(null); } } </script> If anyone has any idea why this is happening I'd be very grateful

    Read the article

  • svn dump fails with WScript.Shell

    - by chandrajeet
    var WshShell = new ActiveXObject("WScript.Shell"); var commandLine = "svnadmin dump " + repoFullPath + " > " + repoName + ".dumpfile"; WshShell.Exec(commandLine) I am trying to run above cscript in windows but it seems like, it's doing nothing. It doesn't create the dump file. Any mistake that I am doing? Thanks,

    Read the article

  • Xsl mime type problem

    - by savruk
    Hi, I have a busybox with lighttpd running on as http server. My problem is while firefox and opera can get the page with applied xsl, Arora(webkit) can not. Here is the script I use to get it work: <html> <head> <script> function loadXMLDoc(dname) { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest(); } else { xhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xhttp.open("GET",dname,false); xhttp.send(""); return xhttp.responseXML; } function querySt(ji) { hu = window.location.search.substring(1); gy = hu.split("&"); for (i=0;i<gy.length;i++) { ft = gy[i].split("="); if (ft[0] == ji) { return ft[1]; } } } function displayResult() { xml=loadXMLDoc("sample.xml"); alert(xml)//Gives [object Document] $scan=querySt("scan"); $sub = querySt("sub"); xsl=loadXMLDoc("sample.xsl"); alert(xsl)//Gives Null // code for IE if (window.ActiveXObject) { ex=xml.transformNode(xsl); document.getElementById("example").innerHTML=ex; } // code for Mozilla, Firefox, Opera, etc. else if (document.implementation && document.implementation.createDocument) { xsltProcessor=new XSLTProcessor(); xsltProcessor.importStylesheet(xsl); xsltProcessor.setParameter(null,"scan",$scan) if($sub != ""){ xsltProcessor.setParameter(null,"sub",$sub) } resultDocument = xsltProcessor.transformToFragment(xml,document); document.getElementById("example").appendChild(resultDocument); } } </script> </head> <body onload="displayResult()"> <div id="example" ></div> </body> </html> I tried to see if it load xsl well and put an alert(xsl) but it gives null. Other browser can get xml and xsl files perfectly. What can be the problem? Thanks P.S: It runs well on my local server with all browser.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8  | Next Page >