I've attached a cut-down version of a script I am working on. It's a pretty simple button with a function attached, which creates a random number and compares it with a preset value.I can't seem to get the function to read the variables
I've got a function displayResults(imageArray); that first calls removeElements(); to get rid of the currently displayed list items. Both functions are part of class function eventBox(array, string, date). both displayResults(imagearray); and removeElements(); have been bound to eventBox(); by e.g. this.removeElements = removeElements;
However, from within displayResults(imageArray); this.removeElements(this.identifier + "eventsul"); evaluates to "undefined". Also, this.identifier called from within the function also evaluates to undefined (it doesn't in other functions). For some reason I can't access global functions and variables from displayResults(imageArray);. Any ideas?
Here is the code for displayResults(imageArray); :
I have not been able to successfully qualify web control input box DOM characteristics within Javascript within .NET. Anyone able to figure this one out?
I need to embed a small piece of javascript inside xslt. Basically I need to generate a hyperlink dynamically. I need to access xslt variables and use it in the javascript to create the hyperlink. Then in the xslt, I need to access the javascript variable containing the dynamically created hyperlink.
I'm trying to set a variable which a remote page can access. I can do this, but I need to set this variable inside "window.onload = functio(){". When I do this the remote page can't access it. This is a breakdown of what I'm doing:
it seems to be a problem if I need to access data() of the elements from another window, like for example $(anyElement,window.opener.document).data() which returns null when in fact there is some data actually stored. I heard that data is stored in the $.cache, which is window-related, so that's understandable, but how can I work around that?
Certain plugins that use $.data no longer work correctly because of that. E.g., I can't use linkselectmethods on linkselects located in the window.opener.document. Again, is there any workaround?
I have 3 Jquery tabs on the form. Each tab contain same HTML Tables, I want to access the data in a Cell of a table in an active tab on the button click
in normal Case I use
var x=document.getElementById("searchResultTable").rows[10].cells; referenceNo=x[2].innerHTML;// get the value in the Cell alert( "x[2].innerHTML);
if i use this Code i get only the First Table data .All the Tabs Contains Same Table with Same Id and Name
I have got a following problem with using javascript:
I have a HTML page with pictures' thumbnails. After clicking on any thumbnail, I would like to open a new window with the original size picture. In the main window with thumbnails, I have got following important stuff: Code:
When retrieving JSON data I'm able to access individual elements using the $.each() function and iterate over them. However, how would I access just one element by its location and not by name? (i.e. data(0) not data.ID).
So I'm currently working on a ASP.NET Webforms site and I've run in to a small problem. On my .cs file I have the following Webmethod
[WebMethod] public static string IsJobEditable(int jobid){ try{ string isEditable = "false"; JobsBLL jbl = new JobsBLL(); int jobStatusId = jbl.GetJobStatusId(jobid); //If the jobs is either waiting or being edited it is okay to edit it if(jobStatusId == Convert.ToInt32(ConstantsUtil.JobStatus.Waiting) || jobStatusId == Convert.ToInt32(ConstantsUtil.JobStatus.Edit)){ isEditable = "true"; }return isEditable; }catch (Exception ex){ throw ex; }}
This function in this case will ALWAYS return TRUE as a string. On Aspx page I have the following $(function () { $.ajax({ type: "POST", url: "Coordination.aspx/IsJobEditable", data: "{jobid:" + jobid + "}", contentType: "application/json; charset=utf-8", dataType: "text", success: function (result) { alert(result);
//This is written out in the alert {"d":"true"} I want this in a variable as a string so I can do a check on it before I do some other actions. The format is not a String so I cannot split on it to retrieve the "true" part. }, error: function (err, result) { alert(err); } });});
As you can see in the comments the value I get back in the Callback method is in to me a weird format. The type is unknown and I need this value to be able to proceed with my entire method surrounding the small portion of the Javascript. Where to access the result variable / data as a var or anything else that will let me put it into a var (as a string).
I've been using some code to verify form data quite happily, but i've recently changed the way my form is structured, and I can't get it to work now.
Originally :
The form is called "form1", and I have selects called "PORTA", "PORTB" ... etc...
I then had javascript that accessed these selects as below, and it worked fine.
ind = document.form1.PORTD.selectedIndex; val = document.form1.PORTD.options[ind].value; dev = document.form1.PORTD.options[ind].text;
My form is now autogenerated, and form data is stored to file, so I now use an associative array for thte form elements (so that I can loop through them easily), The form elements names are now :
McuCfg[PORTA], McuCfg{PORTB} and so on
Now, I modified the javascript so that it now uses the McuCfg[] associative array :
ind = document.form1.McuCfg[PORTD].selectedIndex; val = document.form1.McuCfg[PORTD].options[ind].value; dev = document.form1.McuCfg[PORTD].options[ind].text;
When the script runs, I get the error
"document.form1.McuCfg.PORTD is null or not an object"
I have used the same notation that i know works for the "options" array although that's not an associative array.
I am working on a project using HTML and javascript to allow the user to choose a vehicle from a drop down menu, then load a new page showing some information about this vehicle. The information is stored in an Excel file. I posted regarding this issue a while back and got an excellent response from Old Pedant about using ActiveX - which has thus far worked perfectly. My initial condition was that I would only be using IE7+. However, my next idea was to be able to use it on an IPad (which I unfortunately do not own yet, making any kind of testing difficult) which I am fairly certain ActiveX won't work on. So, I was looking for any other method which would be similar.
Important note: this will not use the internet at all, all of these files will be available locally. There is a lot of material on running queries to servers, but I didn't think that would really apply here. It seems pretty clear that JS has difficulty accessing files client side (which I understand why completely), but I was hoping to find something that worked for the gray zone I'm currently working in since I'm not using servers at all.
I know that this is not really the intended use of HTML/JS, but I was hoping that by writing it as an HTML file, it'd be accessible to anyone with a browser. Some of my target computers have odd limitations (such as not being to download .exe files).The code I based my original off of is shown below:
<script type="text/javascript"> var conn = new ActiveXObject("ADODB.Connection") conn.Open ( 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:fullpath oMyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";)'; var sql = "SELECT * FROM [nameOfSheet$]"; var rs = conn.execute( sql )
You can use JQuery's data method (e.g. $('#MyID').data('MyVar', 'MyValue');) to easily store/retrieve information.
However, I was wondering if it is possible for my PHP generated page to add HTML tags that initialize the JQuery's data method variables. Regularly, I want server side variables to be accessible client side. It would be very helpful if I could initialize data method variables during PHP page generation.
If this is not possible, are there any suggestions on how to efficiently communicate server side variables to client side?
I have a frame in which there are 2 IFrames., both being loaded from the same domain. One IFrame is loaded from http://test1.xyz.com and the other IFrame is loaded from https://test1.xyz.com/test
I am getting an error while accessing data in the HTTP IFRAME from the HTTPS IFRAME.
Is it possible at all to access the data in the other IFrame, when the protocol is different?