279 Posted Topics
Re: The most common mistake ever made in this forum: AJAX is not a programming language, it is a set of javascript functions that allow you to send/retrieve data to pages when the page is already loaded. And, for the thing you want, no AJAX is needed: just regular javascript will … | |
Re: >> line 26 and 29 - You only need one opening tag for a body. ~G | |
Re: Your AJAX request has not yet been processed yet, use the following: [CODE]function init(){ myRequst = new XMLHttpRequest(); var url = "http://localhost/dummy.php"; myRequst.open("get",url); myRequst.send(null); ajax.onreadystatechange=function(){ // If everything is OK: if ( (myRequst.readyState == 4) && (myRequst.status == 200) ) { // Returns the value in a alert box var … | |
Re: I would first advice that you write the HTML code (or generate it in php). Then, when the page is shown properly, you start writing the AJAX-based functions one by one. This is to prevent that your code doesn't work and that you have no idea where it all went … | |
Re: A long length password contains a few characters. The bigger the amount of characters, the more time it takes for a brute force hacker to gain acces to your website. Definition of brute force hacking: trying out all the different combinations that are possible. When a password is long and … | |
Re: If the page is loaded, all the javascript scripts have been read and executed. You can only call the functions that have been read. When you use AJAX to change a innerHTML into whatever you want, the javascript of the innerHTML is not executed. So no, you can't. By the … | |
Re: You can just make 1 general function that needs a parameter named "page". I made the following code snippet for you: [CODE] window.onload = initAll; var xhr = false; function initAll() { if(window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { if(window.ActiveXObject) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } … | |
Re: I also looked through the results of "Genie Scroller" with Google, and also found out there are no other scripts that works like the one Adobe made. Perhaps you should contact Adobe via E-mail, asking wether you could still purchase their product, although it has been discontinued? I also saw … | |
Re: First of all: seats are usually displayed as squares. It so happens to be that table cells are also squars. Thats why it's so easy to use a table to show seats. If you want a more realistic map of a bus, you will first need to make a ground … | |
Re: General: >> Line 2 and 29 Dont use caps for elements or attributes, use lower case: [icode]<script type="text/javascript"></script>[/icode] >> 28/29 There is a mismatch, the script tag needs to be closed before you close the html tag. [COLOR="Red"]This is wrong: <b><i></b></i>,[/COLOR] [COLOR="Green"]this is correct: <b><i></i></b>[/COLOR] >> A script needs to … | |
Re: I think you should use flash for this. I don't have a clue how to make 3d models in javascript (if it is even possible). However, a slideshow of images is possible. Visit the following link for an example: [URL="http://www.daniweb.com/forums/thread251289.html"]http://www.daniweb.com/forums/thread251289.html[/URL] ~G | |
Re: Could you post how the form is displayed within the source code, due to the fact that it would be easier to test the javascript code for ourselves. ~G | |
Re: If you want us to help, please post the code of singlegalery.js. ~G | |
Re: A few modifications should be made to your code: >> Each codeline needs to be ended with a [icode];[/icode] >> Line 15 - You forgot to add the script-type, it needs to be [icode]<script type="text/javascript"> [/icode] >> Line 20 - Each time the function gets called, the step gets set … | |
Re: >> Line 4 and 6 - you declare the variable's name as [ICODE]confirm[/ICODE], but you use the the variable name [ICODE]confir[/ICODE] in the script. >> Line 21 - [ICODE]=== [/ICODE]needs to be [ICODE]==[/ICODE] ~G | |
Re: I currently use Javascript and XHTML for clientside and PHP for serverside. (AJAX is something in between). PHP and Javascript are easy languages in comparison to VSC++, C++, C and Java. The biggest difference is the you don't have to declare what type (int, char etc...) variables are. So I'd … | |
Re: You can just use a function that calls different functions, example: [CODE] <script type="text/javascript"> function sayHi() { alert("Hi"); } function sayHello() { alert("Hello"); } function callHelloHi() { sayHi(); sayHello(); } window.onload = callHelloHi(); </script> [/CODE] ~G | |
Re: I tried out the program you wrote yourself, and it returns the uneven numbers, what is there to solve? If you would like the program to be re-useable without refreshing, calculates the even and uneven numbers and their sums you could try the following: [CODE] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML … | |
Re: You should first create a function that validates the input values, it returns true when they are all filled in and false when not. If you would also like to check wether they are according to a certain pattern (for example email [email]xxx@xxx.xx[/email]), you could extend the function I wrote … | |
Re: You should make 2 functions: - [ICODE]ShowObject(objectId)[/ICODE] - [ICODE]CloseObject(objectId)[/ICODE] And two global variables: [CODE]var maxHeight = 300; var curHeight;[/CODE] [ICODE]ShowObject(objectId)[/ICODE] sets a Interval of for example every 20 miliseconds in which he calls itself again. Each time the function gets called it increases the height with 3px. If the maximum … | |
Re: You should do the following: - Create a function that needs one argument, which is the id of the input. - The function retrieves the value using [icode]document.getElementById(id)[/icode] and then adds the part of text you want on the end. - Then you update the value of the input with … | |
Re: Perhaps you should calculate a random number with javascript, between 0 and the amount of different videos you want to display. Then you should use a switch to decide which number corresponds with what source, for example: [code] var randomNumber = 0; // This you need to decide with a … | |
Re: >> Line 13 - You forgot to add the {} at the else. You should always use an if...else the following: [code] if (...condition...) { } else { } [/code] >> Line 14 - Never use a document.write() in a function you call when the page is already loaded. Use … | |
Re: >> Line 4 - [icode]<script type="text/javascrip">[/icode] needs to be [icode]<script type="text/javascript">[/icode] ~G | |
Re: >> Always put code in code tags: [code] function Length_TextField_Validator() { // Check the length of the value of the teamname and teammanager if ((addteam.teamname.value.length < 3) || (addteam.teamname.value.length > 20)) { // alert box message mesg = "You have entered " + addteam.teamname.value.length + " character(s)\n" mesg = mesg … | |
Hi, I am currently learning C#, but when I made a program that allows the user to guess a word (in Dutch that's called "Galgje") it repeats the while-statement twice, ignoring the scanf(). I searched with Google and found out that the program is too fast for the user input. … | |
Re: I made a small sample code on how to do this: [code] <script type="text/javascript"> function changeAction(formid, actionvalue) { document.getElementById(formid).action = actionvalue; } </script> <form action="formhandler1.php" id="form1"> <input type="button" onclick="changeAction('form1', 'formhandler2.php')" /> <input type="submit" value="submit" /> </form> [/code] | |
Re: I visited the site, but it doesn't go nuts in any browser (I have all 5 leading browsers (ff, ie, opera, safari, google chrome) on my computer). Perhaps you should update firefox to 3.5.6? ~G | |
Re: You should try the following: - Add an id for every input and form - Write a global function that checks the value (for example [icode]check_email(inputid)[/icode] or [icode]check_name(inputid)[/icode] ) - Use the event [icode]onsubmit()[/icode] in each form tag. In that event you should call a fuction: [icode]onsubmit="return checkform(this.id)"[/icode] - The … | |
Re: [URL="http://www.google.com/#hl=en&source=hp&q=geometric+library+c&btnG=Google+Search&aq=f&aqi=&oq=geometric+library+c&fp=b36c7832dbb01be6"]Google[/URL] first before you start posting. The number one result at Google is a geometric library named [URL="http://www.cgal.org/"]CGAL[/URL]. ~G | |
Re: This should do the trick: [CODE] <script type="text/javascript"> function toggleVis(id) { var vis1 = document.getElementById(id).style.display; if (vis1 == "inline") { document.getElementById(id).style.display = "none"; } else { document.getElementById(id).style.display = "inline"; } } </script> <input type="checkbox" id="div1chk" onclick="toggleVis('div1');" /> <input type="checkbox" id="div2chk" onclick="toggleVis('div2');" /> <input type="checkbox" id="div3chk" onclick="toggleVis('div3');" /> <div id="div1" style="display:none;"> … | |
Re: This should do the trick: [code=javascript] <script type="text/javascript"> var time = 10; //How long (in seconds) to countdown var page = 'ddd.html'; //The destination. var myInterval; function countDown(){ time --; get("message").innerHTML = time; if(time == 0){ window.location = page; clearInterval(myInterval); time = 10; } } function get(id){ if(document.getElementById) return document.getElementById(id); … | |
You can place the game "Blackjack" by adding the following script to your website. All the information is included within the script, please do not remove the warranty or information. If you don't want such a big lap of code on your website, you can also place the following, as … | |
Hi all, I made a script that can be used as a captcha. It shows a random amount of (roman) letters sliding by every 2000 miliseconds (thats why its called [B]Matrix[/B]Captcha. But I am not sure wether it is able to stop bots from spamming. Does anyone have a suggestion … | |
Re: Hi, try this: [code] var finalArray = new Array; var testString = new Array; testString[0] = "1,Jeremy,130,80;2,Ludwig,370,300;3,Jeancarlos,200,200;4,Luke,330,70;5,Someoneelse1,392,108"; testString[1] = "1,William,110,30;2,Lauren,370,300;3,Sophie,200,200;4,Charlotte,330,70;5,Someoneelse2,392,108"; // You can go on forever with adding strings here.... for (x = 0; x < testString.length; x++) { var testArray = testString[x].split(";"); for(i = 0; i < testArray.length; i++) … | |
This script can be used for star ratings on for example forum or music sites. The scriptinformation is included within the script. ~G | |
Re: Well, I don't quite know what you don't understand, neither do I know why you should use innerHTML when creating a input in which you can enter your phonenumber. Try the following? [code] <script type="text/javascript"> function is_numeric(mixed_var){ return (typeof(mixed_var) === 'number' || typeof(mixed_var) === 'string') && mixed_var !== '' && … | |
Re: My suggestion: [code] <?php function encode_num($number) { switch($number) { case 1 : return "a"; break; case 2 : return "b"; break; case 3 : return "c"; break; // ... Alot of code... // ...Here comes all the other options... // ...Alot of code... default: return "Invalid number"; break; } } … | |
Hi all, I am currently having a small problem with my Windows XP computer: when I am for example playing Call of Duty 4 or Age of Mythology, the computer minimalizes the window by itself every half hour (or something like that). It doesn't happen with browsers or other applications. … | |
Re: Try this: [code] $error = array(); $results = array(); if (isset($_GET['search']) && isset($_GET['field'])) { $searchTerms = trim($_GET['search']); $searchTerms = strip_tags($searchTerms); // remove any html/javascript. $searchField = trim($_GET['field']); $searchField = strip_tags($searchField); $searchField = addslashes($searchField); if (strlen($searchTerms) < 3) { $error[] = "Search terms must be longer than 3 characters."; }else { … | |
Re: Hi, there are a few things wrong with your code, it seems like you dont understand the difference between a name and an id. An id is unique, a name is not. You can not retrieve a name with getElementById(). The following code will work in all browsers: [code] <?php … | |
Re: I don't know whether this is the best solution, but here it is: [code] <?php // Note: this MUST be on the top of the page, without any whitespace whatsoever infront of it session_start(); ?> <?php $theimagename = "05-5098-40293050.jpg"; // You have retrieved this from your upload script $_SESSION['imagename'] = … | |
Re: First of all: it doesn't seem like you have had alot of experience with regular XHTML and as so don't know how a form works. If you would like to have a form that is submitted to another page and has a reset button, use something like this: [code] <form … | |
Re: Hi, you can try this: 1. Make 2 images using a image editor (PhotoShop or something like that), one is a bit darker as the other (for example: darkImg.jpg and lightImg.jpg) 2. Use the onmouseover and onmouseout events to show the lighter version when someone scrolls over and the darker … | |
Re: A few suggestions: - How to debug your code - How do you use an include() and how do you acces files beneath the webroot? - How do you secure your site, what techniques can be used and what shouldn't you do. - When should you use sprintf(), printf(), print(), … | |
Re: It doesn't work in IE because you have neglected to add doctype and such. I also think the script is not very well written.... Here is a better one: [code] <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Formtest</title> <script type="text/javascript"> function clearElement(id) { document.getElementById(id).innerHTML … | |
Re: Try this: [code] <script language="JavaScript" type="text/JavaScript"> <!-- menu_status = new Array(); function showHide(theid){ if (document.getElementById) { var switch_id = document.getElementById(theid); if(menu_status[theid] != 'show') { switch_id.className = 'show'; menu_status[theid] = 'show'; set_cookie(theid,'hide'); }else{ switch_id.className = 'hide'; menu_status[theid] = 'hide'; set_cookie(theid,'show'); } } } function showHideAll() { var menuState = get_cookie ('mymenu1'); … | |
Re: Why would you use 2 tables for the exactly same purpose? Why don't you just make the following two table: table "surveyresults": qa_id INT(9) AUTO_INCREMENT NOT NULL, question CHAR(255), answer LONGTEXT, sid INT(9) NOT NULL, And use the following code: [code] <?php require_once('auth.php'); require_once('config.php'); // // Retrieving which survey it … | |
I am currently having a problem with my BB-code editor, like most things it works great in FF, but i have an issue with IE: whenever i select a word that has already been previously typed, it selects that word instead of the one i selected. Here is the selection … | |
Re: You can replace strings doing so: [code] <script type="text/javascript"> var query="Wat is the question?"; query = query.replace(/?/, ""); </script> [/code] Visit [url]http://www.w3schools.com/jsref/jsref_replace.asp[/url] for more information ~G |
The End.