518 Posted Topics
Re: How do you trigger that effect? Here's another way to call element's in your page. [code]<html> <head> <title>test page</title> <script type="text/javascript"> <!-- var tm; window.onload = function() { try { alert( "tm: " + document.getElementsByTagName("span")["sector"].innerText ); } catch(e) { tm = ((document.getElementById ) ? document.getElementById("sector").innerText : document.all.sector.innerText ); alert("tm: " … | |
Re: You can still format the whole data input w/o leaving the page, unless you prefer doing this with cookie's or [b]PHP[/b]... | |
![]() | Re: On your submit event simply apply this code: [code]<form method="post" action="adding_FAQ_check.php" name="fields" onsubmit="return checkFields(); /* without the [b]this[/b] global. */ ">[/code] ![]() |
Re: You can use this demo as a standard, when you are creating table element's. [code=javascript]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML lang="en"> <HEAD> <META http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> <META http-equiv="Content-Type" content="text/html; charset=utf-8"> <TITLE>DEMO</TITLE> <SCRIPT type="text/javascript"> <!-- var createTable; createTable = function() { tableATT = document.createAttribute("style"); tableATT.nodeValue = "background-color : lightblue; … | |
Re: Try the following format: [b]aj.js[/b] [code=javascript]var paints, parameters, search7, colorIT; colorIT = function() { if ( search7.readyState === 4 ) { document.getElementById("textBack").value = search7.responseText; document.getElementById("divBack").style.backgroundColor = search7.responseText; } }; function getXmlHttpRequestObject() { search7 = null; paints = escape( document.getElementById("prints").value ); parameters = "paints=" + paints; if ( window.XMLHttpRequest ) { … | |
Re: Simply include all .js file's that you need in your document. Here's simple demo to clear things out: saying i have 3 .js files: [b]three.js[/b] [code=javascript]var varThree = varTwo; // varThree variable is not accessible to two.js and one.js // But varThree can access variables from the two other .js[/code] … | |
Re: Did you mean, collecting all the entries from the parent window and then passing those datas in the pop-up window? Am i getting it right? Or you just want to open a multiple window depending on the selected option? | |
Re: 1st You can start with this little example. So that you'll easily get how everything works! [code]<html> <head> <title>your title</title> </head> <body> <form> <label>squareFeet: <input type="text" value="" id="sqft" name="sqft" size="6"></label><br> <label>thickness: <input type="text" value="" id="t" name="t" size="6"></label><br> <label>total: <input type="text" value="" id="total" name="total" size="10"></label><br> <button onclick="document.getElementById('total').value = parseInt((( parseInt( document.getElementById('sqft').value … | |
Re: Inside the function reference (or the function that handle's the response). try to call your stated function passed by the [b]PHP[/b] script. [code=javascript]function processReq() { // Handling some renponse --> // Assuming that all reponses is handled and done callmyFunctionPassedByThePHP(); }[/code] If this will not work, then try to separate … | |
Re: You may appy the following codes in your document(s). And it seems that you are working with Firefox here, so this code will only work if you are using any version of ff browser's--the rest will be ignored. [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html … | |
Re: What's been bothering you about this script? If you were just asking about this [icode]if ( txt.match( idx ) ) { // so...on...[/icode] block--wel it simply say's [quote]that If the [color=red]value[/color] of selected option matched (or equal) the id of any defined element, then set the [icode]style.display[/icode] of this element … | |
Re: You can use the code provided by [b]mail2saion[/b] to validate your field. And you can try this basic example to change the names in your field's: [code]<form name="frm"> <div> <label>Default Text <input type="radio" value="" onclick="( this.parentNode.childNodes[0].nodeValue = ( !frm.elements[1].checked ) ? 'Mandatory' : 'Optional' ); frm.elements[1].parentNode.childNodes[0].nodeValue = 'Optional';"></label> <label>Default Text … | |
Re: Why do this, when you can simply call the script via src? Anyway here's a little example that wil load .js files via AJAX request. let's say you have this [color=red]my.js[/color] file that contains a few lines of: [code]function test() { return alert("I'm a function generated by an AJAX call!"); … | |
Re: This can be achieved if you prefer using AJAX in your page. To get the basic of it, here's a simple demo for you. This example comes in 2 separated html document: the [b]main.html[/b] which holds the entire script, and the [b]request.html[/b] that holds another options and will be injected … | |
Re: To ensure the flexibility of your request in Gecko (Firefox) based browser's, you can simply add an extra method of: [code=javascript]// Assuming that everything is declared var requestObject = new XMLHttpRequest(); requestObject.overrideMimeType("text/xml"); // A method that overrides, header sent by the server, just incase it's not text/xml. // The rest … | |
Re: Here's a simple demo, to get you started. [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>JavaScript Demo</title> <script type="text/javascript"> // <![CDATA[ // Declaring variable … | |
Re: Try this code, just be sure that you'll provide two valid URL, along with the action attribute of the two forms. [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> … | |
Re: This demo will alert the user, depending on which is field is empty. Lets say for example, ( if field 1 is empty then, field 1 will be identified as invalid entry and as well as with the other field's also). Don't worry--If you need a simple demo, im sure … | |
Re: Since i cannot run any test using [b]PHP[/b], i'll just provide you a basic demo using [icode]XMLHttpRequest()[/icode] object, to deal with the current issue. [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta … | |
Re: The simplest way to do this, is to fake it by their ids. In this demo i used the individual id of the anchor element's, making it as my pointer to get specific div's on the page. Code is as follows: [code=javascript]<?xml version="1.0" encoding="utf-8"?> <?xml-stylesheet type="text/css href="#internal"?> <!DOCTYPE html PUBLIC … | |
Re: You can try this one: [code=javascript]<html> <head> <title>DEMO</title> <script type="text/javascript"> <!-- var pageRequest, isContent; var jumpMenu = function() { var loadPage = function() { isContent = pageRequest.responseText; // Requested data should be in a form of ( rensponseXML ). to get specific element's from the requested page. /* if ( … | |
Re: ([b]home.php[/b]) with your [icode]subscribe()[/icode] function, in line#4. You forgot to specify the properties of the two following objects, (which is--> name & email): [code]// It should be --> var url = "subscribe.php?name=" + escape(document.frmSubscribe.name.value) + "&email=" + (document.frmSubscribe.email.value);[/code] hope it claim's the current issue, and good day to you... | |
Re: Hope this will help... [code=javascript]<html> <head> <title>DEMO</title> <script type="text/javascript"> <!-- function validate( form ) { try { with( form ) { if ( !agreement.checked ) { alert ("Please commit the agreement to continue."); agreement.focus(); return false; } if (( conPerP1.value == "" ) || ( conPerP2.value == "" )) { … | |
Re: This demo will allow you to populate the current field with a lists of options from another page. You can also switch back from the previous page and gain the default list (vise versa). Here's the code for the [b]test.html[/b] which is currently set as the default list, on the … | |
Re: Try this demo: [code=javascript]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> <title>JavaScript DEMO ( For loop with icremented characters )</title> <script type="text/javascript"> <!-- var show, ar, x, num = 1; function display() { ar = "***********"; for ( x = … | |
Re: Do it this way: [code=javascript]<html> <head> <title></title> <script type="text/javascript"> <!-- function validate( form ) { if ( !confirm("Are you sure to delete these details from database?") ) { return false; } else { return true; } } // --> </script> </head> <body> <form action="process.php" method="post" id="form1" onsubmit="return validate( this );"> … | |
Re: You try this code: [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <meta http-equiv="Content-Language" content="en-us" /> <title>Bear Toys</title> <style type="text/css"> html, body, div, img, table, … | |
Re: I'l just provide what it needs and the rest should go to you. [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css" /> <meta http-equiv="Content-Script-Type" content="text/javascript" /> <title>Online Store</title> <style type="text/css"> … | |
Re: Im not sure if this is what you need! But both condition can be achieved with a [b]try...catch[/b] block. [code=javascript]<html> <head> <title>DEMO</title> <script type="text/javascript"> <!-- var xmlDoc; var setupPage = function() { var x, y, z; try { // lead_recepient x = xmlDoc.getElementsByTagName("lead_recipient")[0].childNodes[0].nodeValue; y = replaceChars( x ); // Am … | |
Re: Your script is ok! Try to apply the following format and see how it works: [code=php]<?php echo '<script type="text/javascript">'; include 'workout.php'; echo 'var numrecords = '.$numrows.';'; print "var muscle = [];\n var exercise = [];\n </script>"; // so on... ?>[/code] | |
Re: From the [icode]show2()[/icode] function, on the first line of [icode]if ( )[/icode] statement — simply change the condition into this: [code]if ( document.form1.state.selectedIndex == 1 ) { // No need to edit all codes that follows[/code] | |
Re: You can achieved that result by doing this: [code=html]<a class="home" href="javascript:void(0);" id="home" onclick="this.className='current';">home</a>[/code] | |
Re: This is a long lost issue, but let me provide you a simple demo on how to deal with this thing. Just be careful when you are editing the line's or the whole script will be worthless. [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" … | |
Re: The [icode]delete_cookie()[/icode] function is messing up the program. Try doing this: [code=javascript]function delete_cookie(name) { var exp = new Date(); var expdate = exp.setTime( exp.getTime() - 1 ); document.cookie = name + "=; expires=" + expdate + "; path=/"; }[/code] | |
Re: You can do this by creating hidden div's on an absolute position with the help of CSS+javascript. If something fails, then show them the specified div of your choice, containing your (x-!-?) images and your warning messages. | |
Re: From the [icode]makevisible()[/icode] function, add this:[icode][b][color=red]stop[/color][/b] = setTimeout("minimize()", 4000);[/icode]. Then in the [icode]minimize()[/icode] function add this [icode]clearTimeout([b][color=red]stop[/color][/b]);[/icode] as the first statement — the rest of your code is as follows. | |
Re: Ok, let's say you have this forms on this id's (form0, form1). Now apply the code that will do a multiple [icode]submit()[/icode] on those forms, like this: [code=javascript]<script type="text/javascript"> <!-- Must go on the header section of your page. Function submitTwoForms() { for ( var x = 0; x < … | |
Re: Apply another statement that will trap different settings for different types of browsers! e.g [code]if ( document.all ) { esw = e.scrollWidth; esh = e.scrollHeight; // Which holds for IE Mode } else if ( document.getElementById ) { esw = e.scrollX esh = e.scrollY } // Which is supported by … | |
Re: Do it this way: [code=javascript]<script type="text/javascript"> var sfEls; var sfHover = function() { sfEls = document.getElementById("btn"); sfEls.onmouseover = function() { this.className += "sfhover"; }; sfEls.onmouseout = function() { // simply assign the class again, instead of replacing it. this.className = "someClass" }; }; if (window.addEventListener) window.addEventListener("load",sfHover,false); else if (window.attachEvent) window.attachEvent("onload",sfHover); … | |
Re: You can do it with CSS and a few lines of javascript: Let's say you have this classes in CSS rules. [code=css]form { min-height : 300px; margin : 0 auto; width : 95%; } /* which stated on the current form position */ form.move-to-bottom { position : absolute; bottom : … | |
Re: Here's something that you can work with, tested in ie6+ and opera9. This is the code for the (x)HTML document, all codes is as follows: [code=javascript]<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> … | |
Re: Reg pattern(s) in literal forms should not be quoted: [code]// Instead of --> myRegExp = "/index.php\?\//"; // Simply change this to --> myRegExp = /index\.php\?\//;[/code] | |
Re: I've done a Lite modification in your code, the getHTTPObject() function has been removed on. [code=javascript]var httpObject, url; function setOutput() { if ( httpObject.readyState == 4 ) { document.getElementById("outputTex").value = httpObject.responseText; } else { alert("Failed to load data " + httpObject.statusText); } } function doWork() { url = "http://10.10.2.46:4001/upperCase.php?inputText" + … | |
Re: This will help you out and get your things done in no time! Try these [url=https://developer.mozilla.org/en/AJAX/Getting_Started]L I N K[/url]! | |
Re: Use the eventListener, instead of assigning it directly on those tags that you have mentioned. The only elements that will validates with those events, are the — [icode]<!-- <a> <img .../> <form><elements></form> <area> -->[/icode]. And be sure to use only elements that is valid in the DOCTYPE that you are … | |
Re: The problem is on line #37 and #38: [code=javascript]//undefined object - // it should be theform.pass.focus() instead of: form.pass.focus(); // theform.pass.select() instead of: form.pass.select();[/code] | |
Re: Try this demo: [code=javascript]<html> <head> <title></title> <script type="text/javascript"> <!-- var number = new RegExp(/[0-9]{1,2}/) || /[0-9]{1,2}/; // This will prevent the user from entering non-numeric values on the field - // and this will also validates on two digits values, so it can only be from 0-99 function checkNum( form … | |
Re: Try this on the first anchor that trigger's your script: [code=html]<a href="javascript:void(0);" onclick="showHide('div_id'); return true;">[/code] if this doesnt work, then try to post the actual script so others can help you. | |
Re: For this issue, both is applicable! But if you want to get optimum performance in your JavaScript program's, then you should try [url=http://www.jslint.com/]THIS LINK[/url]. | |
Re: You can perform loop on the specified element's, like this: [code=javascript]function pageLoad() { var elem = document.getElementsByTagName("div"); // any reference that you can provide for ( var x = 0; x < elem.length; x++ ) { collapseAll($('myvar_'+x)); } }[/code] |
The End.