1,330 Posted Topics
Re: Ryoonnet, I'm afraid there's no complete solution because the browser security gets in the way. As Taywin indicated, some browsers (including the one you use) don't allow input fields of type="file" to be given a value by any means other than clicking "browse..." and selecting file(s). However, there is a … | |
Re: Travist, The probelm is in these two lines: [CODE] var var1 = document.getElementById("div1").className; if (var1.value == "special") [/CODE] Change to : [CODE] var var1 = document.getElementById("div1").className; if (var1 == "special") [/CODE] or [CODE] var var1 = document.getElementById("div1"); if (var1.className == "special") [/CODE] The second version has the advantage that you … | |
Re: Yo, [ICODE]window.showModalDialog[/ICODE] is new to me. I would put the onload handler in the page(s) that appear in the popup; app.html and any others. If the onload handlers are complex or need access to data in the main window, then get the popup's onload handler to call function(s) in the … | |
Re: Andrew, Is [ICODE]thumbsUp[/ICODE] supposed to be different from [ICODE]the_id[/ICODE]? They are currently identical : [CODE=javascript] the_id = $(this).attr('id'); thumbsUp = $(this).attr('id');[/CODE] The second line here will immediately override the first. The spinner will never show : [CODE=javascript] // show the spinner $(this).parent().html("<img src='images/spinner.gif'/>"); //show the thumbsup $(this).parent().html("<img src='images/yes-enb.JPG'/>"); [/CODE] Why … | |
Re: I just tested your code in the following browsers: [LIST] [*]IE6 : With return true, shows message onmouseover. With return false, default behaviour then shows message onmouseout. With no return value, behaves as return false. [*]Opera : With return false, shows message onmouseover. With return true, default behaviour then shows … | |
Re: DrV, I think you will find it difficult to override IE's natural behaviour in this respect. In both browsers, the back button performs a "soft reload" of the page but it would appear that in FF it is softer than in IE. It appears that IE remembers form data but … | |
Re: Ptemedia, Approach 1: As the page is composed server-side, you may be able to test whether each image exists or not, and then include HTML only where the test is positive. I guess asp is capable of this (php certainly is). Approach 2: Client-side, there is indeed a way to … | |
Re: Try [ICODE]textarea.innerHTML[/ICODE] instead of [ICODE]textarea.value[/ICODE]. Both generally work though .innerHTML is more logical given that, in (X)HTML the value is set between the tags, not as a value="..." attribute. [B]Airshow[/B] | |
Re: In a shop, you set the prices in whatever currency is appropriate. The user should never need to enter a currency symbol and you should never need to read/deltect one in its symbolic "£" "$" form. If your shop has user-selectable currency modes, and your client-side or server-side code needs … | |
Re: SunD_g, I guess the function is executed more than once and you end up with an unknown number of added <input> elements named "nameN", "nameN+1", "nameN+2", "nameN+3", "nameN+4" etc., where N is a positive integer. One strategy would be to write N to a hidden form field each time the … | |
Re: Javscript error. Curly braces are unbalanced. 8x{ but only 7x} . [B]Airshow[/B] | |
Re: [QUOTE=star_lavender;1356328]Hi. I have a calculate.js javascript file where all the function that execute the calculation is consist in this file. Now, I want to retrieve a data from the database for javascript calculation and be done in this calculate.js file. I have search a lot of methods to do this … | |
Re: Webdev, I can offer a strategy: [LIST=1] [*]Choose your player (WMP, Real etc.) [*]If available, download and thumb through the player's SDK. If not available, then read whatever documentation is available. You should find instructions on (a) skinning and/or (b) custom ebmedding, typically with worked examples. [*]Create artwork - use … | |
Re: Ivan, I have never written an editor from scratch but I have hacked a few over the years. [QUOTE]How to make a button (source code) that when someone clicks on it, it shows the source code of that what is written.[/QUOTE] Do you mean you want to toggle between [I]Markup … | |
Reviving an old question ...... any chance of an [COLOR="Green"][B]ICODE[/B][/COLOR] button in the Daniweb editor? I use [COLOR="Green"][B]ICODE[/B][/COLOR] almost every time I post and on every occasion I think "still no button". I've read in earlier posts here that vBulletin is difficult to edit in this regard but I'm sure … | |
Re: Chineerat, It depends on the purpose of the array. Is is to store a [I]snapshot[/I] or the [I]history[/I] of values in the input fields? [LIST] [*]Snapshot: We would overwrite each entry when it is updated. [*]History: We would add new entries without destroying anything. [/LIST] [B]Airshow[/B] | |
Re: Himmat, First, the options need values: [CODE=HTML] <select name="listFrom" id="listFromId" onchange="loadXMLDoc()"> <option value="">SelectCity</option> <option value="Pune">Pune</option> <option value="Karad">Karad</option> </select> [/CODE] Then, myDiv can be initially empty: [CODE]<div id="myDiv"></div>[/CODE] The "lsitTo" menu will be overwritten with response from the servlet. If you want a "lsitTo" menu populated with destinations, then you need … | |
Re: Dave, On a quick looksee: [CODE=javascript] var input = $('<input type="text" name="delegate" id="delegate" />');//an instance of jQuery .... var newInput = input.clone();//also an instance of jQuery .... $(newInput).attr({'name': 'delegate' + (i + 1), 'id': 'delegate' + (i + 1)});//$(something_that_is_already_an_instance_of_jQuery)... .... newInput.attr({'name': 'delegate' + (i + 1), 'id': 'delegate' + (i … | |
Re: Congrats. Here's a way of doing it by setting a custom attribute, [I]selected[/I], which gives us something reliable to test. Color changes are effected by switching class names. [CODE] <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <link type="text/css" href="http://3rlend.com/pjatt/pjattstyle.css" rel="StyleSheet"> <style type="text/css"> * … | |
Re: Vedmack, I'm not sure why the gif should decide not to animate. It works in IE 6. Maybe it's a bug in the version of the browser (presumably IE) that you are using. As far as I can tell, [ICODE]window.createPopup[/ICODE] is proprietary Microsoft. I have certainly never used it or … | |
Re: Davec, There must be many ways to do this. Here's one, which is both practical and fun. First wrap existing code in a contructor function to avoid putting lots of members in the global namespace. Here it is with a few tweeks including the ability to specify callback function(s), which … | |
Re: Nikc, Many folks use [ICODE]document.formName[/ICODE]; it's thoroughly reliable. I stopped using validators a while back. They are oft-times more trouble than they are worth. What really matters is whether or not the code works, cross-browser, not conformance with a standard that the browsers are [U]supposed[/U] to comply with. If, for … | |
Re: Ramya, I would like to help but need clarification : [COLOR="Green"]I want to display [U]the contents of the table[/U] based on the third menu selection[/COLOR] There's only one table and its contents are already displayed. Is there another table, or do you want to modify/add to the contents of the … | |
Re: Fobos, The trouble is you have [I]one[/I] variable, [ICODE]toggleState[/ICODE], being influenced by [I]two[/I] checkboxes. In fact, you generally don't need variable(s) to record checkbox state (checked or unchecked) because you can enquire the checkboxes themselves at any time. (They know their own state with incredible reliability!) Try this: [CODE=javascript] function … | |
Re: To do this without refreshing the page, you need to use : [LIST][*]AJAX to make a request to the server and to receive a response. [*]DOM scripting in the "success" response handler to change what is displayed[/LIST] That should point you in the right direction without adding to a mountain … | |
Re: Mushget, You will most probably end up using a regular expression. Tyr [URL="http://regexlib.com"]here[/URL] - search on "currency". I had a quick look and couldn't see exactly what you want but there were plenty more results. [B]Airshow[/B] | |
Re: Failure of [ICODE]element.focus()[/ICODE] is a known bug in Chrome. I have not been able to identify a workaround. [B]Airshow[/B] | |
Re: [QUOTE=MaxMumford;1354736].... browser add-on .....[/QUOTE] ????? | |
Re: LGR, I think you need to loop inside the success callback fn. With a loop counter i counting up from 0 try replacing [ICODE]get(0)[/ICODE] with [ICODE]get(i)[/ICODE] (4 times). I'm not sure about [ICODE]$.each[/ICODE]. Maybe is disappears if loop is employed. [B]Airshow[/B] | |
Re: MegHab, You can do this one of two ways. On each cycle :- [LIST=1] [*]compose the next page's URL in JSP and insert into a META REFRESH (Google search if you don't know what it is) [*]compose the next page's URL and go to it after 1 second (1000 milliseconds)in … | |
Re: FF1, [ICODE]document.getElementsByClassName[/ICODE] is not universally supported, so it's better to do something like this: [CODE=javascript] function innertest() { var divs = document.getElementsByTagName("div"); for(var i=0; i<divs.length; i++ ) { if(divs[i].className == "findme") { alert(divs[i].innerHTML); } } } [/CODE] Of course, this will only find [I]divs[/I] with [ICODE]class="findme"[/ICODE]. If you want to … | |
Re: Hi guys, I guess this problem is still live, though it's a month old now. I'm in a part of Damiweb here where I don't normall go. You will generally find me in the JavaScript / DHTML / AJAX forum. [B][U]The good news[/U][/B] I have a general solution for "n … | |
Re: Aizel, How is this line served ("view source" in the browser)? [CODE] hs.graphicsDir = '<?php get_bloginfo('template_url'); ?>/rssSlider/highslide/graphics/'; [/CODE] Does it give the correct path to your graphics? [B]Airshow[/B] | |
Re: Azegurb, Wow! I'm not too sure what's going on there. Behaviour is rather strange, and it's to do with addressing the checkbox elements as the collection [ICODE]qutu[/ICODE]. I'm actually amazed it works as well as it does, 'cos I didn't know you could do that. For reliability I would take … | |
Re: Eagled, Suggest you start by tracking down the code that initialises the second menu after it has been delivered via AJAX. Does such code exist? Is it called? Does it successfully attach Easy Tabs functionality to the second menu? [B]Airshow[/B] | |
Re: LoveP, [CODE=javascript] function hardReload(fromServer) { // Perform a hard reload of the document. // This kind of reload resets form elements to their default values // Call with hardReload(false) to retreive from browser cache (if available) // Call with hardReload(true) to force the page to be re-served by the server … | |
Re: Eijei, The problem doesn't manifest itself if you hit "Enter" to clear the alert as opposed to clicking OK. Therefore, I think you just need to give focus back to the window after the alert. [CODE] ... alert ("Time expired"); window.focus(); ... [/CODE] You may need to do this after … | |
Re: Jecris, For lots of ideas, try sticking "hangman" into Daniweb's search (top of page). There are plenty of results, which indicate that this has been a popular exercise for some years. [B]Airshow[/B] | |
Re: AboJaD, The solution can be quite concise. Delete the entire script (sorry) and paste in this: [CODE=javascript] onload = function(){ var menus = ['Closed', 'S_B1', 'S_C1', 'S_E1', 'S_G1', 'S_I1', 'S_J1', 'S_M1', 'S_O1', 'S_S1', 'S_S2'];//list of secondary menu ids for(var i=0; i<menus.length; i++) { menus[i] = document.getElementById(menus[i]);//translate ids into DOM elements … | |
Re: Shanti, I try to avoid debug alerts when working with real-time code (inc AJAX) as they suspend execution and can mess up the timing. For example, say your ajax function has a timeout. An alert in the ajax response handler could (depending on where it is placed) eat into the … | |
Re: [QUOTE=fobos;1351932]Did you write this or copy it. If you copied it, then you need to learn javascript and stop asking people what you want. We are here to fix problems that people have on there codes, not code that people copied and have no idea how it works. Sorry for … | |
Re: Well, That's Fixed or "WTF" as we sometimes say. | |
Re: iiJb, getAsDataURL() is FF-proprietary, not W3C and therefore not universally implemented cross-browser. Apparantly, there's a W3C draft on this interface but no clues to from MS as to whether or not it might be implemented in IE. [URL="http://blog.igstan.ro/2009/01/pure-javascript-file-upload.html"]This article[/URL] seems to give chapter and verse. [B]Airshow[/B] | |
Re: Claire, [CODE] var latstr = tempstr.split('|'); [/CODE] [ICODE]String.split()[/ICODE] forms an Array automatically. [B]Airshow[/B] | |
Re: The reason for the jump is that [ICODE].tabContent[/ICODE] height is momentarily lost, and the page shrinks to a size that will fit the window ... hence verical scroll goes to zero (top of page) and does not recover naturally. The simple way to overcome this is to give [ICODE].tab_container[/ICODE] some … | |
Re: Julian, Quick look at the Mootools API indicates you need to use `var myProp = myElement.getProperty(property);`([see here](http://mootools.net/docs/core/Element/Element#Element:getProperty)) So for alt text, I guess you would use `var myProp = myElement.getProperty('alt');` It's up to you how you identify `myElement` to be the <a> of interest. If in doubt, consult the API. | |
Re: Your code works fine with the function in <script></script> tags on the page. If the code does not work with <script src="numbers.js"></script> then it's because : [LIST] [*]numbers.js doesn't exist [*]numbers.js exists but is in the wrong place [*]the function has not been cut/pasted into numbers.js correctly. [/LIST] Once you … | |
Re: Sassenach, It's not obvious where it's breaking down. Code looks pretty good to me. It can be simplified to avoid repetition. See below, including (commented out) suggested debug statements to allow you to inspect the composed URL without issuing the .load() command. [CODE=javascript] jQuery(document).ready(function($) { //References var $pages = $('div#paging_menu … | |
Re: If you can define "know" and "idle" that would be a start. [B]Airshow[/B] | |
Re: Richard, It all depends on how your javascript function [ICODE]popUp[/ICODE] is written. Post the code and I'll have a look at it. [B]Airshow[/B] |
The End.