Submit form with Javascript timer - JavaScript Help


Title var x=0; var y=10; function count() { y=y-1; document.getElementById('txt').innerHTML=x+":"+y; if (y
Posted On: Wednesday 2nd of January 2013 12:36:59 AM Total Views:  248
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Modal Window API

Hi , Does anybody know of some Modal Window API I made a custom modal window for my website, but it gave problems in IE7. I need to put various forms like login, newsletter, etc into them.
VIEWS ON THIS POST

58

Posted on:

Saturday 24th November 2012
View Replies!

Help with JavaScript syntax

I'm absolutely new to JavaScript, so I don't know quite well what I'm doing. Does this look right (inside of HTML) - window.onload=SI.Files.stylize(); And what is si.files.js Is it a file I have to create and place into some directory What is supposed to be in it Perhaps, this: window.onload=SI.Files.stylize(); belongs there I am really sorry for the dumb questions, but I know nothing about JavaScript. The source of confusion is this: http://www.shauninman.com/archive/2007/09/10/styling_file_inputs_with_css_and_the_dom The HTML and CSS parts went smoothly for me, I guess, but the whole thing doesn't work. Thank you!
VIEWS ON THIS POST

78

Posted on:

Saturday 24th November 2012
View Replies!

CustomSearch Box

I want to create custom search box like Google. I want to place the image inside the textbox and when user click on textbox the image on textbox must disappear.How it is possible.
VIEWS ON THIS POST

39

Posted on:

Saturday 24th November 2012
View Replies!

how to update feeds dynamically

i am developing a social networking site as my project in college. i have a doubt on php and mysql.. """ I TWITTER OR FACEBOOK OR IN GMAIL WHEN THERE IS NO ACTION FROM USER(BROWSER) THAT IS, THE USER LOGS IN AND STAY STILL(NOT RELOADING THE PAGE). HOW CAN WE UPDATE THE FEEDS OR MESSAGES DYNAMICALLY AS OHTER USERS SENDING MAILS OR DOING SOME ACTIVITY IN THEIR PROFILES. """"" I WANNA KNOW HOW CAN WE SHOW SOME MESSAGE FROM DATABASE TO THE CLIENT WITHOUT ANY BROWSER ACTION FROM USER. JUST LIKE FACEBOOK FEEDS AND TWEETS.. WAITING FOR REPLY
VIEWS ON THIS POST

112

Posted on:

Saturday 24th November 2012
View Replies!

Spry Menu Problem!

I recently created a website with a spry dropdown navigation bar. On preview from Dreamweaver CS4, in Firefox, IE, Opera, Chrome, all elements work properly and the dropdown menus work as well. However, when I upload it to my server at the domain http://www.kcsslibrary.com , the dropdown menus do not show up on rollover. I don't know what is going on. The .js file and .css file are both appropriately linked to the root folders as well. The dropdowns are supposed to be displayed under 'online resources' and 'citing your work' help appreciated! Thank You.
VIEWS ON THIS POST

74

Posted on:

Saturday 24th November 2012
View Replies!

Reading textbox value in new window using jquery

I have an array of textboxes each having button on right side which when pressed the text should be displayed on new window using Jquery. For demo, you might have seen jquery lightbox plugin which shows the images in the new window. I want exactly same but instead of images i want to show the text value of the text box when its button is pressed. You also see this when you sign in on daniweb.com, you see a new small window when "sign in" button is pressed. Please tell me how can i do that
VIEWS ON THIS POST

233

Posted on:

Saturday 24th November 2012
View Replies!

show hide divs

I'm new at javascript. I'm looking for help with the code below. I am trying to create a nav bar with opening and closing divs (vertical tab menu). However I'd like to have the ability for the user not to have to close the div in order to select the next div. Is there any action i can add to the code below to enable this function Thank you. Dropdown One Dropdown Two
VIEWS ON THIS POST

164

Posted on:

Saturday 24th November 2012
View Replies!

Ajax Suggestive Text

I have the code to show predictive text when a user enters a value, However I am struggling to change its behaviour. Currently it shows the suggestions seperately, I would like to alter it so its shows the value in the search box and then the user can select a suggestion (in a similar way to youtube or google) Hotel Suggestions: var xmlHttp function showHint(str) { if (str.length==0) { document.getElementById("txtHint").innerHTML=""; return; } xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="gethint.php"; url=url+"q="+str; url=url+"&sid="+Math.random(); xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } function stateChanged() { if (xmlHttp.readyState==4) { document.getElementById("txtHint").innerHTML=xmlHttp.responseText; } } function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; }
VIEWS ON THIS POST

54

Posted on:

Saturday 24th November 2012
View Replies!

xmlhttprequest does not work if accessed inside iframe?

i've created a form like this send.php is used to save data posted from the form, and call a function called getURL in main window parent.getURL('thankyou.php') function getURL(url){ var xmlHttp=GetXmlHttpObject(); function stateChanged() { if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete"){ document.getElementById('maindiv').innerHTML=xmlHttp.responseText; } else { document.getElementById('maindiv').innerHTML = document.getElementById("divloading").innerHTML } } xmlHttp.onreadystatechange=stateChanged ; xmlHttp.open("GET",url,true); xmlHttp.send(null); } if getURL called from send.php using above syntax, the xmlHttp.readyState value is never reach something after 1 and getURL never finished. Please note that this problem happened only if getURL is called from inside iframe, and using Opera. Firefox doesnt suffer from this problem. Does anyone has any idea to solve the problem
VIEWS ON THIS POST

159

Posted on:

Saturday 24th November 2012
View Replies!

restrict source view

hai .................. hey anybody got i dea abt how to restrict the user from viewing the JS source .......... pls help
VIEWS ON THIS POST

82

Posted on:

Saturday 24th November 2012
View Replies!

Firefox JS onclick concurrency problem?!?

I'm trying to display an animated GIF while submitting a form. This works fine in Internet Explorer, but not in FireFox (3.0). Firefox only shows the animated GIF and never submits the form. Here's my script: Here's my button: Does IE process the two functions in my "onclick" handler differently than FireFox
VIEWS ON THIS POST

127

Posted on:

Saturday 24th November 2012
View Replies!

Jquery : get elements by index from the wrapper set

, While playing with jquery i've come across the following situation : $(document).ready(function(){ $("div")[0].css("background-color","blue"); }); I get an error everytime i try to call any method on a particular element from the wrapper set . I tried with the get() $("div").get(0); Same stuff . I can't spot what the problem is . Thank u
VIEWS ON THIS POST

137

Posted on:

Saturday 24th November 2012
View Replies!

Date picker field for HTML forms

Is there a specific tag in html so as to make a field behave as a date picker in a form
VIEWS ON THIS POST

73

Posted on:

Sunday 25th November 2012
View Replies!

how i get two variables

When you push through an AJAX request, all the variables can be sent through the querystring, you can send multiple variables using ampersand(&). In you case xmlhttp.open("GET","tablebase.phpq="+str+"&q2="+str2,true); where str2 would hold the data you need to send to q2.
VIEWS ON THIS POST

90

Posted on:

Sunday 25th November 2012
View Replies!

Can I have a form without having an associated file.

In every book I have on HTML, it shows a database or other file associated with a form. I want to use form elements with JavaScript to control the web pages themselves, without the use of an external file. Can this be done
VIEWS ON THIS POST

139

Posted on:

Sunday 25th November 2012
View Replies!

How do I pass PHP variable names to Javascript function.

I have two pages one called upload-file.php, this page uploads the image into the database and my folder. My PHP page looks like this. if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { $insert=mysql_query("insert into match_item_image set item_id='".$_SESSION["session_temp"]."', image='".$name."', adid='$adid'") or die(mysql_error()); $cc=mysql_insert_id(); echo "success".$cc; My other page consist of a javascript function which displays my images upon upload. The problem I am having is that I need to change the image name when uploading it into my folder. I was able to change the image name but when I upload the image it displays blank because the JavaScript function Is looking for the original name of the image, when the users uploads the file. This is part of the function: $(function() { var btnUpload=$('#upload'); var status=$('#status'); new AjaxUpload(btnUpload, { action: 'upload-file.php', name: 'uploadfile', onSubmit: function(file, ext) { if (! (ext && /^(jpg|png|jpeg|gif)$/.test(ext))){ // extension is not allowed status.text('Only JPG, PNG or GIF files are allowed'); return false; }status.text('Uploading...'); }, onComplete: function(file, response) { //On completion clear the status status.text(''); //Add uploaded file to list var bb=response.substr(0,7) var idd=response.replace('success',' '); var idb =idd.replace(/^\s*|\s*$/g,''); if(bb==="success") { $('').appendTo('#files').html(' Delete ').addClass('success'); } else { $('').appendTo('#files').text(response).addClass('error'); } Please let me know if anyone can help. I am new to javascript.
VIEWS ON THIS POST

107

Posted on:

Monday 26th November 2012
View Replies!

Javascript question

Is there a way to create an onclick event that will take a file and post it similar to the browse/upload form in html
VIEWS ON THIS POST

141

Posted on:

Monday 26th November 2012
View Replies!

i have problem with jsp pages

hello, i have problem in jsp pages i cant recieve values from html pages in to jsp pages... let me give example Welcome to my home name: and jsp page as Name enterd was and after running in localhost... i am getting output as Name enterd was on jsp page...now i am unable to recieve name from html to jsup page...please help me in this problem... ** Edit **
VIEWS ON THIS POST

84

Posted on:

Monday 26th November 2012
View Replies!

How to call jsp use bean method inside javascript

, I want to call a class function using beans inside java script. but it is not working. It calls that function only 1 time. function getProgress() { document.getElementById('progress').innerHTML = ''; } I want that Whenever user clicks on button , I call getProgress function on onclick event that fetches progress using findprogress() method. please help.
VIEWS ON THIS POST

105

Posted on:

Monday 26th November 2012
View Replies!

Ajax not working in Mozilla firefox

I have tested following code and it works fine in IE but not Mozilla: var ajax = false; if (window.XMLHttpRequest) { ajax = new XMLHttpRequest(); } else if (window.ActiveXObject) { try { ajax = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e1) { try { ajax = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e2) {} } } if (!ajax) { alert ('Some page functionality is unavailable.'); } Please tell me what is the solution
VIEWS ON THIS POST

323

Posted on:

Monday 26th November 2012
View Replies!

Countdown timer between dates

Hi , I have developed a application in jsp. I need to achieve a count down timer(days,hours,minutes,seconds) between from date to todate, considering below cases. below are assumed (1) I have 4 product, for each product i have different end date stored in mysql in DB. (2) I need to calculate time time remaining for the end date for each product, for eg; Product 1 end date : 10/05/2010 (i need to show the time remaining for the end of 10/05/2010 from current time and date). Like wise i need to show for different products. How to achieve this. Solutions for this would be highly appreciated.
VIEWS ON THIS POST

83

Posted on:

Monday 26th November 2012
View Replies!

Self-destructing web browser

Hi . I, like the majority of us web developer's, despise internet explorer. So on my site, i want to put something in just for the fun of it that detects IE and says something. Right now i have just a plain alert asking to please change to a different web browser. I want to have it say something like, P.S. this web browser will self-destruct in 5 seconds. And then have a countdown or something. I don't know, I just want some ideas and how to accomplish them with java and php.
VIEWS ON THIS POST

60

Posted on:

Monday 26th November 2012
View Replies!

auto hide tooltip

hi here i am using tool tip code but i want the tool tip to auto hide please help me out from this thanks in advance // Tooltip Object var Tooltip = Class.create(); Tooltip.prototype = { initialize: function(el, options) { this.el = $(el); this.initialized = false; this.setOptions(options); // Event handlers this.showEvent = this.show.bindAsEventListener(this); this.hideEvent = this.hide.bindAsEventListener(this); this.updateEvent = this.update.bindAsEventListener(this); Event.observe(this.el, "mouseover", this.showEvent ); Event.observe(this.el, "mouseout", this.hideEvent ); // Removing title from DOM element to avoid showing it this.content = this.el.title; this.el.title = ""; // If descendant elements has 'alt' attribute defined, clear it this.el.descendants().each(function(el){ if(Element.readAttribute(el, 'alt')) el.alt = ""; }); }, setOptions: function(options) { this.options = { backgroundColor: '#fff', // Default background color borderColor: '#000', // Default border color textColor: '#EE3399', // Default text color (use CSS value) textShadowColor: '', // Default text shadow color (use CSS value) maxWidth: 250, // Default tooltip width align: "left", // Default align delay: 250, // Default delay before tooltip appears in ms mouseFollow: true, // Tooltips follows the mouse moving opacity: 100, // Default tooltips opacity appearDuration: .25, // Default appear duration in sec hideDuration: false // Default disappear duration in sec }; Object.extend(this.options, options || {}); }, show: function(e) { this.xCord = Event.pointerX(e); this.yCord = Event.pointerY(e); if(!this.initialized) this.timeout = window.setTimeout(this.appear.bind(this), this.options.delay); }, hide: function(e) { if(this.initialized) { this.appearingFX.cancel(); if(this.options.mouseFollow) Event.stopObserving(this.el, "mousemove", this.updateEvent); new Effect.Fade(this.tooltip, {duration: this.options.hideDuration, afterFinish: function() { Element.remove(this.tooltip) }.bind(this) }); } this._clearTimeout(this.timeout); this.initialized = false; }, update: function(e){ this.xCord = Event.pointerX(e); this.yCord = Event.pointerY(e); this.setup(); }, appear: function() { // Building tooltip container this.tooltip = Builder.node("div", {className: "tooltip", style: "display: none;" }, [ Builder.node("div", {className:"xtop"}, [ Builder.node("div", {className:"xb1", style:"background-color:" + this.options.borderColor + ";"}), Builder.node("div", {className:"xb2", style: "background-color:" + this.options.backgroundColor + "; border-color:" + this.options.borderColor + ";"}), Builder.node("div", {className:"xb3", style: "background-color:" + this.options.backgroundColor + "; border-color:" + this.options.borderColor + ";"}), Builder.node("div", {className:"xb4", style: "background-color:" + this.options.backgroundColor + "; border-color:" + this.options.borderColor + ";"}) ]), Builder.node("div", {className: "xboxcontent", style: "background-color:" + this.options.backgroundColor + "; border-color:" + this.options.borderColor + ((this.options.textColor != '') "; color:" + this.options.textColor : "") + ((this.options.textShadowColor != '') "; text-shadow:2px 2px 0" + this.options.textShadowColor + ";" : "")}, this.content), Builder.node("div", {className:"xbottom"}, [ Builder.node("div", {className:"xb4", style: "background-color:" + this.options.backgroundColor + "; border-color:" + this.options.borderColor + ";"}), Builder.node("div", {className:"xb3", style: "background-color:" + this.options.backgroundColor + "; border-color:" + this.options.borderColor + ";"}), Builder.node("div", {className:"xb2", style: "background-color:" + this.options.backgroundColor + "; border-color:" + this.options.borderColor + ";"}), Builder.node("div", {className:"xb1", style:"background-color:" + this.options.borderColor + ";"}) ]), ]); document.body.insertBefore(this.tooltip, document.body.childNodes[0]); Element.extend(this.tooltip); // IE needs element to be manually extended this.options.width = this.tooltip.getWidth(); this.tooltip.style.width = this.options.width + 'px'; // IE7 needs width to be defined this.setup(); if(this.options.mouseFollow) Event.observe(this.el, "mousemove", this.updateEvent); this.initialized = true; this.appearingFX = new Effect.Appear(this.tooltip, {duration: this.options.appearDuration, to: this.options.opacity }); }, setup: function(){ // If content width is more then allowed max width, set width to max if(this.options.width > this.options.maxWidth) { this.options.width = this.options.maxWidth; this.tooltip.style.width = this.options.width + 'px'; } // Tooltip doesn't fit the current document dimensions if(this.xCord + this.options.width >= Element.getWidth(document.body)) { this.options.align = "right"; this.xCord = this.xCord - this.options.width + 20; } this.tooltip.style.left = this.xCord - 7 + "px"; this.tooltip.style.top = this.yCord + 12 + "px"; }, _clearTimeout: function(timer) { clearTimeout(timer); clearInterval(timer); return null; } };
VIEWS ON THIS POST

88

Posted on:

Monday 26th November 2012
View Replies!

window.onload. Variable does not instantiate

I'm starting playing with javascript and bounce to some problems. The script tries to read the background color that is set using stylesheet and set a global variable with this value for later use. It seems that the variable does not instantiate (and btw. there is more than one on my html document) Here is the snippet: window.onload= function(){ pSections = document.getElementsByTagName("p"); originalColor = pSections[0].style.backgroundColor; alert("the original color was: " + originalColor); } Do you know why is this not working
VIEWS ON THIS POST

89

Posted on:

Monday 26th November 2012
View Replies!

zoom image

i want to implement "http://road.fullspeedahead.com/fly.aspxtaxid=222&layout=product", i need help.....\t
VIEWS ON THIS POST

189

Posted on:

Monday 26th November 2012
View Replies!

Filling 2nd dropdown by choice in first

SPORT Choose Sport Tennis Cricket PLAYERS
VIEWS ON THIS POST

106

Posted on:

Tuesday 27th November 2012
View Replies!

HELP! With Javascripts Pop-Up Window

Hi - I am currently using a Javascript for a pop up window that enlarges a thumbnail picture. I wish the POP UP window image to be LINKABLE - that is on mouseover of IT, goto a new window URL - Any help would be extremely appreciated!!! My Current URL for this project is: www.webdesign.johnrandazzo.net/portfolio.htm (then mouseover one of the designs to pop up the window in question) CURRENT JAVASCRIPT CODE:
VIEWS ON THIS POST

94

Posted on:

Tuesday 27th November 2012
View Replies!

sorting a textarea.

Hi all, I am a newbie to javascript learning it for 2 months now, i am trying to make a sorter who will read english words from the one tex area or data file and show the result in the ...
VIEWS ON THIS POST

107

Posted on:

Tuesday 27th November 2012
View Replies!

wanted ideas on how to implent a Jquery Ajax script - JavaScript Help

i am kind of wanting to make a script like the twitter epenis scripthttp://www.epenis.nl/however it uses API to grab everything the site i am wanting to grab stuff off of does not currently have an APIthe url to the site to ones usernames looks something likemysite.com/usernamethe friends page looks likemysite.com/friends.phpuser=username&list=friends&of=pagenumber&number=numberif anyone can tell me how i would modify this script to use a NON Ajax API for jquery and how i would modify the image around the search box.i would be grateful. :confused:
VIEWS ON THIS POST

91

Posted on:

Tuesday 27th November 2012
View Replies!

changing div style property onclick - JavaScript Help

I have a div which shows and hide when clicking on More and Less button.I have a pagination code in php written in this div.So when i click next button the next page come but the div will be close.How can i make this div opened when i go to the next page. function toggle_fulltxt(id) { var v = document.getElementById('fulltxt'+id).style.display; var morelnk; var lesslnk; if (v=='none') { v='inline'; morelnk='none'; lesslnk='block'; } else { v='none'; morelnk='inline'; lesslnk='none'; } document.getElementById('fulltxt'+id).style.display = v; document.getElementById('fulltxtlnk'+id).style.display = morelnk; document.getElementById('lesstxtlnk'+id).style.display = lesslnk; return false; } function divs_style(){ document.getElementById('fulltxt001').style.display="inline"; } ... LISTS OF HOTELS >
VIEWS ON THIS POST

85

Posted on:

Tuesday 27th November 2012
View Replies!

dropdown list problem urgent help needed pls - JavaScript Help

i have manually created this dropdown list and it shows the list perfectly for the selected service.\,only problem now is when i select "zed-catcher" from the list,thus i am selected a different catcher for that service, i want to display something.. as i have my code now it is not working...please help\t been struggeling with it for too long now :) > please help\t
VIEWS ON THIS POST

109

Posted on:

Tuesday 27th November 2012
View Replies!

Getting name value - JavaScript Help

What I'm wanting to do is grab the Charactername of the first characterid in the CharacterIDList and I'm not sure with all the factors i have how to accomplish this. And after I get the name then assign in to var defaultchar in place of the mark. var defaultchar = var liElements = $("ul#characterlist li"); var characterIDList = ""; for( var i = 0; i < liElements.length; i++ ) { var liElement = $( liElements[ i ] ); // only start appending commas in after the first characterID if( i > 0 ) { characterIDList += ","; } // append the current li element's characterID to the list characterIDList += liElement.data( 'characterid' ); } function HandlerCharacters() { function isDupe(which) { var result = false; $('ul#characterlist li').each(function(i, e) { if ($(e).data('characterid') == which) { result = true; return false; // break out of .each() } }); return result; } var characterid = $('#charactersdrop option:selected').val(); var characterName = $('#charactersdrop option:selected').text(); if (characterid > 0 && !isDupe(characterid)) { // Create the anchor element var anchor = $( 'Remove' ); // Create a click handler for the anchor element anchor.click( function() { $( this ).parent().remove(); return false; // makes the href in the anchor tag ignored } ); // Create the element with its text, and then append the anchor inside it. var li = $( '' + characterName + ' ' ).append( anchor ); li.data( 'characterid', characterid ); // Append the new element to the element $( '#characterlist' ).append( li ); } }
VIEWS ON THIS POST

112

Posted on:

Tuesday 27th November 2012
View Replies!

$.getJSON and Global Variables

I use the following code to retrieve a json file into my code. Temp=new Array(); $.getJSON("document.json", function(data) { console.log(data); x = data.readings.length; for(i=0;i
VIEWS ON THIS POST

146

Posted on:

Thursday 29th November 2012
View Replies!

Changing div content

Alright, I've been looking around the web for a while, tried several different solutions, and none seem to work for me. I'm looking for a way to change div content on the click of an object. Right now, I've got a system using an iframe set up, but I'd like to be able to streamline it a bit and remove the iframe. So here's what I've got now: //in header... function load_page(page){ document.getElementById('contentframe').src = page; } //on object... //iframe... And I'd like to be able to use a Javascript function to load an HTML document into a div. I've found how to load/change text in a div, load XML into a div, etc, but none of the solutions I've found seem to like HTML. There was one way I found that SORT OF worked, but it would require writing an entire HTML document in the onclick event for each load event, and that's just not optimal.
VIEWS ON THIS POST

84

Posted on:

Thursday 29th November 2012
View Replies!

[link] Ten Oddities And Secrets About JavaScript

QuoteJavascript. At once bizarre and yet beautiful, it is surely the programming language that Pablo Picasso would have invented. Null is apparently an object, an empty array is apparently equal to false, and functions are bandied around as though they were tennis balls. This article is aimed at intermediate developers who are curious about more advanced Javascript. It is a collection of Javascripts oddities and well-kept secrets. Some sections will hopefully give you insight into how these curiosities can be useful to your code, while other sections are pure WTF material. So, lets get started.
VIEWS ON THIS POST

335

Posted on:

Thursday 29th November 2012
View Replies!

Trouble getting array to return from function.

! I have been pulling my hair out over this for two days now. I am trying to get random lottery numbers in an array where the first number is between 1 and 10, the second is between 11 and 20, etc... I had originally written it like this, var playerNumbers1 = new Array(5); { // get set 1 of player numbers playerNumbers1[0] = (Math.floor(Math.random() * 10 + 1)); playerNumbers1[1] = (Math.floor(Math.random() * 10 + 11)); playerNumbers1[2] = (Math.floor(Math.random() * 10 + 21)); playerNumbers1[3] = (Math.floor(Math.random() * 10 + 31)); playerNumbers1[4] = (Math.floor(Math.random() * 10 + 41)); But it caused some other issues in the overall program. I went back and tried to build the array using a loop but it is not working. Either my loop is no good or my return is no good and I cannot figure out which it is. One of my main issues is that I am not sure how to return an array. Declaring the new array outside of the function should make it global (what I want) but I would NEED a return from a function to make this happen no The program as it stands is below with my loop. Any help would be greatly appreciated.
VIEWS ON THIS POST

177

Posted on:

Thursday 29th November 2012
View Replies!

Get relative coords of clicked image

I have a image in a scrollable DIV. The image is bigger than the display size of the DIV. How do I get the coordinates of a mouse click on the image relative to the top left corner of the ...
VIEWS ON THIS POST

80

Posted on:

Friday 30th November 2012
View Replies!

Guidance Request (and a specific question)

I am wondering if JavaScript is a reasonable way to solve my problem. I have to snatch some info from a web page and build a report. Some of the info comes from the web page and some will be ...
VIEWS ON THIS POST

102

Posted on:

Friday 30th November 2012
View Replies!

comp.lang.javascript FAQ - Quick Answers 2008-03-31

comp.lang.javascript FAQ - Quick Answers- 9.88 - 2007-10-12 1 meta-FAQ meta-questions 2 comp.lang.javascript tips 2.1 Which newsgroups deal with javascript 2.2 What questions are off-topic for clj 2.3 What do I have to do before posting to clj 2.4 Why ...
VIEWS ON THIS POST

79

Posted on:

Friday 30th November 2012
View Replies!

removeChild Question

Hi. Trying to figure this one out. I want to remove all the "b" elements inside the DIV tags and NOT the SPAN elements. I have been trying variations on the below code: var d = document.getElementById("mypfl"); var d_nested = ...
VIEWS ON THIS POST

82

Posted on:

Friday 30th November 2012
View Replies!

style sheet font and javascrip conflict

I use a stylesheet style.css with my websheets, and have had no problem doing so. Today I saw some js that I wanted to add to one of my pages, but it changed the font to arial, and messed some ...
VIEWS ON THIS POST

230

Posted on:

Friday 30th November 2012
View Replies!

object error - creating a new property

hello everybody I am doing javascript from a book called "Prentice Hall(which sounds very masonic) : Javascript by example". my question is this. I am doing an practice dealing with "defining methods for an object" now i used this code verbatim /* Demonstrate how the constructor creates the objects and assigns properties*/ function distance(r,t){ // define the object this.rate = r; // Assigning properties this.time = t; } function calc_distance(){ return this.rate * this.time; // define a function that will be used as a method } var speed = eval(prompt("What was your speed(miles per hour)" ,"")); var elapsed = eval(prompt("How long did the trip take(hours)", "")); var howfar = new distance(speed, elapsed);// call the constructor howfar.distance = calc_distance(); // create a new property (This is where the error is and the message is below) var d = howfar.distance(); //Invoke method alert("The distance is " + d + " miles."); Error Code in these browsers: In Firefox : howfar.distance is not a function In Google Chrome: Uncaught TypeError Property 'distance' of # is not a function I did this code in the book exactly. I am just trying to warp my head around this and want to understand how is this an error when it is just the crating a new property. Thank you.
VIEWS ON THIS POST

96

Posted on:

Sunday 23rd December 2012
View Replies!

My Script is broken

If anyone could help me figure out what is wrong, id be grateful, this is mind boggling and to say the least, stressful. TEST function CreateWindow(x, y, dx, dy, path, name) { var tx = dx+6; var ty = dy+2; var sx = dx+x-60; document.write('
VIEWS ON THIS POST

77

Posted on:

Monday 24th December 2012
View Replies!

Calculation form with radio button problem

/* I try to calculate all the number based on selected radio button and display it in the textfield on the same page can someone can tell me the errors and suggest how to make my calculation is right. ty */ function calculateA() { var A = formC.GeneralPerformanace.value.checked; var B = formC.studentCooperation.value.checked; var C = formC.studentPunctuality.value.checked; var D = formC.studentInitiative.value.checked; var E = formC.studentKnowledge.value.checked; var F = formC.studentSkill.value.checked; var G = formC.studentCapability.value.checked; var H = A + B + C + D + E + F + G; formC.totalSectionA.value = H; } Untitled Document Form C - Internship Field Evaluation Form   Brief description of internship task(s) / project(s) assigned:     Instruction : Please complete this form using the scale below:   1: Unsatisfactory 2: Less Satisfactory 3: Satisfactory 4: Good 5: Very Good   Section A: Company's Supervisor Comments.   1. General Performance of the student during Training period 1 2 3 4 5 2. Student's ability to fit into the working environment:   a) Co-operation 1 2 3 4 5   b) Punctuality 1 2 3 4 5   c) Initiative 1 2 3 4 5   d) Knowledge 1 2 3 4 5   e) Skill 1 2 3 4 5 3. Student's capability to accomplish the assigned task 1 2 3 4 5   Total : /35    
VIEWS ON THIS POST

108

Posted on:

Monday 24th December 2012
View Replies!

Checkerboard Patterns by using Js

Hi every body, My question is : I've to create a checkerboard type pattern out of asterix. So I've a line of 8 asterix ("* ") and a space between them (" "). Then it goes to the next row which is indented to make the checkboard effect. I want the result to be like this: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * by using while structure and only three statements which are: document.write( "* "); document.write( " " ); document.writeln(); In fact I get inly one row so what can I add to get the other rows\t Here is my code: [code] Preincrementing and Postincrementing [code] Thank you alot.
VIEWS ON THIS POST

79

Posted on:

Monday 24th December 2012
View Replies!

help with changing screenshots - JavaScript Help

I want the three images to cycle through each image when clicked, but for some reason, it only cycles once then stays on the second image.I know it's messy and not the most elegant way, but I haven't used much Javascript so I'd like to keep my way of implementing this script.here is html: CSS trial Left pix:click to expand left left left left Middle pix:click to expand mid mid mid mid Right pix:click to expand right right right right here is the javascript:var leftImgList = [ "left_1.png", "left_2.png" ];var indexL = 0;var midImgList = [ "mid_1.png", "mid_2.png" ];var indexM = 0;var rightImgList = [ "right_1.png", "right_2.png" ];var indexR = 0;function changeScreenshot( projLabel ) { if ( projLabel == "leftSide" ) { if ( indexL < 2 ) { document.getElementById( "leftSide" ).src = leftImgList[ indexL + 1 ]; indxL+=1; } else if ( indexL == 2 ) { document.getElementById( "leftSide" ).src = leftImgList[ indexL - 2 ]; indexL = 0; } }//END left BIG IF if (projLabel == "mid") { if ( indexM < 2 ) { document.getElementById("mid").src = midImgList[ indexM + 1 ]; indxM+=1; } else if ( indexM == 2 ) { document.getElementById("mid").src = midImgList[ indexM - 2 ]; indexM = 0; } }//END middle BIG IF if (projLabel == "rightSide") { if ( indexR < 2 ) { document.getElementById( "rightSide" ).src = rightImgList[ indexR + 1 ]; indxR+=1; } else if ( indexR == 2 ) { document.getElementById( "rightSide" ).src = rightImgList[ indexR - 2 ]; indexR = 0; } }//END right BIG IF}//END FCN changeScreenshot //NB: hides or shows the selected screenshots of this programfunction togglePrograms ( nameId, imgId, captionId ){ var projName = document.getElementById( nameId ); var projScreenshots = document.getElementById( imgId ); var caption = document.getElementById( captionId ); if ( projScreenshots.style.display == "block" ) { projScreenshots.style.display = "none"; caption.style.display = "none"; if ( nameId == "leftSide_a" ) projName.innerHTML = "Left pix: Click to expand"; else if ( nameId == "mid_a" ) projName.innerHTML = "Middle pix:click to expand"; else if ( nameId == "rightSide_a" ) projName.innerHTML = "Right pix:click to expand"; } else { projScreenshots.style.display = "block"; caption.style.display = "block"; if ( nameId == "leftSide_a" ) projName.innerHTML = "Left pix: Click to collapse"; else if ( nameId == "mid_a" ) projName.innerHTML = "Middle pix:click to collapse"; else if ( nameId == "rightSide_a" ) projName.innerHTML = "Right pix:click to collapse"; }}//END togglePrograms FC
VIEWS ON THIS POST

53

Posted on:

Friday 28th December 2012
View Replies!

text box value change update marker on Google map - JavaScript Help

I have Google map using Google map API v3. what i have is a Google map in accordion which user can click and place a marker and value of lat & lon fill two text boxes on top.this part is working fine with below script. but what i want now as text boxes is filled with lat & lon if user change value of lat or lon in text box marker need to change accordingly. var map = null; function initialize() { var myLatlng = new google.maps.LatLng(25.263327,55.329895); var myOptions = { zoom: 10, center: myLatlng, mapTypeId: google.maps.MapTypeId.ROADMAP } var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var marker; function placeMarker(location) { if ( marker ) { marker.setPosition(location); } else { marker = new google.maps.Marker({ position: location, map: map }); } } google.maps.event.addListener(map, 'click', function(event) { placeMarker(event.latLng); document.getElementById("latFld").value = event.latLng.lat(); document.getElementById("lngFld").value = event.latLng.lng(); }); } $(document).ready(function() { $("#accordion").bind('accordionchange', function(event, ui) { if (ui.newContent.attr('id') == 'tabThree' && !map) { map = initialize(); } }); });
VIEWS ON THIS POST

41

Posted on:

Tuesday 1st January 2013
View Replies!

Really Simple Calculator Problems - JavaScript Help

,I'm a PHP coder, but my client is getting me out of my comfort zone by doing a bit of javascript. I've got basic functionality set up, but I'm just coming across one issue. The thing they want is a simple percentage calculator, where someone enters a value, a percentage and the site then performs calculations based on these values.It's all working fine, except when you actually physically write a percentage sign. I'm looking for some way of stripping out percentage signs. I tried the replace() function, but that just stopped the calculator working. Any advice appreciated, here's my code:function calculate() { a=Number(document.getElementById("edit-gpcalculatorcost").value); b=Number(document.getElementById("edit-gpcalculatorpercentage").value); b3=b; b2=b3/100; c=a/(1-b2); c2=Math.round(c*100)/100; c3=c2*1.2; c4=Math.round(c3*100)/100; document.getElementById("edit-gpcalculatortotal").value=c4; }
VIEWS ON THIS POST

67

Posted on:

Tuesday 1st January 2013
View Replies!

Problem with Audio object in iOs - JavaScript Help

I'm developing a mobile app, that uses the Audio object through javascript.The audio works great on Android browser,chrome,firefox and even explorer...But not in safary nor iOs browser.I've tried to use the audio element(no-js) and i get the "Your browser does not support the audio element" message in safary.That's weird because it suppose to work
VIEWS ON THIS POST

106

Posted on:

Tuesday 1st January 2013
View Replies!

multiple div refresh - JavaScript Help

Below is the scriptfunction refreshflag(){var totalx=document.getElementById("totaluser").value;var spx=totalx.split(";");if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); }else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); }for(i=0;i
VIEWS ON THIS POST

104

Posted on:

Wednesday 2nd January 2013
View Replies!