I'm currently constructing a javascript "terminal" on a site I'm building so that I can test objects and functions outside of the web developer terminal in google chrome.
Given that I have active javascript defining an object called item, typing item in the chrome terminal returns Object and goes on to list the properties of item.
Moreover, I can define a function in the terminal like this: function(x) { return x }, and then function(item) will return Object and list the properties. However, if I use form data and user input in the place of the argument, the datatype becomes a string and not an object, so typing item in the form and clicking a button that performs function(document.form.text.value) returns the string item and not Object.
Is there any way to convert this primitive string to an object so that I can then iterate through properties, and so on?
I was having trouble getting the object.focus() method in IE and in FF working, so came up with this workaround.
What I wanted to do was check if a textfield was numeric, if not, inform the user then select the text and set the focus back to the field.
Sound simple? object.focus() simply doesn't work in firefox or (I've been informed) IE.
Solution:
Instead of checking when the field losing focus (onblur), check when the next field receives focus (onfocus). Then call a function that gets the element index of the object, and use that index to check the element above it. Difficult to explain.
Here it is...for the textfield you want to check, put this into the next form object after it onfocus="checkNum(this)"
then put this script in the header section...
function checkNum(obj){ var idx; //get object index for(idx=0;idx<document.forms[0].elements.length;idx++){ if(document.forms[0].elements[idx].name==obj.name){ break; }; }; //check for numeric if (isNaN(document.forms[0].elements[idx-1].value)){ alert('Value must be a number!');
I get the "myerrorobject.filename" in the alert-Box, but I get an "undefined"-error, if I try to access myerrorobject.filename (or other properties) in the function "my_function". Why?
I'm having trouble sending JSON data; error msg [code]it works if i hard-code the values, but when i use the user-defined variables i get the error.[code]
we probably all know the problem that select boxes under IE are always overlap DIV layers. Afaik there are two workarounds:
1. hiding the select box 2. IFrame beneath the DIV layer
But I don't know how to do that.
We want to show a DIV layer as tooltip. The DIV layer has no defined size (neither a width nor a height attribute). The size depends on the text the user defined for the tooltip.
My questions:
1. How can I know when the tooltip is 'over' a select box, so I can hide it.
2. How can I define an IFrame that has the same size as the tooltip, when I don't know the tooltip's size?
This bit isn't mine, I found it. You normally have to use this by copying it and then pasting it into the address bar when you are on the "Select Friends" screen.
I have developed a widget. I am using the jquery core api. Im having a problem when the widget is used in a weebly site. I know weebly uses prototype and I am using the workaround:
var $j = jQuery.noConflict(); however there is still a clash of some sort. I think every prototype.js function is being called or something because the page is taking a long long time to load as there are many requests being made which look like this:
I was calling a function in a js file from an image onClick event, but someone still using Netscape 4 (!) complained that it didn't work. I read that img onClick doesn't work in Netscape 4, so swithced it to "javascript:show(...);" and the code works, but I read in this group that it was not wise to do that, here's the working version, using the not recommended approach:
I dynamically make a textarea and save the text, but when I try to output it with javascript, the newlines screw it up... if you don't understand what i mean, here is some code:
Code:
With that newline in javascript, the javascript throws an error. i am working in jsp, so how would i change the text that is put into the textarea with javascript without changing the newlines?
mailto protocol and Notes v6.5.5 which duplicates the address in the To: field (not a valid email address) and/or posts form data in the To:, cc, or Subject: field rather than in the body of the email where it belongs. I created an entire site relying on the mailto: protocol to submit requests. (Can't use either server side apps or cgi email. Don't ask - it's a long and rediculous story.) Anyway, then we got the new release of Notes and the whole thing has been rendered useless for request submissions.
Is it possible to write a script that will duplicate the mailto: form action and keep it client side? Big hurdle is that it has to pull info from all types of form elements, just like the mailto: protocol does with email clients that actually support it properly.
But when I mouse-over the link, the %27 shows in the status bar as a ' and when I click on it, I get a JS error because of the extraneous '. The +s are not being decoded - why is this one character, and is there a way to prevent it?
I have a string that is encoded simply by replacing the letter with the next letter in the alphabeta. I need a function to convert it back. Following is the function:
function cnvtBack(encoded) { var orig = ""; for (i=0; i < encoded.length; i++) { var letter = ""; letter = encoded.charAt(i); if (letter > 'a' && letter <= 'z') letter = <<previous letter in alphabeta >> // HOW? orig += letter; } }
Is there a free js library for doing unit conversions? I am putting together an app that needs to convert volume and weight, among others. You'd think that one exists, but I have yet to find it.
so my professor suddenly took a left turn in class and we jumped from using HTML and CSS to programing in Javascript. It's not even covered in the book we're using for a text book. So I'm having some problems with it (big surprise right?) My assignment: Write a Java Script that will print out the Temperature in Celcius from 0 to 35, AND the corrosponding temperature in Fahrenheit. So basically it would generate the following:
0 Degrees in Celcius is Equivalent to 5 Degrees Fahrenheit 1 Degrees in Celcius is Equivalent to 6.125 Degrees Fahrenheit 2 Degrees in Celcius is Equivalent to 7.25 Degrees Fahrenheit 3 Degrees in Celcius is Equivalent to 8.375 Degrees Fahrenheit and all the way down to 35 degrees.
Im need to create a conversion-script for a company that do step-competitions. You should be able to input a time-variable, choose what activity you did from a drop-down meny, click convert ("omvandla" in swedish") and the script prints what that is equal to in steps. I found a code online that does other conversion so i just redid that code to fit my demands. Everything looks alright in the browser, but the script doesnt print anything when i click "omvandla". Forgive me for posting the entire code, which is pretty long. But most of the code is just repetition, cause you have 58 types of activities to choose from.
Some words are in swedish, but the only two i think you need to understand is:
i've found out how to find the distance between 2 lat lng points using google's distanceFrom method:
Code: // NR14 7PZ var loc1 = new GLatLng(52.5773139, 1.3712427); // NR32 1TB var loc2 = new GLatLng(52.4788314, 1.7577444); alert(loc2.distanceFrom(loc1) / 1000);
However, I'd like to be able to convert a distance to lat lng. The main reason I'm doing this is so that I can figure out the bounds of a certain area of a co-ordinate. For example I specify a point, and then I need to draw a box around this area going x distance North, South, East and West, but until I know how many units make up a kilometre this wont be easy.
I guess I could go to google maps, click on a point and then click on another point and keep doing that until I get exactly 1km away from the original point, then just minus or plus for the lat and lng to find out the unit value for 1km, but I have a feeling that this wont be accurate. Can anyone lend any advice, I realize that what I'm asking is more a map question than a google maps javascript api question, but perhaps someone has come across this before?
Is it possible to convert a document file to an image using javascript? Anyone ever tried it? Please suggest any codes for it because I've done my research and I see it only working for php, java and other languages.