Cuatom alert box - JavaScript Help


.

Im doing a research poster on the effects of internet addiction. Rather than having boring white boxes I decided to craete alert boxes (custom so I can title each box). then I'll do a print screen and drop it onto the poster. My problem is the text is longer than the search box. The width is fine its just the length. Is there a way to auto adjust the length so the alert box is the correct height.

.okButton { background-color: #D4D4D4; font-color: #000000; font-size: 9pt; font-family: arial; width: 70px; height: 20px; } .alertTitle { background-color: #3C56FF; font-family: arial; font-size: 9pt; color: #FFFFFF; font-weight: bold; } .alertMessage { font-family: arial; font-size: 9pt; color: #000000; font-weight: normal; } .alertBoxStyle { cursor: default; filter: alpha(opacity=90); background-color: #E4E4E4; position: absolute; top: 200px; left: 200px; width: 100px; height: 50px; visibility:hidden; z-index: 999; border-style: groove; border-width: 5px; border-color: #FFFFFF; text-align: center; } function BrowserCheck() { var b = navigator.appName; if (b == "Netscape") this.b = "NS"; else if (b == "Microsoft Internet Explorer") this.b = "IE"; else this.b = b; this.v = parseInt(navigator.appVersion); this.NS = (this.b == "NS" && this.v>=4); this.NS4 = (this.b == "NS" && this.v == 4); this.NS5 = (this.b == "NS" && this.v == 5); this.IE = (this.b == "IE" && this.v>=4); this.IE4 = (navigator.userAgent.indexOf('MSIE 4')>0); this.IE5 = (navigator.userAgent.indexOf('MSIE 5')>0); if (this.IE5 || this.NS5) this.VER5 = true; if (this.IE4 || this.NS4) this.VER4 = true; this.OLD = (! this.VER5 && ! this.VER4) true : false; this.min = (this.NS||this.IE); } is = new BrowserCheck(); alertBox = (is.VER5) document.getElementById("alertLayer").style : (is.NS) document.layers["alertLayer"] : document.all["alertLayer"].style; function hideAlert(){ alertBox.visibility = "hidden";} function makeAlert(aTitle,aMessage){ document.all.alertLayer.innerHTML = "" + "" + "" + aTitle + "" + "" + "" + aMessage + "
" + "" + "
" + ""; thisText = aMessage.length; if (aTitle.length > aMessage.length){ thisText = aTitle.length; } aWidth = (thisText * 5) + 80; aHeight = 100; if (aWidth < 150){ aWidth = 200; } if (aWidth > 350){ aWidth = 350; } if (thisText > 60){ aHeight = 110; } if (thisText > 120){ aHeight = 130; } if (thisText > 180){ aHeight = 150; } if (thisText > 240){ aHeight = 170; } if (thisText > 300){ aHeight = 190; } if (thisText > 360){ aHeight = 210; } if (thisText > 420){ aHeight = 230; } if (thisText > 490){ aHeight = 250; } if (thisText > 550){ aHeight = 270; } if (thisText > 610){ aHeight = 290; } alertBox.width = aWidth; alertBox.height = aHeight; alertBox.left = (document.body.clientWidth - aWidth)/2; alertBox.top = (document.body.clientHeight - aHeight)/2; alertBox.visibility = "visible"; }
Posted On: Wednesday 2nd of January 2013 12:39:59 AM Total Views:  316
View Complete with Replies

RELATED TOPICS OF JavaScript PROGRAMMING LANGUAGE




Why is my button not working?

I am creating a simple numeracy game where by there is a grid populated with numbers. The numbers are hidden and when the game is run the grid space is highlighted. A div on the side produces a sum to help the user get the correct answer. The user then clicks the corresponding numbers that animate into position and signal whether they are right or wrong. I have but in a next button ('.minibutton'), so that if the user gets the answer wrong 3 times they have a chance to move to the next question. The button also has a .trigger('click') function so that when a word is completed correctly it moves on automatically and keeps the game flowing. **My problem is the button has stopped working and I am clueless as to why**. Here is the ".minibutton" function... $('.minibutton').click(function() { var sum = $('#answerlist li[data-answer="' + answer + '"]').data('sum'); $(right).val(''); $(wrong).val(''); $('td').removeClass('spellanswer'); score.wrong = 0; var r = rndanswer; while (r == rndanswer) { rndanswer = Math.floor(Math.random() * (listOfanswers.length)); } for (var x = 0; x < listOfanswers.length; x++) { if (eval(sum.replace("=", "").replace("x", "*")) == listOfanswers[x].name) { rndanswer = x; } } $('td[data-answer="' + listOfanswers[rndanswer].name + '"]').addClass('spellanswer'); $('td[data-answer=' + answer + ']').removeClass('answerglow').removeClass('answerglow4').removeClass('answerglow3').css('color', 'transparent'); var noExist = $('td[data-answer=' + listOfanswers[rndanswer].name + ']').hasClass('answerglow2'); if (noExist) { $('.minibutton').prop('disabled', false); } else { $('.sumstyle').text(sum); sum.hide(); } }).trigger("click"); http://jsfiddle.net/ZAfVZ/28/
VIEWS ON THIS POST

71

Posted on:

Monday 19th November 2012
View Replies!

CDATA gets syntax error in IE

Guys, This code works just fine in Firefox, but surprise - surprise it breaks in IE. This is the section where it is saying that it is breaking: $('.addSort').click(function() { var inner = // Any thoughts I have tried adding single quotes and then it gives me the error: 'Unterminated String'. Here's the whole code: // REPORTS PAGE ADD SORT // ############################################# $('.addSort').click(function() { var inner = // Sort by: Choose... User Name First Name Last Name State Zip Country Tags Enrollment ID Status Sex Birth State Distant Learner Name City State Zip Terms Major Minor Goal Certificate Other Grad Date Attend Level GPA Year in School Scholarship Name Scholarship Number Status Updated Created Type Transcript Date Check Number Scholarship Number Scholarship Number ; //]]> inner = inner.toString(); $('#sort').append(inner); -- Greg
VIEWS ON THIS POST

104

Posted on:

Wednesday 21st November 2012
View Replies!

Select A Item From Listbox At The Time Textbox Will Be Enabled Using J

if we are going to select a item from list box after selecting it, textbox will be enabled using java script. suppose we didn't select any item means the textbox should be disabled any one can help me
VIEWS ON THIS POST

54

Posted on:

Wednesday 21st November 2012
View Replies!

Can't get to work

Somebody please help me. The page loads fine but when I change the option on select nothing happens. I'm sure it's just a small problem. Your help will go a long way. Thank you in advance. Easy Medium Hard var opt = document.getElementById("select"); var items = []; var ans = []; if(opt.value === "easy"){ items = [3,0,6,5,0,0,0,9,0,2,0,0,4,0,0,8,5,1,1,0,0,7,8,0,0,6,0,0,0,9,3,6,8,5,0,0,6,2,8,0,0,0,3,4,9,0,0,5,9,2,4,1,0,0,0,4,0,0,9,7,0,0,2,8,6,3,0,0,1,0,0,5,0,7,0,0,0,3,4,0,8]; ans = [3,8,6,5,1,2,7,9,4,2,9,7,4,3,6,8,5,1,1,5,4,7,8,9,2,6,3,4,1,9,3,6,8,5,2,7,6,2,8,1,7,5,3,4,9,7,3,5,9,2,4,1,8,6,5,4,1,8,9,7,6,3,2,8,6,3,2,4,1,9,7,5,9,7,2,6,5,3,4,1,8]; } else if (opt.value === "medium"){ items = [8,0,0,0,0,0,3,1,0,0,0,0,5,1,7,0,0,0,0,9,0,0,0,0,2,5,0,7,0,0,3,0,8,0,0,1,4,0,0,0,0,0,0,0,6,3,0,0,2,0,1,0,0,5,0,7,3,0,0,0,0,4,0,0,0,0,8,9,6,0,0,0,0,1,8,0,0,0,0,0,2]; ans = [8,6,5,4,2,9,3,1,7,2,3,4,5,1,7,6,8,9,1,9,7,6,8,3,2,5,4,7,5,9,3,6,8,4,2,1,4,2,1,9,7,5,8,3,6,3,8,6,2,4,1,7,9,5,6,7,3,1,5,2,9,4,8,5,4,2,8,9,6,1,7,3,9,1,8,7,3,4,5,6,2]; }else { items = [0,8,0,0,0,0,0,0,1,9,0,0,2,7,6,0,0,0,0,5,0,0,0,0,0,2,9,0,0,9,8,0,0,2,0,0,0,0,1,4,0,9,8,0,0,0,0,6,0,0,,5,3,0,0,7,3,0,0,0,0,0,6,0,0,0,0,9,3,8,0,0,2,2,0,0,0,0,0,0,4,0]; ans = [6,8,2,5,9,4,7,3,19,1,3,2,7,6,4,8,5,4,5,7,3,8,1,6,2,9,5,4,9,8,6,3,2,1,7,3,7,1,4,2,9,8,5,6,8,2,6,7,1,5,3,9,4,7,3,5,1,4,2,9,6,8,1,6,4,9,3,8,5,7,2,2,9,8,6,5,7,1,4,3]; } var ids = [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,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50, 51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81]; function doThis(){ for (var i = 0; i < items.length; i++) { var item = items[i]; var id = ids[i]; var element = document.getElementById(id).innerHTML = item; if (item === 0){ document.getElementById(id).innerHTML=""; document.getElementById(id).contentEditable = "true"; document.getElementById(id).style.backgroundColor = "yellow"; }//end of if }//end of for }//end of do this doThis(); function check(){ for (var i = 0; i < ids.length;i++){ var id = ids[i]; var answer = ans[i]; var myID = document.getElementById(id); if (myID.textContent != answer){ myID.style.backgroundColor = "red"; } } } Display Date
VIEWS ON THIS POST

133

Posted on:

Saturday 24th November 2012
View Replies!

Javascript Replace Thumbnail and Back Again

So.... Pretty strange thing is happening to me. I have a scrolling thumbnail marquee which on click pops up an image box div and replaces the thumbnail with a larger image, sets the src, then re-replaces the thumbnail. This works perfectly on my local machine but when uploaded to the website host the images just break. function Large(obj) { var imgbox=document.getElementById("imgbox"); imgbox.style.visibility='visible'; var img = document.createElement("img"); obj.src = obj.src.replace("Thumbnail", ""); img.src=obj.src; obj.src = obj.src.replace(".", "Thumbnail."); if(img.addEventListener){ img.addEventListener('mouseout',Out,false); } else { img.attachEvent('onmouseout',Out); } imgbox.innerHTML=''; imgbox.appendChild(img); } Not the greatest code in the world, but I am just at a loss because like I said it works perfectly on my local machine.
VIEWS ON THIS POST

63

Posted on:

Saturday 24th November 2012
View Replies!

Checking my understanding

I have been tasked to learn basic JavaScript as part of my collage coarse, and i've taken this section if code from the W3C website and commented it out. Is my interpretation of what this script is doing correct Im using this script as an example of how JavaScript can be used to validate information client side. Thank you for your time. Any additional info that can further my understanding is appreciated. //This tells the browser the following is JavaScript. function validate_email(field,alerttxt) //This defines the function. { with (field) { apos=value.indexOf("@"); //Tries to find the position of the value given. dotpos=value.lastIndexOf("."); //Tries to find the last occurrence of the value given. if (apos
VIEWS ON THIS POST

98

Posted on:

Saturday 24th November 2012
View Replies!

Remove URL from Bottom of Printed Web Page

How can I remove the URL information that is printed at the bottom of the page when a Web page is being printed Can this be done by Javascript or any programming method
VIEWS ON THIS POST

66

Posted on:

Sunday 25th November 2012
View Replies!

Best Drag/Drop Library? YUI3? jQuery?

I need to write an extensive online circuit design website with lots of drag/drop. What is the best JavaScript framework for drag/drop specifically Pete
VIEWS ON THIS POST

89

Posted on:

Sunday 25th November 2012
View Replies!

JS/Jquery Not getting previous value or current if?

Hi need some help here. I don't know why but it doesn't read the value. This is to be runned by Property. function calculate_form_opap(op_id,oca_id,ocp_id) { var propertiesintotal=0; var total=0; var completo=''; var completo_count = op_id+'_'+oca_id; propertiesintotal = Number(document.getElementById('propertiesintotal_'+op_id+'_'+oca_id).value); propertiesintotal=propertiesintotal-1; for (y=0; y
VIEWS ON THIS POST

83

Posted on:

Monday 26th November 2012
View Replies!

Javascript validation not working with form of multipart/form-data - JavaScript Help

Hi ,Been stuck for a few days with this scenario.Any helpThe alert box appears on an error.But the submitting won't stop.The details are submitted and the form is processed.Any help is greatly appreciated... tinyMCE.init({ // General options mode : "textareas", theme : "simple" }); function MM_openBrWindow(theURL,winName,features) { window.open(theURL,winName,features); } function err_check(){ var email = document.getElementById('to_email').value; if(email.length==0){ alert('Please Enter Email Address'); return false; } var AtPos = email.indexOf("@") var StopPos = email.lastIndexOf(".") if (AtPos == -1 || StopPos == -1) { alert("Please Enter Valid Email Address"); document.getElementById('email').focus(); return false; } email = document.getElementById('cc_email').value; if(email.length != 0){ var AtPos = email.indexOf("@") var StopPos = email.lastIndexOf(".") if (AtPos == -1 || StopPos == -1) { alert("Please Enter Valid Email Address"); document.getElementById('email').focus(); return false; } } var answer = confirm ("Send E-Mail"); if (!answer){ return false; } } body, table, td, th{ background-color:#CCCCCC; font-family: Arial; font-size:14px; } .que{ font-weight:bold; }
VIEWS ON THIS POST

69

Posted on:

Tuesday 27th November 2012
View Replies!

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

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

106

Posted on:

Friday 30th November 2012
View Replies!

Re: action url change on submit form

On May 23, 7:57 pm, "MZ" wrote: > Is it possible to change URL form action on submit form... function setFormAction(frm) { frm.action = "new_URL_goes_here"; return true; }
....
...

VIEWS ON THIS POST

103

Posted on:

Friday 30th November 2012
View Replies!

newbie: how to compare form input to variable value?

, In my form validation, I'm testing a form input field to see if it contains the same number as a variable contains. if the variable is called "match1", and my user text field is named "guess1" I'm trying to ...
VIEWS ON THIS POST

149

Posted on:

Friday 30th November 2012
View Replies!

SkimpyGimpy PNG canvas w/ Javascript mouse tracking

ANN: SkimpyGimpy PNG canvas has Javascript mouse tracking The SkimpyGimpy PNG image canvas now can generate Javascript data structures which allow HTML pages to intelligently respond to mouse events over the image. Please read about the SkimpyGimpy Canvas and look ...
VIEWS ON THIS POST

241

Posted on:

Friday 30th November 2012
View Replies!

Cross-Browser Element Bottom Position

I have no perfect cross-browser solution to position html element on the bottom of the page. I know that with Firefox I do it as: position:fixed; bottom:0px; However, IE does not understand that. Did anyone come across this issue to ...
VIEWS ON THIS POST

168

Posted on:

Friday 30th November 2012
View Replies!

Callbacks within function call? Is this possible?

I am working on a SCORM API interface using javascript and Ajax. I am just learning about closures, etc. The problem I am trying to solve is that SCORM specifies function calls without callbacks. So, to get data from the ...
VIEWS ON THIS POST

102

Posted on:

Friday 30th November 2012
View Replies!

JavaScript "objects" to extend HTML Elements

Hi! I create HTML pages on the server side. I want to extend DIV elements with more information. E.g.:
Now I want Joe to have an age for example and access it using: $('joe').age = 20; Doing ...

VIEWS ON THIS POST

182

Posted on:

Friday 30th November 2012
View Replies!

How to show/hide layer like ebay?

Hi , I am new to Jscript and need the layer function like ebay did http://pages.ebay.com/help/sell/fees.html There is a "optional Feature fees" which you can Show or Hide it . Anybody know how to make things like that
VIEWS ON THIS POST

96

Posted on:

Friday 30th November 2012
View Replies!

calling variable in onchange function

I am using a javafunction (onclick in select) in which i am calling a function in php (thats why i send this to both php and javascript newsgroups). in the onclick i call the function "Place_Selected" with the value from ...
VIEWS ON THIS POST

111

Posted on:

Friday 30th November 2012
View Replies!

jscript function call in c# application

I wrote a little application in c# and included the vsa i have a gui which allows dynamic scripting either of jscript or of vbscript. if i want to execute the written vbscript functions after initializing the engine i ...
VIEWS ON THIS POST

126

Posted on:

Friday 30th November 2012
View Replies!

showModalDialog

I have a Modal Dialog that open fine but when I close it using window.close() it open another window with same HlpEmp.Aspx and next and next. The only way I can close it is by clicking on x. I am ...
VIEWS ON THIS POST

139

Posted on:

Friday 30th November 2012
View Replies!

change button text field .

everybody i need help how can i make it user click join button->change the text "view" after that user click view btn goes another page any body plz help me. this code change text working fine. function showtext() { document.getElementById("joinbutton").childNodes[0].nodeValue="View in MyPlans" } Join
VIEWS ON THIS POST

242

Posted on:

Sunday 2nd December 2012
View Replies!

javascript function to display message

So i need to write or modify javascript code i think, for what i want to do. The web page im developing displays a table with two arrows beneath, one to go show next and one to show previous. I need the show previous arrow to display an alert box if the user selects it when the page is first loaded (they cant show previous because nothing has been shown yet). Again similar for the show next arrow, if the user selects it when the last name is displayed in the table then it should show a message saying no more names. I've no idea how to do this and it sounds like it should be easy. The code i have is: COM301 var studentNames = new Array ("Jack Dee", "Ruby Wax", "Billy Connolly", "Miranda Hart", "Al Murray"); var regNumbers = new Array ("10001", "10002", "10003", "10004", "10005"); var currentStudent = -1; function showNext() { currentStudent=currentStudent+1; document.getElementById("nameHolder").innerHTML=studentNames[currentStudent]; document.getElementById("regNumberHolder").innerHTML=regNumbers[currentStudent]; } function showPrevious() { currentStudent=currentStudent-1; document.getElementById("nameHolder").innerHTML=studentNames[currentStudent]; document.getElementById("regNumberHolder").innerHTML=regNumbers[currentStudent]; } COM301 Assessment 4 - Event-driven programming Useful Links Click here for Google Click here for BBC StudentName Registration Number A good place for a footer This is not homework or anything. I am a university student and trying to get my skills up to scratch before I start placement.
VIEWS ON THIS POST

129

Posted on:

Sunday 2nd December 2012
View Replies!

Writing JavaScript to HTML page

I want to output some Javascript onto a HTML page. I am trying to put the date that the page was last modified onto the bottom of the HTML page, using the document property 'lastmodified'. Currently my code looks like this: This page was last modified on: document.write(document.lastModified) I want to move this text to the right hand side of the page and I thought I could do that using a span class, however, it seems that this doesn't work. I suspect that I have to use 'getElementById()', if so, could someone explain to me how this works Thank for your help.
VIEWS ON THIS POST

145

Posted on:

Sunday 23rd December 2012
View Replies!

Problems with XML

I know this isn't about JS, but this was the closest topic. I've been learning how to do web pages on my own, so this isn't homework. What I want to do is store information (in this case products) in XML. Since I suck at explaining maybe it's better to show the code: if (window.XMLHttpRequest) { xmlhttp = new XMLHttpRequest(); } else { xmlhttp = new ActiveObject("Microsoft.XMLHTTP"); } xmlhttp.open("GET", "proto_tiedot.xml",false); xmlhttp.send(); xmlDoc = xmlhttp.responseXML; x = xmlDoc.getElementsByTagName("TUOTE"); function tuotteet() { for (i = 0; i < x.length; i++) { nimi = (x[i].getElementsByTagName("NIMI")[0].childNodes[0].nodeValue); lyhyttieto = (x[i].getElementsByTagName("LYHYTTIETO")[0].childNodes[0].nodeValue); hinta = (x[i].getElementsByTagName("HINTA")[0].childNodes[0].nodeValue); txt = nimi + lyhyttieto + hinta; document.getElementById("tuotteet").innerHTML=txt; } } This post has been edited by macosxnerd101: 03 November 2010 - 07:48 AM Reason for edit:: Added code tags.
VIEWS ON THIS POST

65

Posted on:

Sunday 23rd December 2012
View Replies!

how check if textbox id-img1 name=img1 containts an integer

this is called upon submit, how check if textbox id-img1 name=img1 containts an integer function checkNum() { if(typeof document.getElementById("img1").value =='number') { alert("Error: ALL cannot be blank and, must be integers Product IDs!"); return false; } return true; }
VIEWS ON THIS POST

76

Posted on:

Sunday 23rd December 2012
View Replies!

Possible To Disable Browser's Auto-Fill with Javascript?

So I have a simple form that crunches some numbers written in HTML and javascript, but if you're running repeated calculations, inputing the numbers and seeing the drop down auto-fill menu can be kind of annoying. Now I know that each user can disable this feature in their browser, but I was wondering if there was any trick to doing it in javascript. Is there any way I can stop the little auto-fill drop down from coming up no matter what browser or settings the user has Maybe there's some cache I can clear, so that the menu won't be populated. Any ideas
VIEWS ON THIS POST

81

Posted on:

Sunday 23rd December 2012
View Replies!

Who manages Javascript?

You know how php, java, mysql, they all have a project page and some sort of foundation that backs. Well who backs javascript I can never seem to find an official js site, one with all the classes/methods/properties, you can find what your looking for but i was wondering if there is some sort of foundation site to it.
VIEWS ON THIS POST

133

Posted on:

Sunday 23rd December 2012
View Replies!

jQuery minor help.

, I am currently working on my website, making a beta version. I've been stumped by what should be a small problem... If any! I've got a comment system, and if you're admin, it places a link under the comment, reading "delete comment", the actual link is; delete comment Now, I'll paste the function. function removeComment(t,id) { //AJAX TO REMOVE COMMENT var str = "#comment_" + id; $(str).fadeOut(); } Now.. That doesn't work. Where it reads "#comment_+id" that's a span tag which holds the comment. But, if I use; function removeComment(t,id) { //AJAX TO REMOVE COMMENT var str = "#comment_" + id; $(t).text("Removed"); } The link actually changes to "Removed", but the comment wont budge.. So, in all. The display is like so; [code] huzi8t9 wrote This is my comment - delete comment Any ideas Any help is appreciated!
VIEWS ON THIS POST

105

Posted on:

Monday 24th December 2012
View Replies!

javascript

hii alll I want date in textbox and for to display date i m using javascipt. how to calll javascript in textbox. or..... I have one more option I want this date to store in database...and i m just dispalying date so how date displaying using javascript can be stored in database (MySQL).
VIEWS ON THIS POST

104

Posted on:

Monday 24th December 2012
View Replies!

setTimeout "Invalid Argument" error

SEE EDIT (BELOW) Okay, I think this is something pretty simple, but I can't find it. I keep getting an "Invalid Argument" error with my setTimeout call, but I don't think there should be any problem with the way I am calling it: onerror=handleErr; var txt2=""; function handleErr(msg,url,l){ txt2="There was an error on this page.\n\n"; txt2+="Error: " + msg + "\n"; txt2+="URL: " + url + "\n"; txt2+="Line: " + l + "\n\n"; txt2+="Click OK to continue.\n\n"; alert(txt2); return true; } function tSlide(obj){ cHeight = obj.offsetHeight; complete = false; if(cHeight == obj.toHeight){ alert("Done"); complete = true; } if(cHeight < obj.toHeight){ obj.style.height = 1;//(cHeight+1)+'px'; } else if(cHeight > obj.toHeight){ obj.style.height = 1;//(cHeight-1)+'px'; } if(!complete){ setTimeout(tSlide(obj), 200); // line 28 } } This is a test var o = document.getElementById('t'); o.toHeight = 1; tSlide(o); The error is showing up on line 28 (marked with a comment). Any help is appreciated. Okay, I got rid of the error, but I have to send an ID, I don't want to have to deal with IDs as some things I use this function on may not have an ID. I would much rather use objects, but that seems to have problems. Here is the current version: onerror=handleErr; var txt2=""; function handleErr(msg,url,l){ txt2="There was an error on this page.\n\n"; txt2+="Error: " + msg + "\n"; txt2+="URL: " + url + "\n"; txt2+="Line: " + l + "\n\n"; txt2+="Click OK to continue.\n\n"; alert(txt2); return true; } function tSlide(obj){ obj = document.getElementById(obj); cHeight = obj.offsetHeight; complete = false; if(cHeight == obj.toHeight){ alert("Done"); complete = true; return; } if(cHeight < obj.toHeight){ obj.style.height = (cHeight+1)+'px'; } else if(cHeight > obj.toHeight){ obj.style.height = (cHeight-1)+'px'; } if(!complete){ setTimeout("tSlide('"+obj.id+"')", 200); } } This is a test var o = document.getElementById('t'); o.toHeight = 1; setTimeout("tSlide('t')", 2000); Now, if I try to use Objects: onerror=handleErr; var txt2=""; function handleErr(msg,url,l){ txt2="There was an error on this page.\n\n"; txt2+="Error: " + msg + "\n"; txt2+="URL: " + url + "\n"; txt2+="Line: " + l + "\n\n"; txt2+="Click OK to continue.\n\n"; alert(txt2); return true; } function tSlide(obj){ obj = document.getElementById(obj); cHeight = obj.offsetHeight; if(cHeight == obj.toHeight){ alert("Done"); return; } if(cHeight < obj.toHeight){ obj.style.height = (cHeight+1)+'px'; } else if(cHeight > obj.toHeight){ obj.style.height = (cHeight-1)+'px'; } if(!complete){ setTimeout("tSlide(obj)", 200); // throws an error "'obj' is undefined", which I believe means it is not a global variable // setTimeout(tSlide(obj), 200); // doesn't work either } } This is a test var o = document.getElementById('t'); o.toHeight = 1; setTimeout("tSlide(o)", 2000); // works Any thoughts
VIEWS ON THIS POST

61

Posted on:

Monday 24th December 2012
View Replies!

Basic Javascript Rollover

For some reason I cant get my rollovers to work on my web design here's the html http://halffull.free...rash/index.html THE Javascript window.onload = rolloverInit; function rolloverInit() { for (var i=0; i
VIEWS ON THIS POST

184

Posted on:

Monday 24th December 2012
View Replies!

javascript: void(0)

java script: void(0) every time i click on some page this error comes in !!! and the site never opens !! help please !!!!
VIEWS ON THIS POST

123

Posted on:

Monday 24th December 2012
View Replies!

Passing form values to new window

I'm trying to figure out how to pass selected values from a form to a page (both pages are ASP) in a new window via the URL. My form uses radio buttons as a means to make a selection: Option1 Option2 Option3 Option4 So that my URL would look something like this: http://www.mywebsite...t.aspu_input=A Any ideas on how to do this
VIEWS ON THIS POST

215

Posted on:

Monday 24th December 2012
View Replies!

problem with document.form.submit

The following code must call MaPage.php and post to it the variable _strUserId when the user click on "click here" text. form and post works just fine with a submit button. javascript works very well (it can open a new window for example). but document.form1.submit() doesnt seem to work in the following code. when a user click on the text, nothing happens and the status bar mark: "error on page" Any ideas how to make this code to work
VIEWS ON THIS POST

121

Posted on:

Monday 24th December 2012
View Replies!

I Have Textarea Form, I Want To Add Drop Down List Box Beside It,like Prefix In Forum - JavaScript Help

Hi i have comment form code (in black colour) below, user type the comment in TEXTAREA, and click the Submit button i want to add DROP DOWN LIST BOX before it, that user can choose, and add that DROP DOWN value with the text in TEXTAREA into database, so just like prefix in forum i already tried below code (in red), but still not working, please help what is the right code Quote \t\t\t \t $(document).ready(function(){ \t\t$("#form_submit").click(function() { \t\tdocument.getElementById("form_submit").disabled = true;\t\t \t\tcheckcomment = trim(document.comment_form.message.value); \t\tif (checkcomment.length > 0) { \t\tvar msgPrefix = document.forms["comment_form"].elements["message_prefix"].options[document.forms["comment_form"].elements["message_prefix"].selectedIndex].value;\t \t \t \t\tvalue = "["+msgPrefix+"] "+value; \t\tcomment_submit(); \t\t} \t\telse { \t\talert("Please type some text"); \t\t} \t\tdocument.getElementById("form_submit").disabled = false;\t\t \t\t}); \t\t \t\tfunction comment_done() {\t} \t\tfunction comment_submit() \t\t{ \t\t\t\t$.ajax({ \t\t\t\t\t\ttype: "POST", \t\t\t\t\t\turl: "/targetfile.php", \t\t\t\t\t\tdata: $("#comment_form").serialize(), \t\t\t\t\t\tsuccess: function(data){ \t\t\t\t\t\t\t\tif (data == "SUCCESS") { \t\t\t\t\t\t\t\t\t\t//alert("Successful"); \t\t\t\t\t\t\t\t\t\tdocument.comment_form.message.value = ""; \t\t\t\t\t\t\t\t\t\tsetTimeout (CommentAjax,0); \t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t\t\telse { \t\t\t\t\t\t\t\t\t\talert("Error: "+data); \t\t\t\t\t\t\t\t\t\t} \t\t\t\t\t\t} \t\t\t\t}); \t\t} \t\t }); \t\t\t\t\t\t \t\t \t\t \t\t \t\t \t\t \t\t \t\t \t\t\t\t\t\tOne \t\tTwo \t\tThree \t\t \t\t \t\t\t\t \t\t\t\t\t\t\t\t\t\t \t\t \t\t
VIEWS ON THIS POST

53

Posted on:

Friday 28th December 2012
View Replies!

Get correct row from an array? - JavaScript Help

I have an array which carries id's + 4 numbers assigned to each id.I'm trying to find a way to use if statement to get the correct id by checking which of the 4 numbers goes with the check.This is the structure: var listObj = { id: uid, data: [ abposx, abposy, width, height ] }; So lets say im trying to find the "id" which greater than the width & height and its abposx and abposy and greater than what im checking...The issue is how do i get the id from such a check =/ its confusing
VIEWS ON THIS POST

90

Posted on:

Friday 28th December 2012
View Replies!

String replacement of file.name - JavaScript Help

Greetings,I am barely literate in Javascript, but I have done my best to try figuring this out on my own. I am playing with a Drag & Drop uploading script for HTML 5 that i found here: http://www.sitepoint...-drag-and-drop/I have been able to get the script 95% set up to allow uploads, but it has a problem parsing when it comes to dealing with white space. If an uploaded file has spaces in the name, the name output stops at the first whitespace.As I said above, i have gone through many blogs and posts in the past several hours trying to figure the best way to do a string replace, but my ignorance of JS limits me on how to find the proper place for this. However, I think it has to belong in here: // Output link Output( "" + file.name + "" );/* filedrag.js - HTML5 File Drag & Drop demonstration Featured on SitePoint.com Developed by Craig Buckler (@craigbuckler) of OptimalWorks.net */ (function() { // getElementById function $id(id) { return document.getElementById(id); } // output information function Output(msg) { var m = $id("messages"); m.innerHTML = msg + m.innerHTML; } // file drag hover function FileDragHover(e) { e.stopPropagation(); e.preventDefault(); e.target.className = (e.type == "dragover" "hover" : ""); } // file selection function FileSelectHandler(e) { // cancel event and hover styling FileDragHover(e); // fetch FileList object var files = e.target.files || e.dataTransfer.files; // process all File objects for (var i = 0, f; f = files[i]; i++) { ParseFile(f); UploadFile(f); } } // output file information function ParseFile(file) {} // upload .Torrent files function UploadFile(file) { // following line is not necessary: prevents running on SitePoint servers if (location.host.indexOf("sitepointstatic") >= 0) return var xhr = new XMLHttpRequest(); if (xhr.upload && file.type == "application/x-bittorrent" && file.size
VIEWS ON THIS POST

185

Posted on:

Friday 28th December 2012
View Replies!

No idea what this is classed as! - JavaScript Help

,I'm not entirely sure what this even entails as i've practically never used any form of Javascript in my life, so hoping you here can shed some light on the situation!Basically i have 2 scripts:http://www.habbcrazy...#goodies/badgesThis one basically checks the inputted username against another webpage, detects what badges are displayed on the badges widget, and outputs them as images back on the original page. So take if you typed ashley,bbz in the box on the link for example (random user who i stumbled across). It would grab all the images displayed under the 'Badges and Achievements' section of http://www.habbo.com/home/ashley%2Cbbz and then display those images on the original page. Sorry if i havent described that so well.. But thats basically what im trying to achieve!Also,There is a script at:http://habbox.com/ca...ineupgenerator/Which i am trying to replicate. It basically takes all the images located at 'http://habbox.com/ca...nerator/images/' combines them, and adds the user's inputted text to an image, and extends longer the more users that are entered. Fiddle around with it and you'll see what i mean!I want to take this opportunity to say i've never played Habbo, neither do i have an interest in it. Im just trying to help out a friend!
VIEWS ON THIS POST

72

Posted on:

Friday 28th December 2012
View Replies!

simple jquery conditional response-to-comment form display - JavaScript Help

I am looking to compare the data-commentid attribute process in javascript after user slideToglle function. I want to compare that value attribute in each interaction with $id variable within the php. if $id = commentid data attribute in the span tag then display the response. I am not sure whether to do the comparison in php or javascript. an example or idea is if(after slideToggle, write a response, submit the form with the response then compare $id == $idc) that would be the sequence. if $id == $idc then display the response and only then.Any idea code I have so far is as below. ' . $ufirstname . ' • ' . $message_date . ' hi how you doing today id=101
VIEWS ON THIS POST

140

Posted on:

Friday 28th December 2012
View Replies!

.js file help - JavaScript Help

In the head tags of my page is have this..and at the moment I am putting all the my Javascript in that file, but that file is now becoming seriously long, and harder to read, is there a way to split the file up into many different files, to make it easier to understand and read. I have tried putting two script tags like this, but this did not seem to work. What can I do to make it easier for myself
VIEWS ON THIS POST

72

Posted on:

Tuesday 1st January 2013
View Replies!

Javascript url help - JavaScript Help

I have this small javascript that works with Internet explorer but wont work on firefox or chrome browsers. Can someone suggest an alternative function go(loc) { window.location.href = loc; }
VIEWS ON THIS POST

74

Posted on:

Tuesday 1st January 2013
View Replies!

set if statement for mousedown - JavaScript Help

,My question is, is it possible to create an if statement for div.onmousedown that will then excute document.onmousemove call function. var div = document.getElementById('div'); document.onmousedown = eventHandler(); function eventHandler(){ if(div.onmousedown){ document.onmousemove = moveFunction(); } } The reason I ask this is that i have a script that moves a div in a certain area and need the div to move even if the mouse is not inside it. This mouse down function is not the only one so i need something that can work with multiple mouse functions depending on wat one wat clicked etc
VIEWS ON THIS POST

129

Posted on:

Tuesday 1st January 2013
View Replies!

new to jQuery, tips on what to start with - JavaScript Help

i've recently read a bit about jQuery, and started to write some code today, this is what i came up with so far: $("#mydiv").click(function() { if($(".myclass").is(":hidden")) { $(".myclass").slideDown("slow"); } else { $(".myclass").slideUp("slow"); } });superbasic stuff that slides down a on click.well, i'd love some tips on what to do next, something not to advanced and maybe even some pointers on what to look at to get the script done.
VIEWS ON THIS POST

101

Posted on:

Wednesday 2nd January 2013
View Replies!

Menu Bar - JavaScript Help

im using a script i found online to generate a menu bar and it works great except for every time you navigate to a different page it shows the menu as the unordered list before anything else loads and i was wondering how to stop this from happening
VIEWS ON THIS POST

241

Posted on:

Wednesday 2nd January 2013
View Replies!

[jquery] how to modify code to function - JavaScript Help

jQuery(function($) { $('.__').click(function() { $('._').toggle(); }); $('.comment___').click(function() { $('._').show(); $('#comment__').focus(); }); });please leave the variables (I've purposely left them, because its the problem)function(id.......
VIEWS ON THIS POST

88

Posted on:

Wednesday 2nd January 2013
View Replies!

Passing three textbox values to a javascript function - JavaScript Help

In this code i want to pass all the three red color code textbox value to a javascript function and print there.
VIEWS ON THIS POST

75

Posted on:

Wednesday 2nd January 2013
View Replies!

line of jquery REGEX, need to allow lowercase as well as uppercase - JavaScript Help

hey,im no good with js. i have this line which is from position-absolute's jquery validator. $.validationEngineLanguage.allRules["postcodeUK"] = { // UK zip codes "regex": /^([A-PR-UWYZ0-9][A-HK-Y0-9][AEHMNPRTVXY0-9][ABEHMNPRVWXY0-9] {1,2}[0-9][ABD-HJLN-UW-Z]{2}|GIR 0AA)$/, "alertText": "* Invalid postcode, please use capital letters and a space." }; currently it only accepts, as you can see, caps, how do i allow lower case toothis doesnt work, any ideas $.validationEngineLanguage.allRules["postcodeUK"] = { // UK zip codes "regex": /^([Aa-PpRr-UuWwYyZz0-9][Aa-HhKk-Yy0-9][AaEeHhMmNnPpRrTtVvXxYt0-9][AaBbEeHhMmNnPpRrVvWwXxYy0-9] {1,2}[0-9][AaBbDd-HhJjLlNn-UuWw-Zz]{2}|GgIiRr 0AaAa)$/, "alertText": "* Invalid postcode, please use capital letters and a space." };
VIEWS ON THIS POST

112

Posted on:

Wednesday 2nd January 2013
View Replies!

multiple div refresh - JavaScript Help

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

107

Posted on:

Wednesday 2nd January 2013
View Replies!

PHP, HTML and Javascript problem with Select drop down - JavaScript Help

Hi.Sorry if I'm posting in the wrong forum. My problem spans all three types.I'm working as an intern at a web development company and am trying to create a select box to contribute to filtering a table by country based on the country selected, but without submitting, so I guess I need a bit of javascript to do this.I have a drop down menu that is pulling information from a spreadsheet (created by the company).I have that working, but now what I want to do is pull the value of the currently selected item (country) out and place it in a variable so that I can run a compare with all of the current 'user' countries that match the selected country.I apologise if I sound a little confusing. It's really a simple thing I'm trying to do but because I want to do it in real-time I don't want to use a submit and a $Get to get the value passed. I then want to compare the value obtained with an already existing PHP variable(s).I'm afraid I don't have the code as I couldn't take it home.It looks something like this:I've used open and closing tags because it makes it easier for me to read instead of using quotation marks and echo's all over the place, sorry if this is bad practice, I hope it's readable. $countries = array(country pulling method) blah blah... foreach($countries as $value) {
VIEWS ON THIS POST

39

Posted on:

Wednesday 2nd January 2013
View Replies!