only in this jsp javascript code is not working...please help me.


This is javascript
Code: function defaultfn(){ var x=document.getElementById('task'); x.disabled=true; var y=document.getElementById('category'); y.disabled=true; } function enabledorpdown(){ var a = document.getElementsByName('cb'); var x=0; for(var i=0; i
Posted On: Tuesday 16th of October 2012 05:32:41 AM Total Views:  130
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Script works only with firebug installed, or in non-mozilla

A script I've implemented is doing this annoying thing where it works in mozilla only if you have Firebug installed. I was all excited to find someone had solved what sounded like the same problem, as outlined in this article but unfortunately, it turns out that I am not using sync XMR.open, but rather async. ALSO, the related bug: 383304 sez that the bug was fixed in FF 3.0.1 I am running FF3.0.1 in MacOS 10.4.11 (though I had also seen it on win32 platform earlier this year, and put off fixing it till now). I'm not 100% sure that it was related to the XMR calls, but my big concern is that Firebug makes my code work, and it also works in Safari, but not in any mozilla-derived browsers, which sounds like the bug above. So the signature is the same. Nothing worse than a debugger that makes stuff work only in its presence! Is anyone aware of any other situations where Firebug makes something work in Mozilla, other than this XHR.open sync bug I guess I'm going to jump in and try to figure out where my code fails, but doing it without a debugger in my browser is going to be a real pain... Thx- Ross.
VIEWS ON THIS POST

69

Posted on:

Tuesday 16th October 2012
View Replies!

how do I check that a text field only contains the letter x

I am trying to get javascript to submit a form only if the user has entered a capital X in a text box (named "tictactoe3"). I only want the form to submit if the character enter is an X. I do not want it to submit if any other character is entered or if more than one character is entered or if the field is left blank.
VIEWS ON THIS POST

63

Posted on:

Wednesday 17th October 2012
View Replies!

Resolved Javascript XML reader only returns first row

. I've got a XML doc that I'm trying to parse with javascript, but only the first row of XML is being returned. Any ideas why Code: var xmlDoc = null; if (window.ActiveXObject) { // code for IE xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); } else if (document.implementation.createDocument) { // code for Mozilla, Firefox, Opera, etc. xmlDoc = document.implementation.createDocument("","",null); } else { alert('Your browser cannot handle this script'); } if (xmlDoc != null) { xmlDoc.async = false; xmlDoc.load("patients.xml"); document.write("
VIEWS ON THIS POST

100

Posted on:

Wednesday 17th October 2012
View Replies!

How to show any sort of data with only including a Javascript file.

, I always wonder that how to display any sort of data or HTML codes by just simply calling or including a Javascript file in other HTML file or a webpage. If you didn't understand what I want to say, I would like to give an example like AdSense gives a javascript code that need to be put where we want to show ads. And the ads appear, similarly how to display any HTML code with just inclusion of Javascript file. An other example is - Now this script will show some HTML inside first div, some on second and so on. So How can I do that, please explain with an example...
VIEWS ON THIS POST

80

Posted on:

Wednesday 17th October 2012
View Replies!

window.open problem with Safari (ipad and iphone only)

I'm having problems with a very simple bit of Javascript not working with the latest version of Safari for ipads and iphones. The script in question is used as a 'previous image ' and 'next image' navigation facility, basically closing one pop-up window and opening up another, when viewing a photo gallery. It has worked perfectly for a number of years on all browsers. It is only the latest version of Safari for ipads and iphones where there's a problem. On an iphone, the new window unfortunately opens up in a new tab and the existing window fails to close. Mobile Safari soon reaches the maximum of 8 permissible tabs as a user moves through the photos gallery. On an ipad2, no new window opens and the existing window fails to close. the website is www.gethigh.co.uk Code: } function picPopup4(page,width,height){ //alert(scroll); var a; a = width / 2; var b; b = height / 2; var LeftPosition = (screen.width/2) - a; var TopPosition = (screen.height/2) - b; window.open(page, "", "width="+width+",height="+height+",toolbar=no,header=no,location=no,resizable=yes,"+"left="+LeftPosition +",top="+TopPosition+",scrollbars=yes"); window.close(); } and this is an example of the code creating the navigation within each pop-up window Code: previous image       close window       next image I'll come clean and admit I'm not a programmer and have a very basic and ancient understanding of HTML coding. My website must be approaching double digit years old (which will be immediately apparent if you view its structure). I can usually resolve most things, and maintain its functioanality when needs be, but this particular problem has got me stumped. I've come onto this forum to see if anyone could provide a simple work-around Or if anyone would know if this is a bug within Safari which may be rectified soon (a search through the Apple forums gave no clues). I'm loathed to make any major updates/changes to my site, as despite its age it renders beautifully on all browsers except the latest ipad/iphone Safari. Cheers and hopefully
VIEWS ON THIS POST

125

Posted on:

Wednesday 17th October 2012
View Replies!

HTML5/JS plays only audio...

I worked on this website : http://www.kesslercareers.com/index.html and cannot find out why it does not work in IE while it works in other browsers. The small video does not play while the sound does. As far as I can see it works fine in FF and Chrome. Anybody any idea
VIEWS ON THIS POST

95

Posted on:

Wednesday 17th October 2012
View Replies!

Resolved error with += in IE only?

SOLUTION: I accidentally used instead of ... IE actually threw a proper error, since \u escapes a unicode string (in hex) --- I have the following section of javascript: Code: jQuery.each($('.prodContent'), function(i, val) { if(!($(this).is(":has(ul.tabs)"))) { jQuery.each($(this).children('.panes:has(.tabdiv)'), function(i, val) { var theList = "\n"; jQuery.each($(this).children('.tabdiv'), function(i, val) { var theName = $(this).children('.noshow:first').text(); theList += " "+theName+"\n"; }); theList += "\n"; $(this).before(theList); }); } In firefox and chrome, it takes a series of divs, containing headers, and adds a list of those headers before the series... so this: Code: header1 content header2 content becomes: Code: header1 header2 header1 content header2 content however, in IE, the error console claims an error on line 7, at the +=, saying that it expected a hexidecimal value... any ideas p.s. you can see the issue live here http://bit.ly/oYrNAa (sorry bout the url shortener, but i don't want this topic to show up in a search for the site)
VIEWS ON THIS POST

72

Posted on:

Wednesday 17th October 2012
View Replies!

Show javascript ad only once per day

, I already saw this post but I wasn't sure if it took care of the question I'm asking. I have the following javascript ad code right before the tag: Code: This is a slider ad that shows every time the person comes to the page I have it on. I'd like to show this ad only once per 24 hours per visitor. Can someone please help me out with code to do this I'm kinda newbish at this.
VIEWS ON THIS POST

59

Posted on:

Wednesday 17th October 2012
View Replies!

JavaScript only works once

Hi I am new to programming have tried to write a simple HTML page and servlet. Using tomcat. Added a javascript validation function. However when I type wrong it works the first time, displays alert and returns to entry form. on second attempt type in wrong again, expected to see alert and return to entry form but it submits. I am new to programmng and could do with some help can not find any clue, answer to this problem. Have checked javascript is ticked in Firefox 5.0. Set up is I have a HTML page with one javascript check function at present for test development. It is linked to a servlet in tomcat. Problem is when I enter wrong the first time, get alert message and it returns to the HTML orginal page. However if I click on entry field and enter wrong again. It submits the form, does not give an alert or return to the orginal form Has any one got a solution or is this how validation should work. Code is: Code: Creation of POs Purchase Order function check() { check = document.forms[0].SLine1.value; if(check=="wrong"){ alert("enter correct info"); return false; } else { return true; } } various inputboxes and messages various other lines of inputs boxes
VIEWS ON THIS POST

76

Posted on:

Wednesday 17th October 2012
View Replies!

creating an alert and continue on this page after alert for admin only

I have an user table like this:- guid | username | password | firstname | lastname | location | emailad dress | userrole -----------------------------------+----------+----------------------------------+-----------+-----------+----------+-------- ------+--------------- 8024259764dc3e8ee0fb6f5.84107784 | james | 827ccb0eea8a706c4c34a16891f84e7b | james | bond | NY | ny@live .com | administrator 18689183644dc3e91571a364.71859328 | saty | 250cf8b51c773f3f8dc8b4be867a9a02 | saty | john | NY | hk@fd.c om | administrator 2644885344cecd6f2973b35.63257615 | admin | 21232f297a57a5a743894a0e4a801fc3 | System | Generated | | | administrator (3 rows) now my postgre query for delete the row .... $query = "delete from users where username!= 'admin' and guid='".$guid."'"; $result = pg_query($conn, $query); > alert("Cannot delete this .\n It is system generated(s).");
VIEWS ON THIS POST

89

Posted on:

Wednesday 17th October 2012
View Replies!

help with using regular expressions to validate letters only

Hi wise javascript gurus, I am working on a small form that on the click of a button, it calls a function to validate a string that consists of 3 portions delimited with a dash("-") in the following format XXX-NNNN-XXX where X are letters only where N are numbers only I have to use regular expressions to validate the first portion and verify that its exactly 3 characters long that are letters only if the first portion or "plant code" is larger then 3 characters long an alert gets display also if the first portion contains alphanumeric or numeric characters an alert gets displayed, the first portion has to be in letters only. down below is my code that is not functional at the time because I know for sure the way I check for regular expressions is a bet washy but thats the only thing I was able to come up with, any help will be appreciated. thanks for making time to read my thread Code: function validateit() { var number = document.myform.product_number.value; var charnum = number.length; if (number =="") alert("you must enter a product number, field cannot be empty"); else if (charnum < 12 || charnum > 12) alert("the product numbre has to be exactly 12 characters long"); else validate_number(number); } function validate_number(num) { var objRegEx = /^[a-z]+$/; split=num.split("-",3); if (split[0].length!=3) alert("the Plant Code portion of the Product Number has to be only three charactes long") if!(objRegEx.test(split[0]) alert("the Plant Code portion of the Product Number has to be letters only") } waldo's .heading{font-weigth:bold;text-align:center; font-family:"comic sans MS"} Waldos's WareHouse Product NumberPlant CodeProduction RunShift Number Validation Date:
VIEWS ON THIS POST

86

Posted on:

Wednesday 17th October 2012
View Replies!

grey out all the page, and focus attention to 1 div only?

everybody, how can i grey out a whole page, and focus attention on a div only are there any good scripts please help. EDIT: actually what i want to do is:click a button grey out all my page and show a loading gif load, thru ajax, content from external source turn off grey and loading gif update current page content.
VIEWS ON THIS POST

192

Posted on:

Wednesday 17th October 2012
View Replies!

Please help: only half validates, otherwise code works well

Hi. I am having trouble getting my code to validate for my speed/distance calculator. I have 2 input prompts: 1 for hours and 1 for minutes. The issue is I can put a number for hours (e.g 7) and W for minutes and the result will display distance is NaN, whereas I am expecting it to alert user to input a valid number. The same issue applies if I switch the order of isNan(hours) and isNaN(mins) If you have even the slightest idea of what I have done wrong, or what I am missing I will truly appreciate the input.
VIEWS ON THIS POST

154

Posted on:

Wednesday 17th October 2012
View Replies!

Javascript Help - function executes only once (instead of twice)

I have javascript that sets global variables to true. Here is the code: Code: var count=0; var castforfood=false; var sc2mx=false; var ozrak=false; var chavodelocho=false; var jimrising=false; var day9tv=false; function justinlive(arg){ if(arg != null){ if(count==2){ ozrak=true; } else if(count==5){ day9tv=true; } } count++; } function livestatus(arg){ if (arg.channel.isLive == true){ if (count==1){ sc2mx=true; } else if (count==3){ chavodelocho=true; } } count++; } function set_status(status){ if (status == "live"){ if (count==0){ castforfood=true; } else if (count==4){ jimrising=true; } } count++; } [...] [...] The calls to set_status and livestatus work just fine. The problem is calling "justinlive". It only works correctly the first time. The second time, the function does not execute at all. (I tried inserting an "alert(""); at the beginning of the function, so I know it only gets executed once.) I'm pretty sure this is a simple issue, but I've been stuck on this for weeks now. Help is appreciated.
VIEWS ON THIS POST

73

Posted on:

Wednesday 17th October 2012
View Replies!

Multiple dropdowns gives only one value and a headache

Apologizes for the long post, I wanted to be thorough. I am not very familiar with Javascript at all, learning every day - but hopefully this has an easy fix. I'm making an application where students can select their SCHOOL in a dropdown, which based on the selection, displays a second dropdown containing CLASSES. This part works fine. It then converts the value of the dropdown-selection to an ID-number which is used pasted in a URL for that class's online schedule (Example: www. url.com/generator/school= '+chosenSchool+' class= '+chosenClass+' blablabla.aspx) - plus saves the ID to recognize the selection for later use. This also worked fine, before I added the more than one school. Now, whenever I select a SCHOOL and a CLASS, I get the correct SCHOOL but the CLASS is always the FIRST ID in the list (marked in red), and I'm not sure why. I thought about creating different variables for each class-list, but there is really more than two, and I need the name of the variable to be the same (chosenSchool) for the storing and URL-input. Code: $(function() { $("#school").change(function() { // DROPDOWN LIST WITH DIFFERENT SCHOOLS var schoolValue = document.getElementById('dropdown-school').selectedIndex; // GETS THE DROPDOWN VALUE (0-1) var schoolID = ["60690","60360"] // NEEDED ID chosenSchool=schoolID[schoolValue] // CONVERTS TO ID var selectedSchool = $("#school").val(); // MANAGE DROPDOWNS BELOW // DISPLAYS DROPDOWN LIST WITH CLASSES FROM THE FIRST SCHOOL WHEN SELECTED if(selectedSchool == "firstSchool") { $("#firstSchool").show(); // SHOWS DROPDOWN IF THE RIGHT ONE var firstClassValue = document.getElementById('classlist-1').selectedIndex; // GETS THE DROPDOWN VALUE (0-5) var firstClassID = ["45B9D5AD-8E32","0A9261F7-8BC7E","307C7E8C-054E","B21D19A7-5076","99ECF5B8-E0E1","36B44988-006F""] // NEEDED ID chosenClass=firstClassID[firstClassValue] // CONVERTS TO ID } else { $("#firstSchool").hide(); // HIDES DROPDOWN IF NOT THE RIGHT ONE } // DISPLAYS DROPDOWN LIST WITH CLASSES FROM THE SECOND SCHOOL WHEN SELECTED if(selectedSchool == "secondSchool") { $("#secondSchool").show(); // SHOWS DROPDOWN IF THE RIGHT ONE var secondClassValue = document.getElementById('classlist-2').selectedIndex; // GETS THE DROPDOWN VALUE (0-5) var secondClassID = ["4EBF33E0E514","05F96E17-8DF9","4EA71DA6-5CCC","F7D08749-746E","0CA6F782-6B9D","BBD66276-752F"] // NEEDED ID chosenClass=secondClassID[secondClassValue] // CONVERTS TO ID } else { $("#secondSchool").hide(); // HIDES DROPDOWN IF NOT THE RIGHT ONE } }); $('#school').trigger('change'); // TRIGGERS THE CHANGE }); // SAVES THE SELECTED VALUES function saveSettings() { localStorage.setItem('SCHOOL', chosenSchool); // SAVES SCHOOL ID-NUMBER localStorage.setItem('CLASS', chosenClass); // SAVES CLASS ID-NUMBER location.reload(true) // RELOAD WITH SAVED VALUES } // HTML: SCHOOL DROPDOWN: firstSchool secondSchool CLASS DROPDOWN 1: Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 CLASS DROPDOWN 2: Class 1 Class 2 Class 3 Class 4 Class 5 Class 6 So my "chosenClass" is always the ID marked red. Why Appreciate and help I can get..
VIEWS ON THIS POST

72

Posted on:

Wednesday 17th October 2012
View Replies!

Why is the callwhy is the slice method only a method of an Array instance?

Why is the callwhy is the slice method only a method of an Array instance The reason why I ask is because if you want to use it for the arguments property of function object, or a string, or an object, or a number instance, you are forced to use Array.prototype.slice.call(). And by doing that, you can pass in any type of object instance (Array, Number, String, Object) into it. So why not just default it as a method of all object instances built into the language In other words, instead of doing this: Code: function Core(){ var obj = {a : 'a', b : 'b'}; var num = 1; var string = 'aff'; console.log(typeof arguments);//Object console.log(arguments instanceof Array);//false var args1 = Array.prototype.slice.call(arguments); console.log(args1); var args2 = Array.prototype.slice.call(obj); console.log(args2); var args3 = Array.prototype.slice.call(num); console.log(args3); var args4 = Array.prototype.slice.call(string); console.log(args4); Core('dom','event','ajax'); Why not just be able to do this: Code: function Core(){ var obj = {a : 'a', b : 'b'}; var num = 1; var string = 'aff'; var args = arguments.slice(0); var args2 = obj.slice(0); var args3 = num.slice(0); var args4 = string.slice(0); //right now none of the above would work but it's more convenient than using the call alternative. } Core('dom','event','ajax'); Why did the designers of the javascript scripting language make this decision
VIEWS ON THIS POST

63

Posted on:

Wednesday 17th October 2012
View Replies!

OSMap / GMap switch failing - only on IE

I'm not sure whether this is best posted here, or on a google maps api forum, but here goes: I have a site which uses a google map, and works well, like this: http://www.railwaysarchive.co.uk/eve...peventID=6684 I have built a version of that page which uses an OS map by default, but allows switching to a google map. It is here: http://www.railwaysarchive.co.uk/osm...peventID=6684 The script uses a simple toggle as follows: Code: function toggleMap() { // toggle map div visibility var googlemap = document.getElementById("googlemap"); var OSmap = document.getElementById("OSmap"); if (OSmap.style.display!="block") { // currently hidden, show OSmap.style.display="block"; googlemap.style.display="none"; document.getElementById("maplink").innerHTML= "Switch to Google Map"; } else { OSmap.style.display="none"; googlemap.style.display="block"; document.getElementById("maplink").innerHTML= "Switch to OS Map"; } } I was having trouble getting both maps to load their respective data when one was hidden, so both maps start out with display:block and then the gmap is hidden during the . This system works great with Firefox and with Chrome, but in IE if you switch to the google map the tiles don't load. Can anyone help Relevant code snippets are as follows: Code: function createAccidentSummaryMap(dblLatitude, dblLongitude, enumType, lngZoom) { // creates a map with a single event marker, map type controls and full zoom controls // and centers it on the event coordinates if (GBrowserIsCompatible()) { // checks for compatible browser map = new GMap2(document.getElementById("googlemap")); map.addControl(new GSmallZoomControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); map.setCenter(new GLatLng(dblLatitude, dblLongitude), lngZoom); map.enableDoubleClickZoom(); map.setMapType(G_HYBRID_MAP); var icon = createEventIcon(enumType); var point = new GLatLng(dblLatitude, dblLongitude); var marker = new GMarker(point, icon); map.addOverlay(marker); } }
VIEWS ON THIS POST

192

Posted on:

Wednesday 17th October 2012
View Replies!

Two JavaScripts [second is only functional]

So i have this one problem and its been a major pain for a while. I have both a light box function and a fade into page intro on my website. The issue i have is when i put in the lightbox, lightbox seems to not work whats so ever. So i made another page and first put in the lightbox...that worked like a charm but once i put in the fade in intro it basically gets me back to lightbox not working...So...any way to solve this Code: Untitled Document $(document).ready(function() { // fade in content. $( '#wrapper' ).fadeIn("slow"); });
VIEWS ON THIS POST

54

Posted on:

Wednesday 17th October 2012
View Replies!

Google Maps V3--map doesn't load in IE--only loads on refresh

I'm very close to completing this map, but it's 2 steps forward 1 step back. Now that I'm basically done, with help from this forum, IE (8 or 9) isn't loading the map on initial visit to the page: http://www.wrh.noaa.gov/mfr/rec/v2/ I have to refresh the page, and then the map and sidebar displays. I tried the settimeout on line 599 from other posts with similar problems, but have commented it out. The settimeout did force IE to load the map, but then I got an el not defined type of error. Any ideas how I can get this map to load in IE as well as the currently functional FF and Chrome
VIEWS ON THIS POST

75

Posted on:

Saturday 20th October 2012
View Replies!

Need help using iframe to only reload part of the page

, The website that I'm working on is http://teaminmetsu.com I'd like to make it so that the content_box div (the main box under the content slider) is the only part of the page that reloads when the user clicks on a link. Whether that be a link from the roster or the forums button in the navbar.
VIEWS ON THIS POST

140

Posted on:

Saturday 20th October 2012
View Replies!