nogray
Members-
Posts
930 -
Joined
-
Last visited
Everything posted by nogray
-
Cancel mousedown/move events with mouseup event
nogray replied to UrbanDweller's topic in Javascript Help
Without seeing all the code it's hard to tell where the error is. Are you adding the mouse move event to the document or the parent element? your onmouseup remove the event from the document. Second issue you would have to deal with is when the mouse move out of the area (but the user didn't leave the button). The onmouseup event won't be triggered because of that, so you would need to check onmouseout. The easiest way to do this is to sent the mousedown and mouseup on the document and use the target in your event to find out if the moveable element was cliicked. -
change writing direction in a textarea box when user change language
nogray replied to lofaifa's topic in Javascript Help
you would actually check the character and compare it to a list of pre-determined characters for different languages. E.g. If I start typing "Something..." you would check the S and find it's not a RTL language If I start typing "هذا" you would check the characters to your list and determin it's a RTL. Since most languages are LTR, you only need to check if the character is a RTL language character or not. -
change writing direction in a textarea box when user change language
nogray replied to lofaifa's topic in Javascript Help
JavaScript can't tell when the user change the language, what you can do is check the last character the user type and compare it to the language letters and change the directions accordingly. There will be some characters that you should ignore (like ., and numbers) -
If the field was not disabled and you called the function, the first if statment will disable it and the second if statment will check if it's disabled (and it's because the first if statment) and enable it. instead you can if else statment instead of two if statments.
-
if (document.forms['form']['targetname'].disabled = false) needs == for comparson, same with the other if statment and your if statments will cancel each other if the field is disabled. Maybe you need to use else if.
-
Javascript doesn't have a method called empty. You would have to compare the value to empty string (e.g. val == ''). To add content to an array, you would use the push method (e.g. my_arr.push('my value'); )
-
You can just add the variable in your html page before you include the scripts, using dannyb785 example, you can just replace the javascript part by <script type="text/javascript"> var my_step_min = <?php echo $stepMinute; ?>; </script> ... later on your js file ... // check if my_step_min is defined, if not, create a default value ..... ..... timeformat:'h:m', stepMinute:my_step_min} .....);})
-
You can't access the css properties using obj.style.prop unless it's an inline style. You would need to use currentStyle
-
Trying to display nodes using getElementsByTagName
nogray replied to Wolverine68's topic in Javascript Help
Change alert(content[i].childNodes.innerHTML); to alert(content[i].innerHTML); -
Changing the selected value in the option after the menu is created won't do anything. You need to change the select menu selectedIndex to the option index (e.g. loop through the options and compare values, when you have a match set the selectedIndex to i)
-
Trying to display nodes using getElementsByTagName
nogray replied to Wolverine68's topic in Javascript Help
getElementsByTagName needs a tag as a string, you can use document.childNodes() to get all the child elements. You will have to check for nodeType since this will also return text nodes. -
I think you're looking for jsfiddle http://jsfiddle.net/
-
In your snow.js, remove the comma behind the last item in the object c.fill(); }// remove this comma , };
-
The array indices starts at 0, so if any array has 5 items, the last index will be 4. e.g. var arr = ['a', 'b', 'c', 'd', 'e']; alert(arr.length); // alerts 5 since we have 5 items in the array alert(arr[0]); // alerts a, first item alert(arr[4]); // alerts e, last item alert(arr[5]); // error, that would be the sixth item
-
In both your for loops, you need to use less than (not less or equal) e.g. for(var i = 0; i < forms.length; i++){.... .... for(var ii = 0; ii < divInputs.length; ii++){...
-
did you try onbeforeunload?
-
How do I execute a PHP page from HTML using javascript?
nogray replied to megetron's topic in Javascript Help
Make sure to set the http headers to javascript header("Content-type: text/javascript"); Also, you file contains a lot of HTML code which will cause a javascript error and stop it from executing. -
You need to add "return" in your onsubmit event e.g. <form ..... onsubmit="return validate();">
-
If you want to do it with javascript, you can use the split function e.g. var my_str = "This is not I would like to do ~ what do you mean"; var arr = my_str.split('~'); alert(arr[0]+' || '+arr[1]);
-
Google is your friend http://www.lmgtfy.com/?q=javascript+sort+table
-
You can try to add an onunload event in the pop up page. The main page and the pop-up page must be in the same domain. e.g. window.onunload = function(){ window.opener.location.reload(); }
-
I've seen jquery sortable used, you just need to make sure to use the thead and tbody tags and apply the sortable to the tbody. http://jqueryui.com/demos/sortable/
-
Using jQuery for this simple function is way overkill. Also, disabled fields are not sent with the form when submitted. If you want to stop the user from changing the info, use readonly
-
change the "onclick" to "onchange"