dynamically change text based on dropdown selection - JavaScript Help

i am new to javascript so please try to bare with me.
i have a code which does the job of changing the value show at the bottom of select box dynamically. but the thing is it should actually need to change between only two values only so how can i change the script to do that

myarr=new Array()
myarr[401] = "Local path "
myarr[403] = "URL or Local path "
myarr[404] = "URL or Local path "
myarr[405] = "URL or Local path "
myarr[406] = "URL or Local path "
myarr[407] = "URL or Local path "
myarr[408] = "URL or Local path "
myarr[409] = "URL or Local path "
myarr[410] = "URL or Local path "
myarr[411] = "URL or Local path "
myarr[412] = "URL or Local path "
myarr[413] = "URL or Local path "
myarr[414] = "URL or Local path "
myarr[415] = "URL or Local path "
myarr[500] = "URL or Local path "
myarr[501] = "URL or Local path "
myarr[502] = "URL or Local path "
myarr[503] = "URL or Local path "
myarr[504] = "URL or Local path "
myarr[505] = "URL or Local path "

function doIt(objval)


401 Authorization Required
403 Forbidden
404 Not Found
405 Method Not owed
406 Not Acceptable (encoding)

407 Proxy Authentication Required
408 Request Timed Out
409 Conflicting Request
410 Gone
411 Content Length Required
412 Precondition Failed

413 Request Entity Too Long
414 Request URI Too Long
415 Unsupported Media Type
500 Internal Server Error
501 Not Implemented
502 Bad Gateway

503 Service Unavailable
504 Gateway Timeout
505 HTTP Version Not Supported

Local path

Posted On: Wednesday 2nd of January 2013 12:01:45 AM Total Views:  434
View Complete with Replies

Related Messages:

I want to connect Thunderbird to local database   (286 Views)
please help@ i plugin the thuderbird to my java class and now i want to store the thunderbird send ,save ...mails to local database how i can be connect thunderbird to database for this.
Countdown Redirect   (173 Views)
I want a countdown and then redirect script... can anyone help me where to find it It should say smthing lyk, "you'll be redirected in [secs] secs.."
toggle node with checkbox   (217 Views)
, I currently have a hyperlink to toggle the node, showing and hiding the list. Could someone show me how to use a checkbox instead of the hyperlink to do the same thing
Combining 2 queries in Google Fusion javascript   (224 Views)
am new at querying, I wanted to change the code below to query my data for the "Date" column, "population", and "education". In the continuation of my code, I have 3 checkboxes to filter out the data pertaining to the date, and the selector to select which color coding and data i want to represent. Live example of current code: So in a perfect scenario, when I deselect all the checkboxes nothing should appear, and when i select 2006 only the polygons that has 2006 should appear. function initialize() { var map = new google.maps.Map(document.getElementById('map-canvas'), { center: new google.maps.LatLng(30.64804,31.5023868333333), zoom: 5, mapTypeId: google.maps.MapTypeId.ROADMAP }); var layer = new google.maps.FusionTablesLayer({ query: { select: 'geo', from: '1c-imTqDv8SfoEG_dkw41TjpquihqELzTIrs9F88' } }); layer.setMap(map); initSelectmenu(); for (column in COLUMN_STYLES) { break; } applyStyle(map, layer, column); addLegend(map); google.maps.event.addDomListener(document.getElementById('selector'), 'change', function() { var selectedColumn = this.value; applyStyle(map, layer, selectedColumn); updateLegend(selectedColumn); }); google.maps.event.addDomListener(document.getElementById('2006'), 'click', function() { filterMap(layer, tableId, map); }); google.maps.event.addDomListener(document.getElementById('2007'), 'click', function() { filterMap(layer, tableId, map); }); google.maps.event.addDomListener(document.getElementById('2008'), 'click', function() { filterMap(layer, tableId, map); }); } // Filter the map based on checkbox selection. function filterMap(layer, tableId, map) { var where = generateWhere(); if (where) { if (!layer.getMap()) { layer.setMap(map); } layer.setOptions({ query: { select: 'geo', from: tableId, where: where } }); } else { layer.setMap(null); } } // Generate a where clause from the checkboxes. If no boxes // are checked, return an empty string. function generateWhere() { var filter = []; var stores = document.getElementsByName('store'); for (var i = 0, store; store = stores[i]; i++) { if (store.checked) { var storeName = store.value.replace(/'/g, '\\\''); filter.push("'" + storeName + "'"); } } var where = ''; if (filter.length) { where = "'Date' IN (" + filter.join(',') + ')'; } return where; } google.maps.event.addDomListener(window, 'load', initialize); // Initialize the drop-down menu function initSelectmenu() { var selectMenu = document.getElementById('selector'); for (column in COLUMN_STYLES) { var option = document.createElement('option'); option.setAttribute('value', column); option.innerHTML = column; selectMenu.appendChild(option); } } // Apply the style to the layer & generate corresponding legend function applyStyle(map, layer, column) { var columnStyle = COLUMN_STYLES[column]; var styles = []; for (var i in columnStyle) { var style = columnStyle[i]; styles.push({ where: generateWhere(column, style.min, style.max), polygonOptions: { fillColor: style.color, fillOpacity: style.opacity style.opacity : 0.8 } }); } layer.set('styles', styles); } // Create the where clause function generateWhere(columnName, low, high) { var whereClause = []; whereClause.push("'"); whereClause.push(columnName); whereClause.push("' >= "); whereClause.push(low); whereClause.push(" AND '"); whereClause.push(columnName); whereClause.push("' < "); whereClause.push(high); return whereClause.join(''); } // Initialize the legend function addLegend(map) { var legendWrapper = document.createElement('div'); = 'legendWrapper'; legendWrapper.index = 1; map.controls[google.maps.ControlPosition.RIGHT_BOTTOM].push( legendWrapper); legendContent(legendWrapper, column); } // Update the legend content function updateLegend(column) { var legendWrapper = document.getElementById('legendWrapper'); var legend = document.getElementById('legend'); legendWrapper.removeChild(legend); legendContent(legendWrapper, column); } // Generate the content for the legend function legendContent(legendWrapper, column) { var legend = document.createElement('div'); = 'legend'; var title = document.createElement('p'); title.innerHTML = column; legend.appendChild(title); var columnStyle = COLUMN_STYLES[column]; for (var i in columnStyle) { var style = columnStyle[i]; var legendItem = document.createElement('div'); var color = document.createElement('span'); color.setAttribute('class', 'color'); = style.color; legendItem.appendChild(color); var minMax = document.createElement('span'); minMax.innerHTML = style.min + ' - ' + style.max; legendItem.appendChild(minMax); legend.appendChild(legendItem); } legendWrapper.appendChild(legend); } google.maps.event.addDomListener(window, 'load', initialize);
Sortable jquery not working in jquery tabs on Chrome/safari   (230 Views)
Hi. I have a web site that contains jquery tabs and one tab consists of a sortable jquery. Although the sortable works induviduallay it doesnt work when it is put into the tabs. Is there a solution of that My tab code is as follows. Tabs-1 Tabs-2 Tabs-3 ------- and the sorting code is as follows: Item 1 Item 2 Item 3 Item 4 Item 5 Item 6 Item 7 The tabs and sortable is in the following link if it helps. (the sortable here is working) (Here it is not working)
Instant name checking/showing using Ajax/Jquery   (434 Views)
The case scenario is like I have to check all available usernames/names from the databases whenever I type the letters instanly. For example:- When type "je" in the userfield, it should show all combination of names starting with "je" inline. I am attaching a picture as sample. Its indian railway website, where I type name of the train like "ka", it will show all names matching with it inline. [IMG][/IMG] I need to implement this feature. any kind help would be appreciated , thanx a lot in advance
Simple ajax not working.   (323 Views)
, I am working on a small assigment but this code just wont work. I dont know what the problem is. Can anyone please debug it. var xmlhttp; function listFriend(){ xmlhttp = false; /* For Firefox*/ if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else /*For IE*/ if (window.ActiveXObject) { try { /*For some versions of IE*/ xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try { /*For some other versions of IE*/ xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) {} } } if (!xmlhttp) { alert('Cannot create XMLHTTP instance'); return false; } var delfrnd = document.forms[0].elements["delFriends"].value; var url = "editFriends_ajaxing.phpdelFriends="+delfrnd; alert(delfrnd+" "+url);'GET', url, true); xmlhttp.onreadystatechange = theResponse; xmlhttp.send(null); } //End showUserName function theResponse(){ alert("entering the function theResponse,readystate= "+xmlhttp.readyState+"status="+xmlhttp.status); if(xmlhttp.readyState==4) { if(xmlhttp.status==200) { alert("inside the iffs"); var xmlDoctext=xmlhttp.responseText; alert("xmlDoctxt is \n"+xmlDoctext); var xmlDoc=xmlhttp.responseXML.documentElement; var rootElement=xmlDoc.documentElement; alert("xmldoc = "+xmlDoc); var htmlArray=[];//An array in which to accumulate HTML fragments in lieu of String += "....". htmlArray.push("Friend NameSelect to Delete"); var length=xmlDoc.childNodes.length; alert("htmlArray is \n"+htmlArray); for(var i=0; i
Changing the cursor position.   (289 Views)
Dear all, I m using a div to show menus on master page . Div contains the html table whcih has 2 rows showing the main(Parent) menus(Master,Reports). Each row contains html table with 4 or more rows(tr) which shows their respective sub-menu. Onmousehover of image I m showing the div. Onmouseleave of div I m hiding the div i.e when user leaves the div ,div gets hide. Master menu is at top,below it is Report menu in div. When i click on Master Menu their submenu get opens which has 10 submenues . But when i click on Report Menu(Report menu has 4 sub menus) Their submenues are opened & Master Menu if already opened should be closed. As soon as I click the Report menu it opens its submenu and closes the submenu of master. The problem is that the div size gets mimimizes(which is correct) and cursor remain out of the div . and calls the Onmouseleave function for hiding the div Therefore user cannot see the report submenu. how should I stop this from happening I got one solution i.e To keep the cusror along with its main(Parent) menus ,so how to acheive that Or Can any one help me how to move the cursor position in webpage.
Ajax/Php Poll   (152 Views)
I was looking for a poll script (php/ajax) that does not reload when adding a vote. I've tried to search around for it but haven't found one that suits my needs. Anyone that knows where I can find such a script
Two Submit Buttons -- One PHP Destination   (290 Views)
Ok, I know this has to be simple. My Javascript skills are very weak (will become obvious in the code.) What I'm trying to do is use two Submit buttons in a form. The called function I want to send one named variable if one Submit is clicked and another named variable if the other button is clicked. The examples I've seen make it simple -- just use two destination PHP files. But isn't it possible to send just post ONE (the name connected to the button clicked) to the PHP file to use I know the PHP has to be set up, ready to Post whatever comes it's way (using variable would be really neat but can't transfer a JS variable to PHP file I guess). What happens below is that no matter WHICH button is pushed, both seem to be sent. function decide_action() { x = document.pressed if (x == "First") { myname =document.forms['frm1'].elements['firstname'].value; document.frm1.action ="two.php"; } else if (x == "Last") { myname=document.forms['frm1'].elements['lastname'].value; document.frm1.action ="two.php"; } } CAN this work
ajax mysql based dopdown   (180 Views)
hai i have a page where i there is a single drop down box after the user finishes his selection the content of the selection should be returned on the same page to tell the user what he has selected........
Adbrite Java Ad Code Amendment Needed!   (446 Views)
Dear brothers I want that my adbrite inline text ads open in new window, so its need ad code alteration. Can anyone here alter this given below code so that ads open in new window.
HTML radio buttons   (290 Views)
, I have a very interesting issue that I want to solve but I need some help because I do not know if it is possible. I am using some radio buttons on my website, but instead of the user actually clicking a radio button to set it as "checked" I need to make it so that they can click on a link and it will check the radio button. Don't even ask why, it is a very silly project, but it needs to be done. Please let me know if you know how to do this. Is there any way possible to just have an if-else statement like: if(linkclicked) then set radiobutton1 = checked If so please let me know.
how to add text field if we select option from selection?   (226 Views)
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.
jquery background color css   (239 Views)
I am trying to check for the background of an element, here is my code. But it doesn't work: I tried two ways, here is the first: function changeColor(field) { if(field.css('background-color','#ffb100')) { field.css('background-color','white'); } else { field.css('background-color','ffb100'); } } here is the second: function changeColor(field) { if(field.css('background-color') === '#ffb100') { field.css('background-color','white'); } else { field.css('background-color','ffb100'); } } But neither worked! Any suggestions
change content with jquery?   (342 Views)
Hi i'm doing a project for college using jquery, i'd like to dynamically update a section when a link button is clicked without reloading the page, the content fades out and the new content fades in, but when i click on a link the content fades out but the new content doesn't fade in, any suggestions, is there a better way of doing this $(function() { var newHash = "", $mainContent = $("#main-content"), $pageWrap = $("#page-wrap"), baseHeight = 0, $el; $pageWrap.height($pageWrap.height()); baseHeight = $pageWrap.height() - $mainContent.height(); $('#list_nav li a').click(function() { window.location.hash = $(this).attr("href"); return false; }); $(window).bind('hashchange', function(){ newHash = window.location.hash.substring(1); if (newHash) { $mainContent .find("#guts") .fadeOut(500, function() { $mainContent.hide().load(newHash + " #guts", function() { $mainContent.fadeIn(500, function() { $pageWrap.animate({ height: baseHeight + $mainContent.height() + "px" }); }); $("nav a").removeClass("current"); $("nav a[href='"+newHash+"']").addClass("current"); }); }); }; }); $(window).trigger('hashchange'); });
brief walk through AJAX??   (465 Views)
daniweb users, i would like a brief walk through on AJAX if you'll can, i already looked through the post and didn't find what i was looking for, i would like to know how to refresh evertying on a web page but the header, which contains the navigation bar that way only the content info is refreshed,
edit caption of image in lightbox   (354 Views)
hello ! im just wondering if it is possible to edit the caption of an image while it's being viewed through lightbox
Create a timer for php pages   (312 Views)
i want to create a timer for my php page i created the page that only 20 second i want that the time should be as 00:00:20 (hh:mm:ss) plz help my scipt are.......................................................................................................... Time Left: var myTime = 20; function countDown() { document.form.seconds.value = myTime; if (myTime == 0) { location.href="trivia1.php"; } else if (myTime > 0) { myTime--; setTimeout("countDown()",1000); } } countDown();
banner in ajax   (312 Views)
Hi all.. i want to create a banner in my website using and ajax.. banner will consist of many banners and have the paging under the banner that moving y itself.. what we call it i cannot find any other example yet because i dont know the name of that application..
how to redirect to a jquery tab   (217 Views)
i want to redirect the page after submitting to the exact page with the tabs. but when i submit it just loads the same page. but what i want is it should load under the home tabs. my other pages are loading in the div tags which are loaded using the Jquery tab here is my code. please help me Enter The Question Enter the Answers 01. Correct Answer 02. Correct Answer 03. Correct Answer 04. Correct Answer i have tried like that( i have bold it.. please refer the bold section). my home tabs are like this $(document).ready(function() { $('#main-side-content').tabs(); }); Home Create A Class Register Students MCQ Paper Setting Create Paper
Dependant combo only works one time in IE   (169 Views)
, I'm very new to the world of php, js and ajax however I've been working on creating two combo boxes built from values in a table. The table is such - LeagueCode, TeamCode, TeamName. The first combo displays all distinct LeagueCode values. The second combo then needs to display the TeamName where LeagueCode equals the value selected above. The method that I'm using works....but only once. Actually, it seems to work in Chrome, Firefox and Opera, but just doesn't work in IE (I'm on version 7). In IE if I select League a second time, it gives me an error of 'Object doesn't support this property or method' at Line 1 Char 1. Any help and/or guidance is greatly appreciated. order.htm League: Team: cmbTeam.php
anyone please help me   (213 Views)
Create a page which allows a user to enter a credit card number and expiry date into a text field. When the user clicks a button, the page should check if the credit card number and expiry date is valid. A valid credit card number has 16 digits. A expiry date is valid if it has a 2 digit month followed by a 2 digit year. The month must be between 01 and 12 and the month and year must be greater than now. Hint: var d = new Date(); alert(d.getFullYear()); //displays 2012 alert(d.getMonth()); //displays the month number where january is 0 and december is 11 var Cards = new makeArray(8); Cards[0] = new CardType; var MasterCard = Cards[0]= new CardType(); function CheckCardNumber(form) { var tmpyear; if (form.CardNumber.value.length == 0) { alert("Please enter a Card Number."); form.CardNumber.focus(); return; } if (form.ExpYear.value.length == 0) { alert("Please enter the Expiration Year."); form.ExpYear.focus(); return; } if (form.ExpYear.value > 96) tmpyear = "19" + form.ExpYear.value; else if (form.ExpYear.value < 12) tmpyear = "20" + form.ExpYear.value; else { alert("The Expiration Year is not valid."); return; } tmpmonth = form.ExpMon.options[form.ExpMon.selectedIndex].value; if (!(new CardType()).isExpiryDate(tmpyear, tmpmonth)) { alert("This card has already expired."); return; } card = form.CardType.options[form.CardType.selectedIndex].value; var retval = eval(card + ".checkCardNumber(\"" + form.CardNumber.value + "\", " + tmpyear + ", " + tmpmonth + ");"); cardname = ""; if (retval) alert("This card number appears to be valid."); else { for (var n = 0; n < Cards.size; n++) { if (Cards[n].checkCardNumber(form.CardNumber.value, tmpyear, tmpmonth)) { cardname = Cards[n].getCardType(); break; } else { alert("This card number is not valid."); } } } function checkCardNumber() { var argv = checkCardNumber.arguments; var argc = checkCardNumber.arguments.length; var cardnumber = (argc > 0) argv[0] : this.cardnumber; var year = (argc > 1) argv[1] : this.year; var month = (argc > 2) argv[2] : this.month; this.setCardNumber(cardnumber); this.setExpiryDate(year, month); if (!this.isCardNumber()) return false; if (!this.isExpiryDate()) return false; return true; } function getCardType() { return this.cardtype; } function getExpiryDate() { return this.month + "/" + this.year; } function isCardNumber() { var argv = isCardNumber.arguments; var argc = isCardNumber.arguments.length; var cardnumber = (argc > 0) argv[0] : this.cardnumber; if (!this.luhnCheck()) return false; for (var n = 0; n < this.len.size; n++) if (cardnumber.toString().length == this.len[n]) { for (var m = 0; m < this.rules.size; m++) { var headdigit = cardnumber.substring(0, this.rules[m].toString().length); if (headdigit == this.rules[m]) return true; } return false; } return false; } function isExpiryDate() { var argv = isExpiryDate.arguments; var argc = isExpiryDate.arguments.length; year = argc > 0 argv[0] : this.year; month = argc > 1 argv[1] : this.month; if (!isNum(year+"")) return false; if (!isNum(month+"")) return false; today = new Date(); expiry = new Date(year, month); if (today.getTime() > expiry.getTime()) return false; else return true; } function isNum(argvalue) { argvalue = argvalue.toString(); if (argvalue.length == 0) return false; for (var n = 0; n < argvalue.length; n++) if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9") return false; return true; } function luhnCheck() { var argv = luhnCheck.arguments; var argc = luhnCheck.arguments.length; var CardNumber = argc > 0 argv[0] : this.cardnumber; if (! isNum(CardNumber)) { return false; } var no_digit = CardNumber.length; var oddoeven = no_digit & 1; var sum = 0; for (var count = 0; count < no_digit; count++) { var digit = parseInt(CardNumber.charAt(count)); if (!((count & 1) ^ oddoeven)) { digit *= 2; if (digit > 9) digit -= 9; } sum += digit; } if (sum % 10 == 0) return true; else return false; } function makeArray(size) { this.size = size; return this; } function setCardNumber(cardnumber) { this.cardnumber = cardnumber; return this; } function setCardType(cardtype) { this.cardtype = cardtype; return this; } function setExpiryDate(year, month) { this.year = year; this.month = month; return this; } function setLen(len) { if (len.length == 0 || len == null) len = "13,14,15,16,19"; var tmplen = len; n = 1; while (tmplen.indexOf(",") != -1) { tmplen = tmplen.substring(tmplen.indexOf(",") + 1, tmplen.length); n++; } this.len = new makeArray(n); n = 0; while (len.indexOf(",") != -1) { var tmpstr = len.substring(0, len.indexOf(",")); this.len[n] = tmpstr; len = len.substring(len.indexOf(",") + 1, len.length); n++; } this.len[n] = len; return this; } function setRules(rules) { if (rules.length == 0 || rules == null) rules = "0,1,2,3,4,5,6,7,8,9"; var tmprules = rules; n = 1; while (tmprules.indexOf(",") != -1) { tmprules = tmprules.substring(tmprules.indexOf(",") + 1, tmprules.length); n++; } this.rules = new makeArray(n); n = 0; while (rules.indexOf(",") != -1) { var tmpstr = rules.substring(0, rules.indexOf(",")); this.rules[n] = tmpstr; rules = rules.substring(rules.indexOf(",") + 1, rules.length); n++; } this.rules[n] = rules; return this; } Card Number: Expiration Date: Month 1 2 3 4 5 6 7 8 9 10 11 12 Year This post has been edited by Dormilich: 03 September 2012 - 03:43 AM Reason for edit:: please use [code] [/code] tags when posting code
javascript or ajax which one?   (301 Views)
hello :-)i want to have your going to design a site for a car showroom .which includes a search form,the problem im facing is that there are two combo box one for the make and one for the when the user selects the make the model combo box will load the related models. suppose if i choose ford ,in the combo box below the models Mustang,focus will be loaded and once the user clicks the search button the result will be displayed I was told to use ajax but i have no clue of AJAX at all,is there any way to make it happen by using only javascript ,php and sql to have the combo box working This post has been edited by deathmeat: 03 March 2011 - 12:56 PM
text on hover...   (203 Views)
I have found this random image generator. It works well enough for my needs, but now I need the image that this code below generates to have an opportunity to present some simple text to describe what the image it. Basically, if the image is that of a shoe then the text that appears upon hoovering on image would say "jimmy cho' shoes". can someone help me I have tried be keep messing it up.
How do I make a div visible and then invisible   (197 Views)
I understand how to make a div (table) invisible and then visible on a timer.. What I want to do is add a counter to my code and make the table flash 3 times and then stop with the table visible. all my code does right now is make the table flash on and off every 1 second. This is what I have right now: function magic() { var d = document.getElementById('MagicTable'); if ( == "none") = "block"; else = "none"; window.setInterval("magic()", 1000); } This post has been edited by spotilator: 30 October 2010 - 09:00 AM
Whats wrong with this while loop?   (204 Views)
while(frames['ghfa'].contentDocument===""); I can't figure it out : / Its basically just supposed to idle while the frame is empty
Form to email   (150 Views)
I am trying to make a form and send all the entered fields directly into an email to a specific email account. if any one knows how to do this or can point me to a site that can help me i would be extreamly grateful
Thank you   (247 Views)
Remove value from input text   (187 Views)
Plz tell me, how to remove particular value from input text in jsp by using javascript. function findSeat() { alert("hi") document.getElementById("sam").value.removeChild(SEW1); alert("remove") } By Himmat
how to make this popup page   (225 Views)
Hi I have seen this popup in a registration form. I think it's using jquery but I don't know how can I make some thing like this . I want to put a registration form in it ( ajax registration ) when the popup appear , around it will became dark how can I do so
Question about variables   (251 Views)
Hi all; i have script below i would like to ask why there var step=1; outside the function works but inside not anyone explain me pls
worked in one file, not in the other???   (244 Views)
Try to bring it up inside the tags! Some Title And with external script! Simply link it in to your page by doing this... Well that's all for now! Hope it helps you...
How to output java var in html on php page? - JavaScript Help   (254 Views)
Hi.How can i write this. I have a page in a iframe it gets the contents of div from parent page, and outputs it to the title of a window script. I cant get to output the javascript var it only shows as +windowtitle+ .here is my code: (The problem is with window title it outputs as +windowtitle+ ) var windowtitle = document.getElementById(\''.$username.'id\').innerHTML; // i also used plain text to test this but still get +windowtitle+ var url_destination = \'http://'.$host.'/chat/'.$username.'/'.$profemail2.'/\'; var url_ajax = \'http://'.$host.'/chat/'.$username.'/'.$profemail2.'/\'; var online = "CHAT ONLINE"; var offline = \'CHAT OFFLINE\'; document.write(\'\'); ()
How to simultaneously animate two divs in Jquery - JavaScript Help   (258 Views)
Hi ,here is an example of what I want to do: here is what happens when I try to do that with two divs is this happening here is the code for the first body { background-color:#000000; } #square{ width:356px; height:52px; border: 1px solid red; background-image:url(images/ANIMATEINS.png); background-repeat:no-repeat; position:relative; } #container{ margin:100px auto; width:356px; height:52px; background-image:url(images/ANIMATE.png); background-repeat:no-repeat; position:relative; border:1px solid blue; } #square2{ width:356px; height:52px; border: 1px solid red; background-image:url(images/ANIMATEINS.png); background-repeat:no-repeat; position:relative; } #container2{ margin:100px auto; width:356px; height:52px; background-image:url(images/ANIMATE.png); background-repeat:no-repeat; position:relative; border:1px solid blue; } #box { border: 1px solid #FF0000; } var $square = $("#square"); bounce(); function bounce() { $square.animate({ left: "+=170" }, 1000, function() { /**new command**/ $square.animate({ left: "-=170" }, 1000, function() { bounce(); }) /**end command**/ }); } And here is the code for the second: body { background-color:#000000; } #square{ width:356px; height:52px; border: 1px solid red; background-image:url(images/ANIMATEINS.png); background-repeat:no-repeat; position:relative; } #container{ margin:100px auto; width:356px; height:52px; background-image:url(images/ANIMATE.png); background-repeat:no-repeat; position:relative; border:1px solid blue; } #square2{ width:356px; height:52px; border: 1px solid red; background-image:url(images/ANIMATEINS.png); background-repeat:no-repeat; position:relative; } #container2{ margin:100px auto; width:356px; height:52px; background-image:url(images/ANIMATE.png); background-repeat:no-repeat; position:relative; border:1px solid blue; } #box { border: 1px solid #FF0000; } var $square = $("#square"); bounce(); function bounce() { $square.animate({ left: "+=170" }, 1000, function() { /**new command**/ $square.animate({ left: "-=170" }, 1000, function() { bounce(); }) /**end command**/ }); } var $square2 = $("#square2"); bounce(); function bounce() { $square2.animate({ left: "+=170" }, 1000, function() { /**new command**/ $square2.animate({ left: "-=170" }, 1000, function() { bounce(); }) /**end command**/ }); }
Google Dynamic Maps V3 cant place inside div?   (301 Views)
html { height: 100% } body { height: 100%; margin: 0; padding: 0 } #map_canvas { height: 100% } function initialize() { var myOptions = { center: new google.maps.LatLng(51.510559,-0.128431), zoom: 12, mapTypeId: google.maps.MapTypeId.ROADMAP }; var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); } This is the working code for the map im trying to implement into my website. The problem i am getting is that when i place it inside of my col div it will not appear yet if it is not inside of the col div it will display, please look below. Maps - source Google The CSS for both the map and the col are as follows; #col{ background-color:grey; float:left; margin-left:3%; padding:10px; width: 42%; -moz-border-radius: 8px; -webkit-border-radius: 8px; -khtml-border-radius: 8px; border-radius: 8px; } #map_canvas { height: 100% }
Javascript innerText Span issue   (202 Views)
I'm quite new to javascript, but not at all new to programming. I've been working on an extension in google chrome and I've run into a rather odd problem. Basically I have an html snippet that looks like this Total Questions: Answers Found: Click here to load questions There are two possible states, in one I want the whole QuestionsAnswers div to be hidden and the ClickToLoad to be visible, and in the other I want QuestionsAnswer to be visible and the two spans (questionNumber, answerNumber) to contain the releveant numbers, and ClickToLoad to be hidden. I tried to implement that like this: function AppropriateVisual() { if (!localStorage.QuestionList) { document.getElementById('ClickToLoad').style.display="inline"; document.getElementById('QuestionsAnswers').style.display="none"; } else { document.getElementById('ClickToLoad').style.display="hide"; document.getElementById('QuestionsAnswers').style.display="inline"; document.getElementById('questionNumber').innerText=localStorage.QuestionList.length; if (localStorage.AnswerList) document.getElementById('answerNumber').innerText=localStorage.AnswerList.length; else document.getElementById('answerNumber').innerText="0"; //error here } } The first part works. If there is no QuestionList then only the appropriate elements are shown. However if the reverse is true, both QuestionsAnswers and ClickToLoad are shown. Weirder, the browser reports an error at the marked line saying answerNumber doesn't exist. Furthermore, inspection of the elements on the page show that whenever I set the inner text of questionNumber, answerNumber ceases to exist. What terrible thing have I done
$.getJSON and Global Variables   (213 Views)
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
event handler named clear_click that clears text boxes   (275 Views)
pls help. i am having a dickens of a time figuring out how to add an event handler that clears my text fields when the clear button is clicked. this is the code that ive done but to no avail... thanks pls advise var $ = function (id) { return document.getElementById(id); } var calculate_click = function () { var investment = parseFloat( $("investment").value ); var annualRate = parseFloat( $("rate").value ); var years = parseInt( $("years").value ); $("futureValue").value = ""; if (isNaN(investment) || investment 20) { alert("Annual rate must be a valid number\nand less than or equal to 20."); } else if(isNaN(years) || years > 50) { alert("Years must be a valid number\nand less than or equal to 50."); } else { var monthlyRate = annualRate / 12 / 100; var months = years * 12; var futureValue = 0; for ( i = 1; i
Calling Web Services from independent browser using javascript   (218 Views)
, I'm trying to call some web services only using javascript from a html page. I succeeded on doind this in IE with the use of the behavior:url(; (technique founded in the microsft site) but when i'm going to try ...
Re: How to see source code as rendered (not the script)   (226 Views)
On Jul 2, 3:41 pm, "V S Rawat" wrote: > When I run a javascript in ff, the "view source" shows the > javascript that I had put in the html file that is being rendered. Which is ...
formatnumber   (428 Views)
How can I convert the number 123456789 to 123,456,789
Re: [ANN]: NNTP Server slow downs.   (214 Views)
As much as I have liked your windows3.1 for its foresight of network capability. and disliked windows 95. I think your windows Dot Windows thing has reached the known edge of the universe. =========== May God decide on eradication of ...
Take a look at the corrective pack for Microsoft Internet Explorer   (166 Views)
Right click and get "copy link address" on javascript redirect   (236 Views)
So here's my situation, I have a div that is clickable and redirects to a page using the window.location.href method. I'm not using anchor tags because within the div, there are other links that can be clicked. So I'm using the onclick redirect for the div, then using stopPropagation to prevent the redirect when links are clicked. The problem is, I would like the javascript redirect to also work like a link. So that when you right click it, you are given the option to copy the link address, as this is significantly more convenient for myself and my users, rather than having to click it first and then copy the URL. Does anyone know how this can be accomplished This post has been edited by itdoell: 30 November 2011 - 04:07 PM
Layering between two JQuery image effects.   (166 Views)
Ok.. i'll start at the beginning so those reading this understand where im at.. My website has a large banner, that rotates between several hardcoded images with a fading effect... This works very well and im very pleased with the result.. (see the onmouseover demo (lower left) from DynamicDrive) I also added an image magnifier Jquery script to the page as well.. Click on the thumbnails and the magnified image fades in from the original image to the center of the screen. Ok.. now my problem.. In Internet Explorer, this combo works.. the large banner stays at the back, and the magnified image, appears ontop... BUT.. in Google Chrome (& Apple Safari) - its the opposite. The banner remains topmost and the magnified image apears above everything else but behind the large banner.. Is there anyway to force Chrome to understand which is which I rather like Chrome and don't want to move back to IE.. Cheers! PS:: I'll just quick that the whole sha-bang works exactly right in Frontpage Preview as well.. so.. TBH i think it's Google Chrome's problem.. But I'd like to know how to solve this This post has been edited by Saldash: 29 September 2009 - 03:01 AM
introducing collapsible pannel   (142 Views)
I have introduced javascript to enable and disalbe particular checkboxes on selection on radio buttons. But i want the checkboxes to appear on the page only when a particular checkbox is checked. Please guide me the way to do so. regards, SHivane Contact us function Validate(){ var name=document.loginForm.fname var var sadd=document.loginForm.sadd var if ((name.value==null)||(name.value=="")){ alert("Please Enter User Name") //uid.focus() return false } if ((mail.value==null)||(mail.value=="")){ alert("Please Enter Email Address") //pwd.focus() return false } if ((sadd.value==null)||(sadd.value=="")){ alert("Please Enter Street Address") //pwd.focus() return false } if ((mobile.value==null)||(mobile.value=="")){ alert("Please Enter Mobile Number") //pwd.focus() return false } else { return true } } function disableall(){ resedential(true) commercial(true) } function resedential(val){ document.getElementById("ip1").disabled=val; document.getElementById("ip2").disabled=val; document.getElementById("ip3").disabled=val; document.getElementById("ip4").disabled=val; document.getElementById("ip5").disabled=val; document.getElementById("ip6").disabled=val; document.getElementById("ip7").disabled=val; document.getElementById("ip8").disabled=val; document.getElementById("ip9").disabled=val; } function commercial(val){ document.getElementById("ip10").disabled=val; document.getElementById("ip11").disabled=val; document.getElementById("ip12").disabled=val; document.getElementById("ip13").disabled=val; document.getElementById("ip14").disabled=val; document.getElementById("ip15").disabled=val; document.getElementById("ip16").disabled=val; } function resedentialEn(){ commercial(true) resedential(false) } function commercialEn(){ resedential(true) commercial(false) } Contact us First Name Last Name Email Address Street Address Suburb State Postal Code Phone# Mobile Type of Property RESIDENTIAL (HOUSE,UNIT,TOWNHOUSE,CARS,BOATS ETC) COMMERCIAL (OFFICE,RETAIL,STRATA,FACTORY ETC) RESIDENTIAL CARPET CLEANING CAR SEAT UPHOLSTERY BLINDS LEATHER MATRESSES OTHER(SPECIFY) RUGS Commercial CARPET CLEANING PARTICIAN OFFICE CHAIRS VINYL OTHER(SPECIFY) LEATHER Aditional STAIN TREATMENT WATER/FLOOD SERVICES CARPET PROTECTION ODOUR REMOVAL UPHOLSTERY PROTECTION PET STAINS/SMELL Best Contact method PHONE MOBILE EMAIL Comments / Questions The fields marked with () are mandatory fields
number validation   (186 Views)
i want a javascript which will check that the 1st and 4th entered no. should not be '0' or '1'.i have this script. function isValidPattern_Digits(str) { var regEx = new RegExp("[^0-9]","ig"); return !regEx.test(str); } if(phone == '' || !isValidPattern_Digits(phone)) { alert("You have to input your phone number and it must have digits only."); document.frmRegistration.txtPhone.focus(); return false; } Mod edit - Added code tags.
The limits of jquery - JavaScript Help   (157 Views)
im having a problem while moving a object accross the screen and trying to make it hide() while its still moving.if you look at my page below it will get you a some what idea of what im doing.the problem is im wanting to blow something up while its moving and im having problems doing problem is while using jquery animation i cant tell a element what to do until the animation is done with that element.another thing i hate how jquery animation slows down right before stoping. Im assuming thats jquery doing that because im trying to blow up a fast moving ship i cant have it be slowing down to a stop then blow up. My home page isnt showing the faster ships im working on atm but will still give you an idea what im doing. would really appreciate some help im at a halt now. $('.'+tag)[effect](0,function(){ $(this).animate({'margin-left': '+='+left , 'margin-top': '+='+top , 'width': '+='+width ,'height': '+='+height}, +speed); });
Validate Checkbox without a form Please Help - JavaScript Help   (168 Views)
I want to set up a Javascript Function with a onclick without the use of a form.Heres a simple Checkbox:Check the button is clicked.Submit ThisI want to add a function to see if checkbox is checked upon clicking the link:function meClick(){ if(document.checker.checked == true){ alert("Hooray... checkbox is clicked"); }else{ alert("Nah... its not working"); }}But this is not working... please help... been driving me mad for hours!!!!