how to add text field if we select option from selection?


hello, i am sofie. here is my code. No of Partipants: -Select participant- 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 More so here is what i want to ask. if a user select 1 then one text area will be displayed. if 2, then two text will be displayed. i have tried some coding but ity takes a lot work to do. so i hope you can help me.
Posted On: Sunday 25th of November 2012 08:32:20 PM Total Views:  150
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Getting URL address from the address bar to Flash?

, I have been looking for a solution for a long time. I have embedded a SWF app in html page using SWFObject. Now I need to give the Flash app the address where it is currently embedded, since the same SWF file is embedded in more than one locations! So the Flash app is supposed to pull the right content according to its current position. I am open to everything! any ideas are welcomed! I will be fine if I have to send the current URL through JS in my embedding html! please help! !!!
VIEWS ON THIS POST

86

Posted on:

Saturday 24th November 2012
View Replies!

How to add javascript function into another?

Hi all, I'm down with a question. How do i add in a javascript function into another function For eg. I have a button that enable me to create a new table on the page. when the table is created, there is input of text with calendar function. Is it possible to do so Greatly appreciated for your help.
VIEWS ON THIS POST

90

Posted on:

Saturday 24th November 2012
View Replies!

How to add div's and make them scroll

I want to make a sms system, where users can send a sms message and then it is showed. So for every new message I get I need to make a new div, add it and scroll the others down Does anyone know a good example or tutorial to get me started on this
VIEWS ON THIS POST

125

Posted on:

Saturday 24th November 2012
View Replies!

Open new window without title & address bars in?

Hi , hope someone can help. I'm very much a beginner in Javascript and 'ok' in html but just cannot get a new (picture) window to open in Firefox without the title and address bars (or anything else, just the image). IE shows just the title bar, with or without the code: function newWindow() {window.open('./pageaddress.html','winname','top=20,left=20,directories=0,titlebar=0,toolbar=0,location=0,status=0,menubar=0,scrollbars=no,resizable=no,width=400,height=350');} The window opens fine, but always shows the address and title bars. I have read the W3 Schools options list (and other posts) and tried both 'no' and '0' as values, without any success. What am I missing and is there any way to make this work - it didn't even work in the W3 Schools 'try it yourself' test page! I have seen some very nice 'slowly-opening' windows (increasing in size), which would be even better, any links to info on these would also be much appreciated.
VIEWS ON THIS POST

109

Posted on:

Saturday 24th November 2012
View Replies!

how can I add a data as an http header field?

I am using jquery's ajax method to POST data to a server. I am using the servers API, and it is stated that in whatever request, I have to include this "authentication token" to access the data I need, either as an http header field or a header parameter. I prefer to add it as an http header, but I don't know how to add it. I need help. Thank you. :D Here's a part of my code. I wish to add a field for a token. $.ajax({ type: "POST", url: url, async: true, contentType: "application/x-www-form-urlencoded; charset=UTF-8", success: function(){ alert("YEEHA!"); } });
VIEWS ON THIS POST

124

Posted on:

Saturday 24th November 2012
View Replies!

addEventListener for IE

Hi all, I've heard great things about this place, so thought I'd see if anyone had some thoughts on something that's been bugging me. I'm creating a script which causes the page to scroll when the mouse is held down within 1/3 of the page height of the window edge. An example can be found at http://medicles.co.uk/scroll.html , and is working fine in Firefox, Safari and Chrome, but not in IE. I'm 90% certain this is due to the browser's non-handling of addEventListener, but I'm not sure how to fix this...I've tried the following so far: if (document.addEventListener){ document.addEventListener('mousemove', changeState, true); document.addEventListener('mouseout', stopScrollingIfOutsideWindow, true); document.addEventListener('mousedown', markMouseDown, true); document.addEventListener('mouseup', unmarkMouseDown, true); } else if (document.attachEvent){ document.attachEvent('onmousemove', changeState); document.attachEvent('onmouseout', stopScrollingIfOutsideWindow); document.attachEvent('onmousedown', markMouseDown); document.attachEvent('onmouseup', unmarkMouseDown); } The above is currently commented out, and the page is using the following code at the moment (which I found somewhere else on the net), still with no success: //***Cross browser attach event function. For 'evt' pass a string value with the leading "on" omitted //***e.g. AttachEvent(window,'load',MyFunctionNameWithoutParenthesis,false); function AttachEvent(obj,evt,fnc,useCapture){ if (!useCapture) useCapture=false; if (obj.addEventListener){ obj.addEventListener(evt,fnc,useCapture); return true; } else if (obj.attachEvent) return obj.attachEvent("on"+evt,fnc); else{ MyAttachEvent(obj,evt,fnc); obj['on'+evt]=function(){ MyFireEvent(obj,evt) }; } } //The following are for browsers like NS4 or IE5Mac which don't support either //attachEvent or addEventListener function MyAttachEvent(obj,evt,fnc){ if (!obj.myEvents) obj.myEvents={}; if (!obj.myEvents[evt]) obj.myEvents[evt]=[]; var evts = obj.myEvents[evt]; evts[evts.length]=fnc; } function MyFireEvent(obj,evt){ if (!obj || !obj.myEvents || !obj.myEvents[evt]) return; var evts = obj.myEvents[evt]; for (var i=0,len=evts.length;i
VIEWS ON THIS POST

77

Posted on:

Saturday 24th November 2012
View Replies!

Help needed to add extra column

I am new to javascript and downloaded an script to my website. It has columns like Bid, Ask, High values. I like to add an extra column (Spread = Ask Bid). Is their way to add this extra column Any guidance or reference to material is highly appreciated. Applet:
VIEWS ON THIS POST

77

Posted on:

Saturday 24th November 2012
View Replies!

javascript: addContent - Packaging Options

While making use of a sample for addContent (located at http://www.randomsnippets.com - specific page here ) I stumbled into a problem that I hope someone can help on. This may not be the best/only way to skin this cat, but we have a PHP/MySQL page that has to be modified to ADD rows for data entry when needed. I have abandoned the traditional DOM object methods of adding a single row, since in this case the addition would be a whole block of rows. I don't think I'm smart enough to do that... Anyway, an idea hit me to make use of our MySQL dB and store the rows in there, and retrieve them using their method. function addContent(divName, content){ document.getElementById(divName).innerHTML = content; } Content to be added: Your content will be added dynamically below: Skipping an ultimate requirement that the content of the addition be invisible and inaccessible, I tried the above out.It works, but the variable ($_value) has form elements in it, including , and the close of that tag interrupts the value and throws the remaining code to the page, not awaiting insertion by the Submit Button. Example: http://www.facey.com/insert_content1.php The Submit button successfully produces the part that stayed inside, but you see my problem. IS THERE A WAY to use this javascript addContent function, incorporate the utility of an ADD button but avoid using the packaging of FORMS
VIEWS ON THIS POST

67

Posted on:

Saturday 24th November 2012
View Replies!

addEventListener for window.onload

I'm trying to writer a timer to demonstrate how long it takes to load a web page and all its content. I want to repeat the load throughout the day to demonstrate slowdown at times of peak usage. I know there are tools like HTTP Watch and HTTP Analyzer that work at the HTTP transaction level, but I need to report the whole user experience. I've tried // Start timer window.open( "http:://myurl", ""); // End timer ...but as the window opens asynchronously, the timer is too small. I really want to acheive the snippet above, but with a synchronouswindow.open. I believe that I need to force an onLoad event onto thewindow, so that it fires when the document (and all its content, such as images) have finished loading. I understand that this is done by adding an event handler to the window, so that when the page content finishes loading, it will run a function to trap the end timer, but I can't get it to work. My best shot at the code fragment so far is: function Showtrap() { x.close(); alert( "Page displayed" ); } function loadPage() { start_time = new Date().getTime(); x = window.open( url, "temp" ); x.document.addEventListener("load", Showtrap, false); } but this gives an error:Error: Permission denied for to get property Window.document from . or: x = window.open( url, "temp" ); x.onload = Showtrap; but this gives error: Error: Permission denied for to set property Window.onload on . Can you tell me what I'm doing wrong Help. Full text of my script so far (currently, I load it from disk) function sleep(milliseconds) { var start = new Date().getTime(); for (var i = 0; i < 1e7; i++) { if ((new Date().getTime() - start) > milliseconds){ break; } } } function trap() { var t = new Date; duration = t.getTime() - start_time; log_data.innerHTML += t.getFullYear() + "/" + (t.getMonth()+1) + "/" + t.getDate() + " " + t.getHours() + ":" + t.getMinutes() + ":" + t.getSeconds() + "." + t.getMilliseconds() + "\t" + (t.getTime() - launch) + "\t" + duration + "\n"; } function Showtrap() { x.close(); alert( "Page displayed" ); } function loadPage() { start_time = new Date().getTime(); x = window.open( url, "temp" ); //x.document.addEventListener("load", Showtrap, false); x.onload = Showtrap; } function StartLoop() { url = document.getElementById( "page" ).value; launch = new Date().getTime(); delay = document.getElementById( "delay" ).value; loadPage(); intervalID = setInterval( loadPage, delay*1000 ); document.getElementById( "start" ).style.visibility = "hidden"; document.getElementById( "stop" ).style.visibility = "visible"; } function StopLoop() { clearInterval( intervalID ); document.getElementById( "start" ).style.visibility = "visible"; document.getElementById( "stop" ).style.visibility = "hidden"; } function ClearLog() { log_data.innerHTML = ""; } Page to fetch (dont forget http:// or https://) : Every seconds Timings Time From start Duration (milliseconds) log_data = document.getElementById('data');
VIEWS ON THIS POST

77

Posted on:

Saturday 24th November 2012
View Replies!

Problem passing email address through AJAX

I am facing problems passing an email address to a php file through AJAX. The code I am using is pretty basic but I can't seem to get it to work. Could anyone help me understand what's going wrong I amd pretty new to Ajax (about 2 days old) so please forgive me if this seems pretty lame. function emailchk () { if (!document.getElementById("email").value) { document.getElementById("emailmsg").innerHTML = " "; } else { url = "emailchk.phpemail=" + document.getElementById("email").value; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest(); } else { if (window.ActiveXObject) { try { xhr = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } } } if (xhr) { xhr.onreadystatechange = showEmailContents; xhr.open("GET", url, true); xhr.send(null); } else { alert("Sorry, but I couldn't create an XMLHttpRequest"); } return false; } } function showEmailContents() { if (xhr.readyState == 4) { if (xhr.status == 200) { var outMsg = xhr.responseText; } else { var outMsg = "There was a problem with the request " + xhr.status; } document.getElementById("emailmsg").innerHTML = outMsg; if (outMsg == "Email already exists") { document.getElementById("validate").value = "no"; } else { document.getElementById("validate").value = "yes"; } } } The PHP file is also pretty basic...
VIEWS ON THIS POST

164

Posted on:

Saturday 24th November 2012
View Replies!

How do I add this javacript code into a php coded?

all! I do not have a great knowledge of php but I do know basic html. I have a javascript popunder script that I would like to try on my site that runs on a php script. I know how to insert this script into an html page but I can't get it to work in php. I inserted the javascript that would go in the of the html, before the
VIEWS ON THIS POST

99

Posted on:

Saturday 24th November 2012
View Replies!

add to div

i use jquery and this function: var news = setInterval(function() { $('#news).load(news2.phpid='+ Math.random()); }, 5000); But this function re-enter div. I want to add a div, that old data remains.
VIEWS ON THIS POST

123

Posted on:

Saturday 24th November 2012
View Replies!

need to add "." check to form validation

I have this email validation which checks to make sure a "@" sign is present but doesn't check for "." I just need to add this to the function which I thought would be pretty easy but has proved otherwise. Here's my script: I tried adding another if statement that looked like this... if (test.indexOf('isEmail')!=-1) { p=val.indexOf('.') ...just after the '@' check, but that didn't seem to work.
VIEWS ON THIS POST

185

Posted on:

Saturday 24th November 2012
View Replies!

Autocompelete textbox on add/remove row

the more i deep to javascript more i got confused..!! . . i have put a autocomplete texbox in a row.. which have two more buttons Add/Remove..!! . . With add u can append clone row under original row... and withy delete u can delete the row..!!!! . . Problems when i add new row... which make clone of original row..!! which means that Id of autocomplete also get cloned...!!!! . . Please help me out..!!! :( my javascript code..!! function add(oRow) { oRow.parentNode.replaceChild(oRow.cloneNode(true),oRow.parentNode.insertRow(oRow.rowIndex+1)); var inpR = oRow.getElementsByTagName('input'); var inpN = oRow.nextSibling.getElementsByTagName('input'); inpR[0].id = 'month_' + parseInt(oRow.rowIndex+2); iteration = parseInt(oRow.rowIndex+2); for(i=0;i
VIEWS ON THIS POST

175

Posted on:

Saturday 24th November 2012
View Replies!

Obfuscating email addresses in HTML

I've created a fairly simple method for obfuscating email addresses as an anti-spam measure. It should work for any browser that supports JavaScript and a fairly modern Document Object Model (DOM). A composer window in the user's default email application will be opened. First up is the javascript function that assembles the mailto: url and 'submits' it: // Action taken when an email 'link' is clicked function local_emclick(parm1, parm2) { test_4 = "lto:"; d37 = "@"; t2 = "mai"; parm = t2+test_4+parm1+d37+parm2; self.location = parm; } You should customize everything (but the script tags and function and self.location) to prevent spammers from learning to recognize the pattern. Even the order of the parameters should be customized. Next up is the PHP function that eases using this method: function local_emlink($one, $two, $three, $four, $five="") { if ($five!="") { $smso = ""; $rmso = ""; } else { $smso = ""; $rmso = ""; } print("$smso$four$rmso"); } An example of its use is: Sample Company 012 Rhode St. Notown, MI 00000 (123)555-7890 Fax: (123)555-7891 If you don't have access to PHP, then you can create the link directly in HTML. This is the same HTML generated by the PHP, except for whitespace:: Contact
VIEWS ON THIS POST

233

Posted on:

Saturday 24th November 2012
View Replies!

"add this site to your bookmarks" in firefox

Is it possible to have a link so users can add my site to their bookmarks via a link I have found out how to do it using IE but it doesn't work with Firefox. Cheers for anyhelp.
VIEWS ON THIS POST

133

Posted on:

Saturday 24th November 2012
View Replies!

Need to add multiple measurements virtual earth

Does anyone know how to add more measurements to this code without continuing to measure the same distance which is what it does. I want to measure the distance between 2 points, then measure the distance between another 2 points keeping each measurement stored as a variable. geocodecalc.js /* ******************************************************** */ /* The code for the GeoCodeCalc class was copied from here: */ /* http://pietschsoft.com/Blog/Post.aspxPostID=1452 */ /* ******************************************************** */ var GeoCodeCalc = {}; GeoCodeCalc.EarthRadiusInMiles = 3956.0; GeoCodeCalc.EarthRadiusInKilometers = 2.093E+07; GeoCodeCalc.ToRadian = function(v) { return v * (Math.PI / 180); }; GeoCodeCalc.DiffRadian = function(v1, v2) { return GeoCodeCalc.ToRadian(v2) - GeoCodeCalc.ToRadian(v1); }; GeoCodeCalc.CalcDistance = function(lat1, lng1, lat2, lng2, radius) { return radius * 2 * Math.asin( Math.min(1, Math.sqrt( ( Math.pow(Math.sin((GeoCodeCalc.DiffRadian(lat1, lat2)) / 2.0), 2.0) + Math.cos(GeoCodeCalc.ToRadian(lat1)) * Math.cos(GeoCodeCalc.ToRadian(lat2)) * Math.pow(Math.sin((GeoCodeCalc.DiffRadian(lng1, lng2)) / 2.0), 2.0) ) ) ) ); }; default.htm.js function LoadMap() { // Load the Map map = new VEMap("myMap"); map.LoadMap(); var latLong = new VELatLong(39.882123, -75.513219); // Attach our onclick map event handler map.AttachEvent("onclick", Map_Click); map.SetCenterAndZoom(latLong, 20); map.SetMapStyle("a"); } // The Map onclick event handler function Map_Click(eventArgs) { var clickedLatLong = eventArgs.latlong; if (map.GetMapMode() == VEMapMode.Mode2D) document.getElementById("myMap").style.cursor = 'crosshair'; { // In 2D Mode the eventArgs.latlong property doesn't contain the lat/long point that was clicked. // So we must figure it out using the x and y coordinates of the point on the map that was clicked. clickedLatLong = map.PixelToLatLong(new VEPixel(eventArgs.mapX, eventArgs.mapY)); } // When the user Right-Clicks, Draw the Polygon if (eventArgs.leftMouseButton) { var newShape = null; if (map.GetShapeLayerCount() > 0) { // Get reference to the Default Shape Layer var shapeLayer = map.GetShapeLayerByIndex(0); if (shapeLayer.GetShapeCount() > 0) { // Get points already plotted var points = shapeLayer.GetShapeByIndex(0).GetPoints(); // Add the newly clicked point to the collection of points points[points.length] = clickedLatLong; newShape = new VEShape(VEShapeType.Polyline, points); // Don't show the shapes icon on the map, we only want to see the line newShape.HideIcon(); } } if (newShape == null) { // If this is the first Point plotted, then show it as a Pushpin newShape = new VEShape(VEShapeType.Pushpin, clickedLatLong); } // Clear out the old shape map.DeleteShapes(); // Add our new shape map.AddShape(newShape); CalculateDistance(); } } function CalculateDistance() { var distMessage = document.getElementById("spanDistanceMessage"); var dist = document.getElementById("spanDistance"); var points = new Array(); // Get all the Points being plotted if (map.GetShapeLayerCount() > 0) { var shapeLayer = map.GetShapeLayerByIndex(0); if (shapeLayer.GetShapeCount() > 0) { points = shapeLayer.GetShapeByIndex(0).GetPoints(); } } if (points.length Virual Earth - Calculate Distance UI Example Virual Earth - Calculate Distance UI Example How To: You can scroll/zoom around the Map as normal. Just Right-Click the Map to draw a polyline and measure it's length. Distance: Plot more points to Calculate distance. Units:  Miles  Feet Written by Chris Pietschmann This code was originally posted here: http://pietschsoft.com/Blog/Post.aspxPostID=1453
VIEWS ON THIS POST

126

Posted on:

Saturday 24th November 2012
View Replies!

linking dynamically added drop down using javascript

hi every1 i m using jsp in jbuilder9 to create a website i have 2 drop down button a1 and b1 when i select a option in a1 the values of b1 comes if i change the value of a1 then the value of b1 also changes. then i have a button to dynamically add 2 similar drop downs i click the button. the drop down are added a2 and b2 but the problem is when i select some thing in a2 the value of b1 changes instead of b2. i m not getting the solution. plz if any 1 can help me out.
VIEWS ON THIS POST

154

Posted on:

Saturday 24th November 2012
View Replies!

JavaScript -- Validating an email address

Is there a way to validate an email by checking it's existence, As far as I know there is no way to see if an email is a valid one. (otherwise spammers would be in heaven). But there is a technique used to make sure somebody is using a real email. I dont know what your application is but lets say somebody is signing up to be a member on your site, or any sort of application. You will probably need to give them information after they hit submit. (username, password, receipt info....) any of these things you could display on the "confirmation page" but why do that. If they are using a fake email for whatever reason, you'll never know. Just send them their username, password etc. to their email. This keeps them honest. They must check their email to do anything else, therefore it must be valid By the way, a lot of these things have nothing to do with JavaScript
VIEWS ON THIS POST

126

Posted on:

Saturday 24th November 2012
View Replies!

Is it possible to add a "Continued on next page..."?

Is there a way in JavaScript to add a footer to the bottom of each page that says something like "Continued on next page..." when the user prints the document I know that the footer is generally controlled by the client's browser, and am not trying to get rid of that; I simply want to add my own message above that. Is there a way to include this footer (only) when printing from a browser
VIEWS ON THIS POST

106

Posted on:

Saturday 24th November 2012
View Replies!