62 Posted Topics
Re: This can easily be done using the [URL="http://www.w3schools.com/jsref/jsref_split.asp"]split()[/URL] method. Here is an example: [CODE=JavaScript]function splitNames(names) { return names.split("/").length; } var names = "aashish/ankush"; alert("There are " + splitNames(names) + " names in the names list.");[/CODE] The [ICODE]split()[/ICODE] function has one parameter, [ICODE]separator[/ICODE], which defines the character(s) that you want to … | |
Re: CSS and JavaScript aren't interchangeable languages. They each are designed to do specific things. CSS is for styling the page, and JavaScript is for controlling your HTML dynamically (and for form validation). CSS has some :hover effects that are similar to JavaScript's onMouseover, but you can't recreate a JS animation … | |
Re: This isn't the right forum. Please ask this question in the [URL="http://www.daniweb.com/forums/forum9.html"]Java forum[/URL], not Java[U]Script[/U]. They are two very different programming languages. | |
Re: The best way to do this is to use Regular Expressions (RegExp). This is a useful, shorthand way to search a string for a certain value. Here's a regular expression to search for a word in JavaScript. Regular Expressions work in most programming languages, so if you're using another, say … | |
Re: The problem is line 22. You have a string that doesn't terminate (a quote isn't closed). Looks like you're used to another language like PHP that connects strings and variables like [ICODE]"string text".variable."string"[/ICODE]. Javascript uses the plus sign (+) instead of the period to join strings and variables. I made … | |
Re: PHP is not [I]completely[/I] necessary, but it can be useful. You could also do the page with AJAX, so it would be useful to learn JavaScript and XML. ![]() | |
Re: The basic line that will stop the form from processing is adding this in your JavaScript if the validation failed: [CODE=JavaScript] if (validationFailed) return false; [/CODE] Only return true if the validation is true, if it fails, then return false. | |
Re: This isn't possible because some browsers like Firefox reject requests for iframe URLs as a security measure. Some people could abuse it for XSS (cross-site scripting). | |
Re: [code=JavaScript] if(arguments.length == 3){ var result = "<" + arguments[1] + ">"; for (var i = 0; i < arguments[2].length; i++){ result += "<li>" + arguments[2][i] + "</li>"; } result += "</" + arguments[1] + "l>"; document.getElementById(arguments[0]).innerHTML = result; } }[/code] It looks like this is creating an unordered list. … | |
Re: It's pretty easy, in your userscript put these lines: [CODE=JavaScript] var regExp = /google\.ei\//i; if (regExp.test(window.location.href)) window.location.href = "http://www.google.ie"; [/CODE] | |
Re: It's alright, you may want to try the [URL="http://www.daniweb.com/forums/forum145.html"]Existing Scripts[/URL] forum though. That forum is for prewritten scripts or script libraries such as MooTools. Be sure to include MooTools in your topic so that the right people view your thread. edit: You could also try the [URL="http://forum.mootools.net/"]MooTools forums[/URL] if you … | |
Re: If it's any help, the purple logo text is the font called [URL="http://download397.mediafire.com/mdjjgcqzfzug/h4dmtkchnlz/gordon__.ttf"]Gordon[/URL]. |
The End.