1,330 Posted Topics
Re: Brandi, It seems that FF doesn't like that form of javascript URL. I have seen "javascript<b></b>" before but have no idea where it comes from. As far as I know the <b></b> has no place in there but would like to know why there are so many examples of it … | |
Re: JRW, For undefined members, [ICODE]typeof[/ICODE] returns [ICODE]"undefined"[/ICODE], which (somewhat confusingly) is not falsy! The reason is that [ICODE]typeof[/ICODE] always returns a string (including [ICODE]"undefined"[/ICODE]) and any string that is not empty is also not falsy. Empty strings are falsy. In fact, [ICODE]typeof[/ICODE] always unambiguously returns a string (unless its argument … | |
Re: Izzy, Try this: [CODE]<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow: Demo</title> <script type="text/javascript"> onload = function(){ var q1 = document.getElementById('q1'); var q2 = document.getElementById('q2'); var q1Options = q1.getElementsByTagName('input'); var q2Options = q2.getElementsByTagName('input'); var q2Labels = q2.getElementsByTagName('label'); var enableName = 'not visited'; var disable_q2 = function(value){ for(var … | |
Re: Fury, Ultimately some line of code somewhere is using the result of getElementById(txtindex") instead of getElementById(txtupdate"). All you have to do is track it down. If it's not obvious then I would immediately suspect the use/reuse of a global (or outer) variable. Suggest you give this first consideration. To analyse … | |
Re: Chakde, There's all-sorts wrong here. [CODE=javascript] function gm(guests) //shoud read function gm() { //guests is not used. var i=0; //can be simplified to var i; for (i=0;i=15;i++); //shoud read for (i=0; i<15; i++) //15 iterations (as per Shawn) //or for (i=0; i<=15; i++) //16 iterations (depending on what you want) … | |
Re: Mysterious, [ICODE]parseInt[/ICODE], capital "I" [B]Airshow[/B] | |
Re: Nakul, A hyperlink's href is just a way to send your browser to another page without you having to type its URL into your browser's address bar. To write a hyperlink, you work backwards, as follows : [LIST=1] [*]In browser, navigate to the Wikipedia page you want to link to … | |
Re: Albert, It works fine in IE6, FF and Opera. I can only guess that [ICODE]document.mainform.unknownHw[/ICODE] doesn't exist or is not in scope at the point where you call [ICODE]setUnknownHw[/ICODE]. [B]Airshow[/B] | |
Re: [CODE] ... var objHead = document.getElementsByTagName('head'); if(objHead){ objHead[0].appendChild(fileref); } ... [/CODE] I am surprised that [ICODE]...item(0)[/ICODE] works in any browser. [B]Airshow[/B] | |
Re: Affee, It's this line : [CODE]var slideimages=new Array() slideimages[0]=<img src="../myadmin/stocklet/B3m2.jpg">; slideimages[1]=<img src="../myadmin/stocklet/C3m3.jpg">; slideimages[3]=<img src="../myadmin/stocklet/D3m4.jpg">; var ie=document.all;[/CODE] Change to : [CODE]var slideimages=new Array(); slideimages[0]='<img src="../myadmin/stocklet/B3m2.jpg">'; slideimages[1]='<img src="../myadmin/stocklet/C3m3.jpg">'; slideimages[3]='<img src="../myadmin/stocklet/D3m4.jpg">'; var ie=document.all;[/CODE] And I expect [ICODE][3][/ICODE] should be [ICODE][2][/ICODE]. If so then you can simplify to : [CODE]var slideimages = [ '<img … | |
Re: Which element has [ICODE]class="close"[/ICODE], the <li> or something within the <li>? [B]Airshow[/B] | |
Re: [QUOTE=nathan_hastings;1176288]This is fine unless I [COLOR="Red"]change the header location in the next line in PHP[/COLOR] as it automatically changes the page with showing the message.[/QUOTE] Can you post the code with that line in place please, so I can see exactly what is going on? [B]Airshow[/B] | |
Re: JRW, I'm afraid ththe "onreadystatechange" approach is not generally applicable. It only applies to certain, very specific types of object. You might be tempted to use [ICODE]setInterval(...)[/ICODE] to monitor your object property but that's a very inefficient way of achieving your aim. If I understand correctly, a better way to … | |
Re: Vantrax, Typical reason for difference in local/remote behaviour in something like this is the permissions on the counter.txt file. Most FTP clients allow you to set a remote (*nix) file's permissions, eg. in Cute FTP [I]right-click > Properties/CHMOD[/I]. It's probably 644 by default. 666 should do it. [B]Airshow[/B] | |
Re: JRW, You can build a JSON string like that if you want ([ICODE]data[key] = value;[/ICODE] will get you started) but unless you particularly need a JSON string, you appear to be trying to replicate something that's native to HTML/browsers (and has been since time immemorial - ie Mosaic, IIRC). HTML … | |
Re: Peck, The main thing is that by using <button>Login</button>, the form's onsubmit event won't fire. Try putting an alert right at the top of validate_login(thisform) and you will find that it's never called. You can use : [LIST] [*][ICODE]<input type=="button" value="Login" />[/ICODE] for a standard button, or [*]eg. [ICODE]<input type="image" … | |
Re: Nothing immediately wrong but I suggest : [LIST][*]Avoid "extend". It's just possibly a reserved word (even though it's not part of the javascript language). [*]I guess that element '#abc' is a table. Try using <tbody id="abc">...</tbody> inside the table and add your row to it rather than directly to the … | |
Re: MrNG, Without doubt - method 2. Otherwise you are reliant on someone else's server being up-and-running and still serving exactly the same version of jQuery on which you did all your rigorous testing when you built your app. Whereas Google are probalby as reliable as an organisation can get, why … | |
Re: Life, There are many ways to formulate something like this in Javascript. Here's one: [CODE=HTML] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Airshow :: Circle Object Demo</title> <script> function Circle(radius) {//By convention we give contructor functions an Initial-capital letter // *********************** // *** Private members *** // … | |
Re: s2xi, There's nothing in native Javascript to help you I'm afraid other than : [LIST][*][B]Date.toLocaleString()[/B] : "returns a string version of the local time zone value of a Date object instance in a format that may be localized for a particular country or an operating system's convention."; Dynamic HTML, Goodman … | |
Re: Albert, It sounds like your form is submitted and the server then re-serves the page identically to the way it was served the first time. Hence the form is devoid of the user's entered values. If you want the server to re-serve the page with the user's data in place … | |
Re: Th3nutz, You could gop the AJAX route but there is little point unless the files contain data/text that is likely to change during a user session. For static or very slow changing information, you can serve all the data/text in all categories into its own div and show/hide when the … | |
Re: I guess you want something like this: [CODE=javascript] function callAHAH(url, pageElement, errorMessage){ var el = document.getElementById(pageElement); try { req = new XMLHttpRequest(); }// e.g. Firefox catch(e) { try { req = new ActiveXObject("Msxml2.XMLHTTP"); }// some versions IE catch (e) { try { req = new ActiveXObject("Microsoft.XMLHTTP"); }// some versions IE … | |
Re: You may get lucky here on Daniweb but I think you are going to struggle to find someone with the necessary experience to help you follow through with that particular approach. MS says [URL=http://msdn.microsoft.com/en-us/library/ms753804(VS.85).aspx]here[/URL]: "Customer feedback has indicated that it is often difficult for developers to build and run MSXML … | |
Re: You could try : [CODE=javascript]val.substr(val.length-3, 1).match(/[A-Z]/i)[/CODE] There's no point testing for numbers again because [ICODE]!hasNumbers(val)[/ICODE] has already allowed anything with numbers to fall through this error trap. This would be a more rigorous test : [CODE]!val.match(/^[a-zçáéÃóäëiöúà èììù]+[, ]+[a-z]{2}$/i)[/CODE] Read this as : "val does not consist of start of string an … | |
Re: Masocha, The W3C standards don't specify in great detail how radio buttons (and other HTML elements) should be rendered, therefore you will find differences from browser to browser and OS to OS. There is no universal solution to [U]native[/U] HTML/CSS rendering. If you want full control over appearance, then you … | |
Re: chathuD, Sticking with basic coding, there's no particular advantage in having a [ICODE]new Image()[/ICODE] for the images already loaded automatically by the HTML. All you need for these is to store each image's src string so it can be recalled on mouseout. Meanwhile, the rollovers are not preloaded automatically so … | |
Re: Try [CODE]var message = document.chat_frm.msg.value; .replace(/\W/g, '');[/CODE] This will eliminate all characters that are neither letters, numerals nor underscores from the test. In other words, the test will only pass if there is at least one letter, numeral or underscore. The original text in the textarea remains unaltered. [B]Airshow[/B] | |
Re: Leratom, Something like this maybe? [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Untitled</title> <style> </style> <script> onload = function(){ var i; var myImgElement = document.getElementById("myImage"); var links = document.getElementsByTagName('a');//find all <a> links for(i=0; i<links.length; i++){//loop through the a links if(links[i].className === 'imgSelector'){//is it an "imgSelector" links[i].onclick … | |
Re: There are some examples on the [URL="http://api.jquery.com/jQuery.ajax/"]jQuery.ajax() API page[/URL]. Apart from that, you shouldn't have too much trouble finding examples in this forum here on Daniweb. Or Google "jquery ajax tutorial" [B]Airshow[/B] | |
Re: Maybe [ICODE]if(isNaN(ln))[/ICODE] condition is met, therfore [ICODE]ln = 1[/ICODE] when [ICODE]document.radioForm.Radio.length[/ICODE] is say 'undefined'. If so, then maybe you could take some other action when [ICODE]if(isNaN(ln))[/ICODE] is met? [B]Airshow[/B] | |
Re: xxmp, I can't see anything obviously wrong but can suggest a way ahead. First, reduce some uncertainty and reduce the need for [ICODE]document.getElementById()[/ICODE] in check_field() by reformulating the onblur code as follows : [CODE=javascript] <input type="text" onblur="check_field(this,'wrong_onoma')" name="onoma" id="onoma" maxlength="40" size="40" value="<?php if (isset($_SESSION["onoma"])) echo $_SESSION["onoma"];?>" /> [/CODE] Then, rewrite … | |
Re: kiyu, Something like this maybe? [CODE=HTML] <html> <head> <title>Online VOting System</title> <script type="text/javascript"> onload = function() { var count = 0; document.test.result.onclick = function() { count += (document.test.myradio[0].checked) ? 1 : 0; alert(count); } } </script> </head> <body bgcolor="#000099"> <form name="test"> <input type="radio" name="myradio" /> <input type="radio" name="myradio" /> <input … | |
Re: Hitman, Client-side (HTML): Use an [URL=http://www.w3schools.com/TAGS/tag_input.asp]input[/URL] tag with type="file:". Use something like <input name="myFileUpload" type="file"> for a field with "Browse..." button, by which the user will select the file to be uploaded. Server-side (eg. PHP): You need a script to [URL]receive the uploaded file[/URL] and to [URL=http://www.w3schools.com/php/php_mail.asp]generate/send an email[/URL]. Please … | |
Re: You are doing the right thing. Javascript is at the heart of modern web applications. The old [I]wimp-off-back-to-the-server-and-reserve-the-page[/I] days are over. Watch and read everything you can find by [URL="http://www.crockford.com/"]Douglas Crockfird[/URL]. Then go out and buy some books (including his own). [B]Airshow[/B] | |
Re: Hard to see why Chrome should not handle this. You could try changing the id's prefix, eg: [CODE]function updateName(num) { name = document.getElementById("myRef_"+num); } [/CODE] The variable should also be localised: [CODE]function updateName(num) { var name = document.getElementById("myRef_"+num); } [/CODE] otherwise a global variable is created. Do this instead: [CODE]function … | |
Re: It may be something to do with the CSS directive [ICODE]behavior:url(iepngfix.htc);[/ICODE], which generates an error as the page loads. Try removing this line. [B]Airshow[/B] | |
Re: Achiman, An onclick event in an input field can't be used to suppress form submission. The solution is simple but not obvious. You need to initiate validation from the form tag's [ICODE]onsubmit[/ICODE] event, and make sure you return the returned boolean value, like this: [CODE]<form action='myURL.php' method="get" onsubmit="return validate(this)">[/CODE] Then … | |
Re: Jeyush, More info needed. [LIST=1][*]From which library is fadeSlideShow? [*]Can you post the as-served javascript rather than the php source? [*]At what stage do you get the javascript error; on page load or when the fader executes? [*]You imply that the error only occurs in IE. Is this the case … | |
Re: cf, I can't immediately see why it's not working however two things occur to me: [list][*]On repeated use the ajax success function would create more than one div with id="appLinks". I think this would cause $("#appLinks").append(......) to fail on second and subsequent calls (maybe without a Javascript error). [*]If the … | |
Re: For general internet deployment, you may have run into a dead end. I don't know of a general solution (thankfully) to overcome security constraints in all browsers. However for personal or intranet use, you can try developing an [URL="http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx"]HTML Application[/URL] (HTA) for use with Internet Explorer. This will overcome some … | |
Re: Cloud09, First, avoid the variable name [ICODE]submit[/ICODE]. It may be regarded as a keyword (because submit() is a method of form). Second, you should be able to use [ICODE]submitButton.disabled = true;[/ICODE] and [ICODE]submitButton.disabled = false;[/ICODE] without needing to switch between different butons. Third, if you really need to switch buttons … | |
Re: Try replacing: [CODE]a3.appendChild(document.createTextNode("Cancel"));[/CODE] with: [CODE]a3.innerHTML = "Cancel";[/CODE] Also, if you ensure that [ICODE]couponCancel()[/ICODE] returns false, you can get rid of the line [ICODE]a3.href = 'javascript:;';[/ICODE], though this should have no effect on your IE8 problem. [B]Airshow[/B] | |
Re: There are two possible ways ahead: [LIST=1] [*]Learn how to write it yourself. [*]Find and install ready-developed code. [/LIST] [B]Airshow[/B] | |
Re: Akabir77, It's not possible to call java/JSP function directly from javascript (same with php, asp, perl, ssi etc). Reason being javascript runs client-side (ie. in the browser); JSP runs server-side. No executable jsp is propogated client-side. Once your page has been served, the recent import of org.nipr.gateway_mgmt.GtwySysMgmtDao into the server-side … | |
Re: This line will generate an error : [CODE]document.getElementById('txt').innerHTML=h+":"+m+":"s;[/CODE] Change to : [CODE]document.getElementById('txt').innerHTML=h+":"+m+":"+s;[/CODE] Suggest you turn on javascript error reporting and/or look at your javascript error console. This will tell you the error type and line number. [B]Airshow[/B] | |
Re: Zarah, The HTML has a bunch of unbalanced <a> tags (all without </a>). As they do nothing, you might as well delete them. In DynamicDrive's example, the <img> tags are separated with space, not linefeed. Possibly significant? Whereas IE6 certainly handles linefeeds, maybe IE7/8 do not. [B]Airshow[/B] | |
Re: I'm not a perl person but I guess the various standard ways to make an http request apply: [LIST=1] [*]Traditional, old-fashioed hyperlink - eg. [ICODE]<a href="mycode.perl">[/ICODE] [*]Form submission - eg. [ICODE]<form method="get" action="mycode.perl">[/ICODE] [*]Scripted http request - eg. [ICODE]location.href = 'mycode.perl';[/ICODE] [*]AJAX - eg.: [CODE]xmlhttp = //etc. xmlhttp.open("GET", 'mycode.perl', true); … | |
Re: I'm not too sure why you are having a problem but it may be solved with JSON, which allows you to bundle up multiple data items (four lists in your case), and return them in a single ajax response. JSON is made simple for aplication programmers by the availability of … |
The End.