I'm not overly proficient at Javascript, but have fumbled my way through some tutorials to come up with the following code to create a tab mechanism.
It works perfectly in Firefox, Safari, Chrome and IE8. However, in IE6 and IE7 it fails to operate as of the 'for (var i in temp) {' line. It doesn't error out, it just doesn't perform any of the functions within the for.
Some things I've noted: * In Firefox if I alert(i) below the for, then it alerts the numerical value of i correctly through the for loop. * In IE7, however, alert(i) alerts the value 'toJSON' and nothing more. It never finds 'if (i <= maxlen) {' to be true as a result.
I have a drag n drop function that takes the position in my db and that puts it in the good order on the screen I can move my boxes around that's all ok but when i move a boxes it's supposed to send it to my db and the line where it doesn't work is:
I'Ve put the section in blue at the bottom of the script:
Is there anyway to get the value returned from the prompt in the statement above, into the value of the statement below ?
<input type=hidden name="comment_text" value = ???? >
We would like the user to click the "comment" button, have another window popup where they enter their comment, and then take the comment text and append it to the value parameter of the hidden statement.
The following code is supposed to return a variable containing text, currently the code posts the data but returns an "undefined" variable. Can someone tell me what's wrong? code...
I am trying to turn all the bullet points Li id values so i can store them.. I have written the code below but all this does it return the number of li's, everything i have done to bring out the id of the li, it fails. Code:
I know this is probably a really simple this to do, but for the life of me I can't figure it out. I want to find out the value of a style for a certain element. So say in the CSS I said 'content' had a width of 100px, but I want to get that value with Javascript.
None of my getElementById (or other) references produce anything but "undefined." This occurs in the latest versions of Fx, IE, Chrome, and Safari, so it must be something I am doing but not not seeing here. I have boiled it down to the following without success, and wonder whether there is some add on interaction. Fx 3.6.12 has the problem with this code: <code> <html> <head> <title>This is a test of getElementById</title> </head> <body> <div id="area" name="area_name">xxx</div> <script type="text/javascript"> var divs = document.getElementsByTagName('div'); var msg = ''; msg = 'Divs[0] contains ' + divs[0] + ' with width = ' + divs[0].width + " "; msg +='Test area width by id = ' + document.getElementById('area').width + " "; msg +='Test area width by name = ' + document.getElementsByName('area_name').width; alert(msg); </script> </body> </html> </code>
I've created a script that should display a certain image based on the day of the week and the time of the day. After uploading the page to the site I receive no errors, however I'm not getting the display I should be seeing. It always returns the image from the final "else" statement. I'm thinking the problem is that I have two "&&" operators in each "if" statement, and I don't have the proper syntax, or perhaps I'm not writing it properly. Code:
Need some help with my For loop. The issue is that, my loop is only returning the values of the last item in the js file. I want the select box to include all possible names.
This function was working in Safari but not in Firefox. I was referencing a couple of elements using the forms[] array instead of getElementById(). I changed those refernces to use getElementById() and now the calculateTotals function does not work in Safari or Firefox.
So I did an alert box to see ucell and it was null. I tried two more alert boxes for the id I was passing to getElementById and for the id of the actual element on the page (which was also created dynamically). They were both identical. The element is created in the onload event, and I am not calling the calculateTotals function until there is onchange event on a text box. So it is not that the element has not been created yet. . Code:
Is there any way of returning all the fields in a layer? I got a bunch of input fields grouped in different layers inside a form. When someone changes something in one input field in that LAYER, I want it to validate the whole layer, but not the whole form.
Is there anyway of returning all the input fields in that layer as a collection perhaps?
So for whatever reason the convertToArray function in the following code returns false if the argument is more than 1 character long. If it's 1 character long it just returns the character as an array with only one value.What I'm trying to do is take a string of numbers, plus signs, and minus signs and convert it to an array.
My getElementsByTagName ("a"); is not returning anything. (well it's returning "0" not the value I should be getting) I'm asking it to find the number of links on my simple html page. (the reason I'm even doing this is just because I'm trying to learn javascript) but the console in Firefox and the Alert window are just returning "0" when it should tell me I have "4" right?
the files are both located in the same folder, locally
this is my scripts.js file
Code: var linksAmount = document.getElementsByTagName("a"); alert("Amount of Links:",linksAmount.length); console.log("Amount of Links:",linksAmount.length); and this is my html file (it's very small)
I have a script for creating 3 dependent dropdown menu. Selection A in 1st drop Down returns Selection B in 2nd drop Down which returns Selection C in 3rd and final drop down To C I would like to attach a string of 3 value (prices). I was thinking of using the array var A_B_C = new Array(45, 275, 400); But I am not to sure how to link it to the code?
Currently, I'm building a website with jQuery. The function below helps me to get content from a database. In the file content_ajax.php there are some functions to handle ajax-requests. JS calls the PHP-function correctly (I've send an email to myself inside that function to check) but the script doesn't return 'succes' and doesn't give me an error...Also, when I put an alert inside the succes and error function, it doesn't popup!
What may be relevant: - site uses mod_rewrite for friendly url's
I have this basic code following and its not returning anything at all. Even the alert is not alerting. I have checked and the select is sending the value fine But nothing happens on return. What i am missing?
I have a bunch of divs with the same classname, 'mediafield':
And I have this jquery code in my header:
So I know that the click function is getting implemented.. The alert box appears however I get the following error in firebug: uncaught exception: Syntax error, unrecognized expression:[@class=mediafield] Line 0
Nothing happens when firebug is turned off... So I'm not sure why it's throwing the error.
I'm working on a small project and want to create a simple dialog window. I know I can use a plug-in, however that is a bit of a over kill plus its a good way to learn more about jquery.
So everything was going well until clicking the button. I cannot find a way to return the value of what button was pressed so I can take further action within the function.
I have the hover event set up. There are 100 elements in my document of the class square. What I want to do is return the ID of the current square that is hovered and edit the style=' ' attribute of the .square with that specific ID.
Basically what I'm trying to do is write a plug in which connects to a sharepoint web service, traverse the results of the xml document that is returned by the web service for certain elements, and then return a collection of xml elements which I can use in another function on the page that is calling the plugin.My code looks like this:Main Page
<script type="text/javascript"> $(document).ready(function() { var listItems = $.sharepoint();
As an exercise, for the past few days I've been attempting to build a simple search and return data to a page.
The form parses vars to PHP with no refresh PHP gets stuff from the database PHP echos an array Array is output using Jquery in my #result div
Things seem to be working nicely, and the array is indeed coming out the other end.
My next aim was to be able to do something with the output. The first step I assumed would involve printing that array to a table. It's this that I'm having trouble with. I can't figure out the syntax.
With regards to the following code, I think the success function on line 32 and 33 should be something like:
$.each(something something) more something's with TD's and TR's interspersed
The code I have so far is as follows. This successfully echos out the contents of the array, but ultimately isn't useful without being able to access the elements.