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 know just enough javascript to be dangerous, I created a 5 star rater for pages, which is set up something like this:
Code: var starRater=function(id){ // get latest rating info from server, write into "id" div, etc } //later in code... var rating=new starRater("rating");
Over the course of development I added a comment section, page visit count and so forth, and ended up with redundant code and a lot of calls to the server. I thought instead I would make one initial call and then initialize the elements with the information returned.
To be able to call the initialize function on these elements, I need some reference to them. I could call them directly, as in the example above I could call rating.init(), but I'd have to know what variable name was given to it. Instead I was thinking I'd pass some sort of reference to the object, but that doesn't seem to be working.
[Code]...
In the code above I get undefined for raterElem.testVar. Obviously I'm missing something. What am I doing wrong?
console.log(details.ring); // why does this return gold and not silver if req is passed by reference and we already changed its value above and so it's pointing to the same memory position?
I have implemented an Ajax object - a div containing another ASP file which can be updated dynamically. This ASP page has a number of checkboxes. Is it possible to use JS (or any other tool) to check the checkbox status (i.e. like javascript's if (field.checked)
[Code]....
But now the form is in the Ajax object's ASP file, so "document" wouldn't work.
I am trying to make a function that checks/unchecks a checkbox when a specific <td> is clicked. I need to use this same function for several checkboxes in the page so I want to just pass it the name of the checkbox I want to affect as a variable and use it in the object reference lines. BUT, this doesn't work. I can pass the variable to the function as I've used alert(variable) to test this. But it doesn't work when I put it in a line like this "document.forms[0].variable.checked=true;". Code:
I have a function that changes the innerHTML of a DIV element. I want to pass to that function as a parameter a reference to the DIV to be changed. In the example below it works the first time (executed with the body onLoad event). As the subsequent function declaraton is rewritten by the function itself, it can no longer reference the targeted DIV. I tried to pass a string teference and use eval(), but this time it fails the third time it is executed.
Code: <html> <head> <title>Passing Parameters to a Function (with object prameter)</title> <script type="text/javascript">
I had a script that was acting unexpectedly because of a function parameter. I was trying to pass a jquery object through a function to attach some events. I was wondering if someone could tell me why this didn't fly:
I created a quick plugin. You can see it at http: [URL]. It has a strange feature. This plug-in treats the jQuery wrapper object as a group, and passes the whole wrapper in as the context object (the "this") for the functions supplied. Generally, when functions are supplied as parameters, either the context is irrelevant, or each DOM element in the jQuery wrapper is passed. But I don't do that. My plug-in keeps a reference to the jQuery wrapper and calls the functions in that context. This is necessary, because the whole idea is to act on a number of elements as a group -- in this case by fading in and out all members of the group when any individual one is hovered -- but I don't recall seeing this done elsewhere in the jQuery ecosphere.
So, I read about the new method of passing an object map containing element properties when creating a new jQuery object (as discussed at the bottom of this article). The article says that it supports ALL events, but only gives examples of simple events that require no parameters. I'm trying to implement a live event using the following and can't get it to work:
var link = $('<a />', { text: config.appendTextMore, href: "#",
I am using a Photo Gallery script called Galleria which uses jQuery/JavaScript to display photos. On my index page load (only in Internet Explorer), a message box pops up saying "Message from Web Page [object Object]". After clicking OK the photo gallery loads and there is no problem.No idea how to fix this, or really what the error means. You can view the error from my site here
I have two events in a form that I am passing. One is to a javascript function, the other is to the same .asp page only with another action to show different data.
Onchange is calls the function updateclasses, which in turn reloads another drop-down list. It also reloads the .asp page, which refreshes the data. My problem is that it refreshes the second drop-down briefly, until the page reloads, but then resets the form. How do i pass this data to the .asp?
I thought in the .asp, I could just do something simple like the following, but wasn't sure of the correct syntax. is there a better way?
view = request.querystring("view") if view = "" then view = "SciLink" else %> <script language="JavaScript"> updateclasses(form1, 0, Student) </script> <% end if
im having a problem making a checkbox, button or radio input equal to that of the loop, in this case 'count'. When i print count out with the normal document.write(count); it all works correctly. but this wont help me.
Instead the result is always the last number =/ (onclick is temporary, im just using it to check the value passed)
I am working on an application in which monthly calendars of events are to be generated. When the page is initially loaded, the current month's calendar is generated using Javascript; the user can also move forward to the next month or backward. For each month, I need to be able to retrieve server-side data (using PHP/MySQL) to fill each day-cell ("td"+i, below) of the calendar with events for that day which reside in the server-side database, keyed by date. Here is a snippet of the code that generates the days of a given month:
var d = 1; for (i = 0; i < 42; i++) { var elem; var elem = eval(document.getElementById("td"+i)); //the day cell elem.innerHTML = ""; if (i >= startingPos && i < lastpos){ elem.innerHTML = d d += 1; . . return;
In short, I need to get data from the database as the days are created (elem.innerHTML = d, above) or get all the data for the chosen month (probably more efficient), and send it back to the Javascript where it can be parsed and loaded to the appropriate cell(s) in the calendar.
A while back I was working on learning C++. However after finding out that making API's was too difficult I switched over to HTML and Javascript for a while to get it to do what I want without having to fry my brain on weird code statements.
Well now I've reached the barrier of being able to save data. For a while I've just had it to the point where the code I need is saved in a textarea and I copy and paste it in notepad. Then upon reentering I pull it out of Notepad and paste into the testarea.
Well enough with the bla bla bla. Is there a way I can use the <form method="post"> stuff to pass a variable to a C++ compiled program?
All I need to know is: 1) can I use <form method="post" action="SomeProg.exe"> and 2) what would the name of the posted variable be to use in my C++ code? As you can tell I running client-side so PHP and other server-side languages that WinXP don't support without special installation wont work.
I've been searching for a few hours and haven't been able to find a code snippet to see if this is available. I'm attempting to pass text from my website to another website that has a form setup on it. I'd like to fill in the pertinent data for my users on the page that I load for them. I cannot make any changes to the receiving page as it is run by another company. I've pasted some of the code that is available on the receiving form.
<script type="text/javascript"> //<![CDATA[ var theForm = document.forms['form1']; if (!theForm) {
I'm having a problem passing a variable through a URL because the variable is supposed to hold a URL that has a variable of its own. Here is an idea of what I'm trying to do:
This may be more of a Java question, but I feel that JavaScript experts may be more qualified to help me find a solution.
In short: is it possible to call a Java method from JavaScript, passing as an argument a JavaScript array (in my case, an array of doubles)?
Supposing I have array x containing only doubles, I have tried: document.MyApplet.myMethod(x);
But the method only ever seems to receive "null" as an argument. Conversely, if I try this with a String, or a single character, or almost anything else, there isn't a problem. Any ideas?
For ease of future modifications on my page, I want to have a list of URLs stored in an Array, and I want to then use these URLs in an href tag. Something like this:
How is something like this possible, as well as being fairly crossplatform, and intuitive? I've changed the syntax, and tried various other things to no avail.
What I want is a loop that will call the same function until it reaches a certain number (let's say 10). Then I want the function to take the parameter passed (the number) and use it in the function where ever you see a 1 below. Basically I want it to run on each element of the pub_name array and from the info gathered define a variable based on the number (example: display_pub_name_*). I have run some tests .....
I just want to know how can i pass the return value of a javascript function to a xsl variable.
I have an xsl file and from that file i will call a javascript function then the result will be stored in to the <xsl:variable> how will i do that? Or is it really possible to do that or is there other way of doing it?