ajax and php - change text field with a button - JavaScript Help


Hi ,

I'have a problem. I want to change a field with a button.
my field:

my button:

now is my question, how can ik change my button so, that every time I push the button it adds a 1 to the text field
Posted On: Wednesday 2nd of January 2013 12:38:36 AM Total Views:  310
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




2 scripts, same page, neither loads

hey, been scratching my head over this for a couple hours, see if yall can give insight. its been forever since i have touched js, so i have a script my dad wants to work on both sides of his main header, if you have one on a page, it works fine, put on the 2nd and it dies. i figured it was overlapping variables, or function names so i went through and added a '2' to each variable and function name, but still no dice. same effect. actually now after some more messing around, if i have just the one on the left on the page, it loads and works, if i add in the one on the right only the right one works. its alot of code down here but any help would be greatly appreciated. and remembered, its double, so only half as long as it looks Untitled Document // CREDITS: // Image Scroller 2.03 with double-fade effect // By Peter Gehrig // Copyright (c) 2003 Peter Gehrig. rights reserved. // Permission given to use the script provided that this notice remains as is. // Additional scripts can be found at http://www.24fun.com // info@24fun.com // 9/6/2002 // IMPORTANT: // If you add this script to a script-library or script-archive // you have to add a highly visible link to // http://www.24fun.com on the webpage // where this script will be featured // URLs of slides var slideurl2 =new Array("pic1.jpg","pic2.jpg","pic3.jpg","pic4.jpg") // comments displayed below the slides var slidecomment2=new Array("Mary","Jane","Rita","Tina") // links for each slide var slidelink2=new Array("http://www.yahoo.com","http://www.google.com","http://www.altavista.com","http://www.24fun.com") // targets of the links. owed values: "_parent", "_top", "_blank", "_self" var slidetarget2=new Array("_blank","_blank","_blank","_blank") // the width of the slideshow (pixels) var scrollerwidth2=245 // the height of the slideshow (pixels) var scrollerheight2=75 // width of the transparent zones (pixels) var translayers2zone2=0 // font-attributes for the comments var slidefont2="Arial" var slidefont2color="blue" var slidefont2size="2" // background-color of webpage var pagebgcolor2="#FFFFFF" // do not edit below this line var translayers2width=1 var translayers2max=Math.floor(translayers2zone2/translayers2width) var translayers2leftpos=0 var translayers2opacity=100 var translayers2factor=100/translayers2max var translayers2widthall=translayers2max*translayers2width var allpicturewidth2 var distancepictopic2=0 var scrollerleft2=0 var scrollertop2=0 var pause2=20 var step2=2 var newstep2=step2 var clip2left,clip2right,clip2top,clip2bottom var I_picture2=0 var timer2 var picturecontent2="" var ns4=document.layers1:0 var ns6=document.getElementById&&!document.all1:0 var ie=document.all1:0 var browserinfos=navigator.userAgent var opera=browserinfos.match(/Opera/) var preloadedimages2=new Array() for (i=0;i=scrollerleft2-allpicturewidth2) { document.all.picturediv2.style.posLeft-=step2 clip2right+=step2 if (clip2right>scrollerwidth2) { clip2left+=step2 } document.all.picturediv2.style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" var timer22=setTimeout("scrollpicture2()",pause2) } else { resetposition2() } } if (ns6) { if (parseInt(document.getElementById('picturediv2').style.left)>=scrollerleft2-allpicturewidth2) { document.getElementById('picturediv2').style.left=parseInt(document.getElementById('picturediv2').style.left)-step2 clip2right+=step2 if (clip2right>scrollerwidth2) { clip2left+=step2 } document.getElementById('picturediv2').style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" var timer22=setTimeout("scrollpicture2()",pause2) } else { resetposition2() } } if (ns4) { if (document.roof2.document.picturediv2.left>=scrollerleft2-allpicturewidth2) { document.roof2.document.picturediv2.left-=step2 document.roof2.document.picturediv2.clip2.right+=step2 if (document.roof2.document.picturediv2.clip2.right>scrollerwidth2) { document.roof2.document.picturediv2.clip2.left+=step2 } var timer2=setTimeout("scrollpicture2()",pause2) } else { resetposition2() } } } function onmsover2() { step2=0 } function onmsout2() { step2=newstep2 } function resetposition2() { if (ie) { document.all.picturediv2.style.posLeft=scrollerleft2+scrollerwidth2 clip2left=0 clip2right=0 document.all.picturediv2.style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" scrollpicture2() } if (ns6) { allpicturewidth2=document.getElementById('emptypicturediv2').offsetWidth document.getElementById('picturediv2').style.left=scrollerleft2+scrollerwidth2 clip2left=0 clip2right=0 document.getElementById('picturediv2').style.clip2 ="rect("+clip2top+" "+clip2right+" "+clip2bottom+" "+clip2left+")" scrollpicture2() } if (ns4) { document.roof2.document.picturediv2.left=scrollerleft2+scrollerwidth2 document.roof2.document.picturediv2.clip2.left=0 document.roof2.document.picturediv2.clip2.right=0 scrollpicture2() } } picturecontent2="" picturecontent2+="" picturecontent2+="" for (i=0;iscrollerwidth) { clipleft+=step } document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" var timer=setTimeout("scrollpicture()",pause) } else { resetposition() } } if (ns6) { if (parseInt(document.getElementById('picturediv').style.left)>=scrollerleft-allpicturewidth) { document.getElementById('picturediv').style.left=parseInt(document.getElementById('picturediv').style.left)-step clipright+=step if (clipright>scrollerwidth) { clipleft+=step } document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" var timer=setTimeout("scrollpicture()",pause) } else { resetposition() } } if (ns4) { if (document.roof.document.picturediv.left>=scrollerleft-allpicturewidth) { document.roof.document.picturediv.left-=step document.roof.document.picturediv.clip.right+=step if (document.roof.document.picturediv.clip.right>scrollerwidth) { document.roof.document.picturediv.clip.left+=step } var timer=setTimeout("scrollpicture()",pause) } else { resetposition() } } } function onmsover() { step=0 } function onmsout() { step=newstep } function resetposition() { if (ie) { document.all.picturediv.style.posLeft=scrollerleft+scrollerwidth clipleft=0 clipright=0 document.all.picturediv.style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" scrollpicture() } if (ns6) { allpicturewidth=document.getElementById('emptypicturediv').offsetWidth document.getElementById('picturediv').style.left=scrollerleft+scrollerwidth clipleft=0 clipright=0 document.getElementById('picturediv').style.clip ="rect("+cliptop+" "+clipright+" "+clipbottom+" "+clipleft+")" scrollpicture() } if (ns4) { document.roof.document.picturediv.left=scrollerleft+scrollerwidth document.roof.document.picturediv.clip.left=0 document.roof.document.picturediv.clip.right=0 scrollpicture() } } picturecontent="" picturecontent+="" picturecontent+="" for (i=0;i
VIEWS ON THIS POST

144

Posted on:

Wednesday 21st November 2012
View Replies!

Table with sum

Okay, so I'm taking a class in web technologies, and we're working with some basic Java. The assignment is to have numbers 1-10 and their squares fill into a table... Then to have them sum at the end. My problems are: How do I change the orientation on the table output to go up and down instead of left to right Do I have to write another for or while loop to get the sum's for these numbers, or can I do it from within what I've already written Suggestions would be awesome! The book they gave us is pretty generic. Sorry for the excess code that is commented out... toying around with other options to get to the solution! view source print 01 03 04 05 06 07 08 Table of Squares 09 10 11 12 13 14 15 76 77 78 79 80 Name 81 82
VIEWS ON THIS POST

123

Posted on:

Thursday 22nd November 2012
View Replies!

The sale of world famous jacket,Jean-COOGI/DG/gino green global/G-Star and so on

The sale of world famous jacket,Jean-COOGI/DG/gino green global /G- Star and so on Nike Air Jordan 1 I Force 1 Jordan Fusion AJF 1 AJF1 AJ1F Jordan 1 fusion www.wholejean.cn Nike Air Jordan 2 II Force 1 Jordan Fusion AJF ...
VIEWS ON THIS POST

112

Posted on:

Friday 23rd November 2012
View Replies!

FAQ Sections - Feedback Wanted

Breaking up the FAQ has been discussed. http://groups.google.com/group/comp....878ddfb2ac892/ I'm interested in doing this now. I propose something along the lines of: * Numbers * Windows and Frames * Forms I would like to hear feedback on this proposal. Garrett...
VIEWS ON THIS POST

67

Posted on:

Saturday 24th November 2012
View Replies!

jQuery mobile

Hi , I'm making my first jQuery mobile app and using a fixed bottom navbar. But the app is acting a little weird. When I tap the background twice, the navbar disappears or moves up a little. how can I fix this problem
VIEWS ON THIS POST

149

Posted on:

Saturday 24th November 2012
View Replies!

toggle table rows

I am trying to toggle rows in a table based on the selection of a radio button. The functions is as follows: function showHideRows(clsName, hideshow) { var table = document.getElementById('fullTable'); var rows = table.getElementsByTagName('tr'); for(var i=0;i
VIEWS ON THIS POST

120

Posted on:

Saturday 24th November 2012
View Replies!

how to Load image without refreshing whole page

hello i got alexa charts links from internet today i want to insert them in html form with few button for every chart and want to load new chart once user click another button i mean without reloading entire page ,.... i do not know ajax much more so need help
VIEWS ON THIS POST

136

Posted on:

Saturday 24th November 2012
View Replies!

I want dropdown menu to display right values

I have two dropdown menus. 1st -> Drop Down Menu (name="optionDrop") has 5 values which are "ABC", "ABCD", "ABCDE", "True or False" and "Yes or No". 2nd -> Drop Down Menu (name="numberDrop") has 5 values which are "","1", "2", "3" and "4". Now this is what I want to achieve: If user select "ABC" from "optionDrop", then only display options "", "1" and "2" If user select "ABCD" from "optionDrop", then only display options "", "1", "2" and "3" If user select "ABCDE" from "optionDrop", then only display options "", "1", "2", "3" and "4" If user select "True or False" from "optionDrop", then do not display DropDown Menu and Display N/A (This I achieved but I want hidden numberDrop to equal 1, I have not achieved that part) If user select "Yes or No" from "optionDrop", then do not display DropDown Menu and Display N/A (This I achieved but I want hidden numberDrop to equal 1, I have not achieved that part) Does anyone know how this can be done and implemented in the javascript code I have Below is Javascript Code: function getDropDown() { var optionDrop = document.getElementsByName("optionDrop"); var na = document.getElementById("na"); var numberDrop = document.getElementsByName("numberDrop"); var answerA = document.getElementById("answerA"); var answerB = document.getElementById("answerB"); var answerC = document.getElementById("answerC"); var answerD = document.getElementById("answerD"); var answerE = document.getElementById("answerE"); var answerTrue = document.getElementById("answerTrue"); var answerFalse = document.getElementById("answerFalse"); var answerYes = document.getElementById("answerYes"); var answerNo = document.getElementById("answerNo"); if (optionDrop[0].value == "abc" || optionDrop[0].value == "abcd" || optionDrop[0].value == "abcde"){ numberDrop[0].style.display = "block"; na.style.display = "none"; }else if (optionDrop[0].value == "trueorfalse" || optionDrop[0].value == "yesorno"){ numberDrop[0].style.display = "none"; na.style.display = "block"; } } Htrml code:
VIEWS ON THIS POST

120

Posted on:

Saturday 24th November 2012
View Replies!

Instant name checking/showing using Ajax/Jquery

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]http://farm3.static.flickr.com/2119/5803687637_48d9717b56_b.jpg[/IMG] I need to implement this feature. any kind help would be appreciated , thanx a lot in advance
VIEWS ON THIS POST

233

Posted on:

Saturday 24th November 2012
View Replies!

Simple ajax not working.

, 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); xmlhttp.open('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
VIEWS ON THIS POST

173

Posted on:

Saturday 24th November 2012
View Replies!

Changing the cursor position.

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.
VIEWS ON THIS POST

163

Posted on:

Saturday 24th November 2012
View Replies!

Ajax/Php Poll

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
VIEWS ON THIS POST

103

Posted on:

Saturday 24th November 2012
View Replies!

Two Submit Buttons -- One PHP Destination

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
VIEWS ON THIS POST

150

Posted on:

Saturday 24th November 2012
View Replies!

Adbrite Java Ad Code Amendment Needed!

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.
VIEWS ON THIS POST

306

Posted on:

Saturday 24th November 2012
View Replies!

HTML radio buttons

, 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.
VIEWS ON THIS POST

160

Posted on:

Saturday 24th November 2012
View Replies!

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.
VIEWS ON THIS POST

131

Posted on:

Sunday 25th November 2012
View Replies!

change content with jquery?

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\t $(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'); });
VIEWS ON THIS POST

242

Posted on:

Sunday 25th November 2012
View Replies!

brief walk through AJAX??

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,
VIEWS ON THIS POST

322

Posted on:

Sunday 25th November 2012
View Replies!

edit caption of image in lightbox

hello ! im just wondering if it is possible to edit the caption of an image while it's being viewed through lightbox
VIEWS ON THIS POST

211

Posted on:

Sunday 25th November 2012
View Replies!

Create a timer for php pages

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();
VIEWS ON THIS POST

166

Posted on:

Sunday 25th November 2012
View Replies!

banner in ajax

Hi all.. i want to create a banner in my website using asp.net 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..
VIEWS ON THIS POST

197

Posted on:

Sunday 25th November 2012
View Replies!

Full screen

Hi ppl, i have a prob here. i'm trying to do a webpage and putting it in a cd for viewers to view. so i found the script below to open a full screen windows. it work! but the prob is that it opens two pages. one normal window and a full screen window. any ways to code it in order to get just one full screen windows
VIEWS ON THIS POST

72

Posted on:

Sunday 25th November 2012
View Replies!

javascript or ajax which one?

hello :-)i want to have your opinion.im 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 model.so 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
VIEWS ON THIS POST

169

Posted on:

Monday 26th November 2012
View Replies!

text on hover...

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.
VIEWS ON THIS POST

114

Posted on:

Monday 26th November 2012
View Replies!

How do I make a div visible and then invisible

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 (d.style.display == "none") d.style.display = "block"; else d.style.display = "none"; window.setInterval("magic()", 1000); } This post has been edited by spotilator: 30 October 2010 - 09:00 AM
VIEWS ON THIS POST

125

Posted on:

Monday 26th November 2012
View Replies!

Whats wrong with this while loop?

while(frames['ghfa'].contentDocument===""); I can't figure it out : / Its basically just supposed to idle while the frame is empty
VIEWS ON THIS POST

133

Posted on:

Monday 26th November 2012
View Replies!

Thank you

Thanks
VIEWS ON THIS POST

135

Posted on:

Monday 26th November 2012
View Replies!

Remove value from input text

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
VIEWS ON THIS POST

116

Posted on:

Monday 26th November 2012
View Replies!

Question about variables

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
VIEWS ON THIS POST

155

Posted on:

Monday 26th November 2012
View Replies!

worked in one file, not in the other???

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...
VIEWS ON THIS POST

163

Posted on:

Monday 26th November 2012
View Replies!

How to output java var in html on php page? - JavaScript Help

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(\'\'); ()
VIEWS ON THIS POST

145

Posted on:

Tuesday 27th November 2012
View Replies!

Use cookie to save window status 2 - JavaScript Help

Hi ,I use a cookie to save the status of divs on my page. When someone clicks the "hide" button then this code runs:function toggle5(showHideDiv, switchImgTag) { var ele = document.getElementById(showHideDiv); var imageEle = document.getElementById(switchImgTag); if(ele.style.display == "block") { ele.style.display = "none"; setCookie(showHideDiv,'false',9999); imageEle.innerHTML = ''; } else { ele.style.display = "block"; setCookie(showHideDiv,'true',9999); imageEle.innerHTML = ''; } }Now the window is hidden. I save a cookie with the name of the div and the value "false".When the page is reloaded it should check which divs should be hidden and then hide them.How can I use javascript for this
VIEWS ON THIS POST

95

Posted on:

Tuesday 27th November 2012
View Replies!

Google Dynamic Maps V3 cant place inside div?

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% }
VIEWS ON THIS POST

164

Posted on:

Thursday 29th November 2012
View Replies!

Javascript innerText Span issue

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
VIEWS ON THIS POST

132

Posted on:

Thursday 29th 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

139

Posted on:

Thursday 29th November 2012
View Replies!

event handler named clear_click that clears text boxes

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
VIEWS ON THIS POST

105

Posted on:

Thursday 29th November 2012
View Replies!

Redirecting and Reading Cookie Problem

I'm supposed to develop a page that asks info as form values and when you hit "submit" it takes you to a page that reads the values you entered into the first page and displays those values in a message. ...
VIEWS ON THIS POST

188

Posted on:

Friday 30th November 2012
View Replies!

Calling Web Services from independent browser using javascript

, 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(webservice.htc); (technique founded in the microsft site) but when i'm going to try ...
VIEWS ON THIS POST

138

Posted on:

Friday 30th November 2012
View Replies!

Re: How to see source code as rendered (not the script)

On Jul 2, 3:41 pm, "V S Rawat" wrote: > When I run a javascript in ff 2.0.0.4, the "view source" shows the > javascript that I had put in the html file that is being rendered. Which is ...
VIEWS ON THIS POST

136

Posted on:

Friday 30th November 2012
View Replies!

Onchange correction on date

, I'm in need of a script that will adjust a date in a textfield. For example: I type: 31012005 and leave this textfield. On leaving, javascript should correct this to 31-01-2005. Can anybody help me with this
VIEWS ON THIS POST

100

Posted on:

Friday 30th November 2012
View Replies!

formatnumber

How can I convert the number 123456789 to 123,456,789
VIEWS ON THIS POST

300

Posted on:

Friday 30th November 2012
View Replies!

Re: [ANN]: NNTP Server slow downs.

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 ...
VIEWS ON THIS POST

118

Posted on:

Friday 30th November 2012
View Replies!

Take a look at the corrective pack for Microsoft Internet Explorer

...
VIEWS ON THIS POST

106

Posted on:

Friday 30th November 2012
View Replies!

Right click and get "copy link address" on javascript redirect

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
VIEWS ON THIS POST

144

Posted on:

Sunday 23rd December 2012
View Replies!

Layering between two JQuery image effects.

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
VIEWS ON THIS POST

119

Posted on:

Monday 24th December 2012
View Replies!

introducing collapsible pannel

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 mail=document.loginForm.email var sadd=document.loginForm.sadd var mobile=document.loginForm.mobile 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
VIEWS ON THIS POST

93

Posted on:

Monday 24th December 2012
View Replies!

number validation

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.
VIEWS ON THIS POST

130

Posted on:

Monday 24th December 2012
View Replies!

The limits of jquery - JavaScript Help

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 this.one 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.http://www.stargatesystemlords.com $('.'+tag)[effect](0,function(){ $(this).animate({'margin-left': '+='+left , 'margin-top': '+='+top , 'width': '+='+width ,'height': '+='+height}, +speed); });
VIEWS ON THIS POST

101

Posted on:

Friday 28th December 2012
View Replies!

Validate Checkbox without a form Please Help - JavaScript Help

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!!!!
VIEWS ON THIS POST

111

Posted on:

Friday 28th December 2012
View Replies!

Audio via HTML5 - JavaScript Help

,I am attempting to create some audio tags via JS. I am using the following code. var audioElement = document.createElement('audio'); audioElement.setAttribute('src', '/lib/audio/01Gen002.ogg'); audioElement.currentTime = 10; audioElement.play(); When I drop out the audioElement.currentTime line it works just fine, but that line produces the following error....Error: uncaught exception: [Exception... "An attempt was made to use an object that is not, or is no longer, usable" code: "11" nsresult: "0x8053000b (NS_ERROR_DOM_INVALID_STATE_ERR)" location: "http://base/bible/index/25 Line: 75"]I am attempting to play the audio from a specific point and I am not having any luck. Am I using this element wrong
VIEWS ON THIS POST

46

Posted on:

Wednesday 2nd January 2013
View Replies!