JavaScript - I Need A Quick Hand...trying To Make An Adjustment
Hello,
I'm not sure what to call it. The only way to describe it is a 'window frame'. I need to increase the size. I've been waiting for days to get any kind of response from the theme developers, ElegantThemes.com. If you look at http://www.woodstock2012.com and you click something from the menu a window opens that is very small that has big borders and heavy padding around it. I need to increase the size of this and adjust some margins and padding. Can anyone give me a hand? I sure would appreciate it. This is the code in my custom.js file...the file the admin told me to adjust. Which I did and it didn't work. This is the original code: He said simply, adjust this code... Code: $et_main_content.css( { top : '77px', width : '800px', height : ( et_window_height - 200 ), marginTop : 0, marginLeft : '-400px' } ).removeClass(); I found this code twice in the file: Code: $et_main_content.css( { top : '77px', width : '900px', height : ( et_window_height - 200 ), marginTop : 0, marginLeft : '-400px' }, and I also found this once: Code: $et_main_content.animate( { top : '77px', width : '800px', height : ( et_window_height - 200 ), marginTop : 0, marginLeft : '-400px' }, I change them to: Code: $et_main_content.css( { top : '27px', width : '900px', height : ( et_window_height - 200 ), marginTop : 0, marginLeft : '-450px' }, and Code: $et_main_content.animate( { top : '27px', width : '900px', height : ( et_window_height - 200 ), marginTop : 0, marginLeft : '-450px' }, The results for this change are as such...if I click to a page from the main 'drop in' menu the page loads wide but the minute I use an arrow to change pages or click a page from the menu at the bottom of the page the size reverts back to the 800px. It doesn't lose the margin change from -400px to -450px but it does lose the width. I also need to know how to make it taller and reach closer to the bottom menu and the content slider needs to be adjusted also. I've attached the full js file. If anyone can help me out here I sure would appreciate it. Thank you in advance. Doug Similar Tutorialshi, I am trying to adjust the script for one of the raster effects in scriptographer (a plugin for illustrator). It uses javascript and I realise from searching this forum that members here are mainly versed in web-based scripts so may not be able to help me but if anyone can even hazzard a guess - that would be most appreciated. The script takes a group of items (any basic shapes you draw in illustrator, i.e. a square, circle, etc) that you specify, and, using a rasta image that you specify (eg. a pixel based image), it creates a half-tone image out of the items. it does this by placing copies (clones) of the items in a corresponding possition to each of the image pixels and depending on the lightness of the pixel, it will vary the size of the item (so a dark pixel will have a large item and a light pixel will have a small item). It also gives the choice of rotating the items depending on the same perameters. The problem I have with it is that it places the items, in possition for each pixel, randomly - whereas I want them to be placed in order. Here is the code: Code: include('Raster.js'); function createDot(x, y, dots, radius) { if (radius > 0) { // Pick a dot at random: var item = dots[Math.floor(dots.length * Math.random())].clone(); item.position += new Point(x, y) * values.size; item.rotate(radius * values.rotation * Math.PI / 180.0, item.position); item.scale((radius * radius * values.gradiation + radius * (1.0 - values.gradiation)) * values.scale); return item; } } if (initRaster()) { var components = { size: { value: 10, label: 'Grid Size'} , scale: { value: 100, label: 'Object Scale (%)'}, gradiation: { value: 0.5, label: 'Gradiation'}, rotation: { value: 360.0, label: 'Rotation'} }; var values = Dialog.prompt('Enter Raster Values:', components); if (values) { values.scale /= 100; executeRaster(createDot, true); } } it looks to me that it is this line: Code: var item = dots[Math.floor(dots.length * Math.random())].clone(); that is doing the random placement but I can't figure out how to dissable it. if I delete the line then it doesn't run. The above coding is like an extension to another set of coding which is the main script for doing rasta effects. That coding is: Code: // Raster.js is a base script for all the raster scripts // that take a selection of a raster and a path object // as a starting point for some raster processing // the only thing that has to be defined is the drawDot // function var raster = null, dots = [], pixelCount; Item.prototype.getCompoundArea = function(area) { if (!area) area = 0; if (this instanceof Path) return area + this.area; else if (this instanceof CompoundPath || this instanceof Group) { var child = this.firstChild; while (child) { area = child.getCompoundArea(area); child = child.nextSibling; } } return area; }; function initRaster() { var error = false; if (!document) { Dialog.alert('Please open a document first.'); return false; } var rasters = document.getItems({ type: [Raster, PlacedFile], selected: true }); for (var i = 0, l = rasters.length; i < l; i++) { rasters[i].selected = false; } var sel = document.selectedItems; if (rasters.length) { raster = rasters.first; if (raster instanceof PlacedFile && !raster.eps) { // Embed placed images so the raster script can access pixels raster = raster.embed(false); } for (var i = 0; i < sel.length; i++) { var obj = sel[i]; if (!obj.isAncestor(raster)) dots.push(obj); } } if (!raster || !dots.length) { Dialog.alert('Please select both a raster item\nand a graphic item.'); return false; } else { pixelCount = raster.height * raster.width; var sure = true; if (pixelCount > 20000) { script.showProgress = false; sure = Dialog.confirm('The image you\'re about to rasterize contains ' + pixelCount + ' pixels.\nRasterizing could take a long time.\nAre you sure you want to proceed?'); script.showProgress = true; } return sure; } } function executeRaster(createDot, multiple) { document.deselectAll(); var group = new Group(); for (var i = 0; i < dots.length; i++) { // Create a copy of each dot that is moved to the origin so // rasters that scale the dot are simple to realize: var dot = dots[i] = dots[i].clone(); var origin = dot.bounds.center; dot.position -= origin; // Scale multiple dots to the same blackness as the first one if (multiple && i > 0) dot.scale(Math.sqrt(Math.abs(dots[0].getCompoundArea()) / Math.abs(dot.getCompoundArea()))); } for (var y = 0; y < raster.height; y++) { for (var x = 0; x < raster.width; x++) { illustrator.updateProgress(y * raster.width + x + 1, pixelCount); var radius = raster.getPixel(x, y).gray; var obj = createDot(x, y, multiple ? dots : dots[0], radius); if (obj) { obj.position += origin; group.appendTop(obj); } } document.redraw(); } for (var i = 0; i < dots.length; i++) dots[i].remove(); return group; } any ideas? Got a quick question, I need to adjust the below code, so that when a question is open and you click on different question it automatically hides the question you opened first. How would I do that? Code: <!doctype html> <html> <head> <title>TEST TEMPLATE</title> <script type="text/javascript"> function showHide(id) { var div = document.getElementById(id); div.style.display = ( div.style.display == "none") ? "block" : "none"; } </script> </head> <body> <!------ QUESTIONS ------> <p>Change lines <li> to divs or whatever</p> <li onclick="showHide('FAQ1')">FAQ one</li> <li onclick="showHide('FAQ2')">FAQ two</li> <li onclick="showHide('FAQ3')">FAQ three</li> <!------ ANSWERS ------> <div id="FAQ1" style="display:none;"><p>Ans one</p></div> <div id="FAQ2" style="display:none;"><p>Ans two</p></div> <div id="FAQ3" style="display:none;"><p>Ans three etc etc.</p></div> </body> </html> Thanks, Jon Hi, ok i been playing around with this for awhile now http://www.dynamicdrive.com/dynamici...iframessi2.htm could not get it to work, so i tried several others and still nada, i finally ran across http://www.codingforums.com/archive/.../t-224293.html and i worked with what old pendent had done. The result is that i got some good results, closer to what i wanted but i need to do it multiple times. It works for one but not the other. i thought about putting each iframe on a sep html page and then using two sep tables and doing a SS include. but there has to be a better way. what im doing is i have an amazon iframe and a shopzilla iframe for the same product search and i want them posted one under the other iframe iframe and expand as the size needs, alowing for either to be longer or shorter when needed. i can do one but i have not found a way to do both yet. i removed my code because it showed my personal affiliate info in the code, since i cant give you an example without showing the code i guess ill just use the auto scroll and live with it... thanks Hello good coders! Thanks to the wonderful script provided by coothead he http://www.codingforums.com/showthread.php?t=87036 I was wondering how I could adjust the transition/fade speed between the images in the script? I tried a couple of different ways, but I couldn't get it working. Does anyone know how I can adjust this in a cross-browser compatible way? Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>multiple image maps</title> <base href="http://coothead.homestead.com/files/"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <style type="text/css"> /*<![CDATA[*/ #mapImage_holder { text-align:center; } #mapImage { border:1px solid #000; } /*//]]>*/ </style> <script type="text/javascript"> //<![CDATA[ var maps=new Array(); maps[0]='dots.gif,#dots'; maps[1]='map.jpg,#blood'; maps[2]='apple0.jpg,#apples'; var c=0; var speed=1000*10; //set for 10 secs, change to suit needs. function swapMap() { obj=document.getElementById('mapImage'); if(c==maps.length) { c=0; } obj.src=maps[c].split(',')[0]; obj.useMap=maps[c].split(',')[1]; c++; setTimeout('swapMap()',speed); } window.onload=swapMap; //]]> </script> </head> <body> <div id="mapImage_holder"> <img id="mapImage" src="dots.gif" alt="" usemap="#dots"/> </div> <div> <map id="dots" name="dots"> <area coords="85,40,110,65" href="http://www.bbc.co.uk" alt="" /> <area coords="225,100,250,125" href="http://www.itv.com/" alt=""/> <area coords="345,140,370,165" href="http://www.channel4.com/" alt=""/> <area coords="405,270,430,295" href="http://www.guardian.co.uk/" alt=""/> <area coords="35,290,60,315" href="http://www.independent.co.uk/" alt=""/> <area coords="605,460,630,485" href="http://www.thesun.co.uk/" alt=""/> </map> <map id="blood" name="blood"> <area coords="40,144,80,171" href="http://www.codingforums.com/" alt="" /> <area coords="112,144,152,171" href="http://www.w3schools.com/" alt="" /> <area coords="184,144,224,171" href="http://w3c.org/" alt="" /> <area coords="256,144,296,171" href="http://www.alistapart.com/" alt=""/> </map> <map id="apples" name="apples"> <area coords="0,0,116,146" href="http://www.axialis.com/" alt=""/> <area coords="124,0,236,146" href="http://www.photoshopsupport.com/" alt=""/> <area coords="244,0,360,146" href="http://www.photoshopuser.com/" alt=""/> <area coords="0,154,116,280" href="http://www.planetphotoshop.com/" alt=""/> <area coords="124,154,236,280" href="http://www.photoshopcafe.com/" alt=""/> <area coords="244,154,360,280" href="http://www.mozilla.com/" alt=""/> </map> </div> </body> </html> THIS IS NOT HOMEWORK Hi all, I'm trying to extract a URL from a string that may or may not have extra characters before and/or after the URL. I'm having a heck of a time making the regex work... when it works for one case it fails for another and I'm just not seeing why. OK, here is the code: Code: var str = 'leading junk http://h71036.www7.hp.com/hho/images/Outdoor_scene.jpg trailing junk'; var txt = str.replace(/^\s?((https?|ssh|ftp|mailto|file|www):\/\/.*?)\s?$/gi,'href:\n1 is $1\n2 is $2\n3 is $3'); alert(txt); (eventually the replacement string will be <a href="$1">$1</a> of course) What I want is of course to extract "http://h71036.www7.hp.com/hho/images/Outdoor_scene.jpg" out of the string whether of not there is leading and/or trailing "junk" around the string. Any ideas? I'm stumped... Thanks! -- Roger Hello, I am trying to create an input box with a submit button as following: - when any random text is entered in the box, upon submit, a new page should open, based on the text entered: for example: if 'test' is entered ... the new page that opens should be 'test.html' if 'monday' is entered ... the new page that opens should be 'monday.html' Thanks in advance Hi, I've been working at a website for quite some time now, one for my portfolio that displays my graphics design talents. However when coding this website I've run into quite a few problems. The most concerning being the photo gallery I am trying to set up inside of my website. I believe the problem I have is that I have two conflicting scripts, (in which case, how do I 'unconflict' them?) I have a sliding image header and I am using lightbox to create my gallery. While the slider works, my images only work as normal links rather than popping up on the screen. If you have any idea on how to fix this, please let me know. I am also open to other possibilities for a photo gallery. I've got the following html code for a button - how can I get the cursor to turn into the hand shape when the mouse is over the button? Thanks PHP Code: <INPUT NAME="btn_cancel" TYPE="button" VALUE="Cancel" onClick="cancel_button_click()";> The suspect line is the following $('.leaveClan').attr('id') = <?php echo $id; ?>; the span with the class (there is only one) leaveClan is on the main page, and that line of javascript is on a page being called by AJAX within that page. Can anyone see why that is causing an error? Let me know if you need to see any more of the code Hi, I have written a function to compare each character in startString with another nominated character (nomChar). If they are the same this character is written to outputString, in the same position. If they are not the same a character is lifted from the same position in altString and placed in the same position in outputString instead. I hope that's clear! Code as follows: Code: function compareChar(startString, altString, nomChar) { var outputString = ''; outputString.length = startString.length; var nextLetter = ''; for (var count = 0; count < startString.length; count = count + 1) { nextLetter = startString.charAt(count); if (nextLetter == nomChar) { outputString.charAt(count) = nextLetter; } else { outputString.charAt(count) = altString.charAt(count); } } } document.write(compareChar('boston', 'denver' , 'o' ) ); However, the line of code within the if statement Code: outputString.charAt(count) = nextLetter; keeps generating an 'Invalid assigment left hand side' error message. Can anyone see why this is the case? Thanks. Using onclick=window.open function in js to open a pdf file link in a new popup window. Works fine to display the file onscreen, but not if the user wants to save the file client-side to their computer. The right-hand-button context menu for the mouse will allow the user to download, but the file saved will be a html dump file for the webpage and the name of the file will be that for the webpage. Of course I can use the easy <a href> method for download links and the mouse context menu options will be as expected, but I can only use target="-blank" or target="_self" . I need a popup window to open. Could use : oncontextmenu="alert('Left click the link to open, and then SAVE from with the pdf viewer') to advise users how to save the file, and could use "javascript: void(0)" to eliminate most mouse context menu options, so the user won't bother try. So how can I get a link to a file which can be viewed in a popup window and downloaded using mouse right-hand context menu? Any advice massively appreciated! Ok, this might sound stupid but I swear, it's about to drive me crazy. how does one check whether or not a javascript "global" variable is undefined that will work with IE? I've tried each variation of code and checked countless forums: Code: if (saved == undefined || saved == null) { alert('saved'); saved = new Array(); } returns no error and nothing happens Code: if (saved == 'undefined') { alert('saved'); saved = new Array(); } -- returns error = saved is null or not an object Code: if (typeof(saved) == undefined) { alert('saved'); saved = new Array(); } returns same as above help me please, I'm confused more then anything. the link is also: http://doodlekins.hcents.com/designer Basically the if statement isn't returning true and nothing on the inside of it is ever happening. Hey guys, I am very VERY new to javascript and while trying to do some simple validating I got stuck and am in a complete loss. Heres my code: Code: <html> <head> <title>Tareas | Numero 4</title> <link rel="stylesheet" type="text/css" href="style.css" /> <script language="javascript" type="text/javascript"> function verify() { total = "Te faltaron los siguientes Campos por llenar: \n"; nombre = document.getElementById("txtnombre"); if (nombre.value == "") { total = total + "\nnombre"; } apellido = document.getElementById("txtapellido"); if (apellido.value == "") { total = total + "\napellido"; } if (total == "Te faltaron los siguientes Campos por llenar: \n") { return true; { else { alert(total); return false; } } </script> </head> <body> <center><h3>Formulario de registracion</h3></center> <div id="formulario_overall"> <form method="post" onsubmit="return verify();" action="/"> <div id="formulario_left"> Nomb <br /> <br /> Apellido: <br /> <br /> Clave: <br /> <br /> Confirmacion de Clave: <br /> <br /> Edad: </br> <br /> <br /> Sexo: </br> <br /> Ciudad: </br> <br /> </div> <div id="formulario_right"> <input type="text" name="nombre" id="txtnombre" /> <br /> <br /> <input type="text" name="apellido" id="txtapellido" /> <br /> <br /> <input type="password" name="p_1" id="p1" /> <br /> <br /> <input type="password" name="p_2" id="p2" /> <br /> <br /> <input type="text" name="age" id="age" /> <br /> <br /> <input type="radio" name="sex" id="sex" /> Femenino<br /> <input type="radio" name="sex" id="sex" /> Masculino<br /> <input type="text" name="city" id="city" /> <br /> <br /> </div> <div id="formulario_bottom"> Terminos De Uso: <textarea rows = "4" cols = "37" readonly="readonly"> Accepto que voy a darle +20 puntos a Daniel Martinez. Accepto que voy a darle +20 puntos a Daniel Martinez. Accepto que voy a darle +20 puntos a Daniel Martinez. Accepto que voy a darle +20 puntos a Daniel Martinez. </textarea><br /> <div><input type="radio" name="terms"> Accepto <input type="radio" name="terms" /> No Accepto</div> <br /> <center><input type="submit" value="Submit" /> <input type="reset" value="Limpiar" /></center> </form> </div> </div> </body> </html> Hope you guys can help me out :/ I just feel like I am doing something totally wrong. ok so im making a runescape private server and i have all the files and i compile and i only get 1 error. witch is the following. http://imageshack.us/content_round.p...upload&newlp=1 can anyone help me out pleasE? Hi all, This is a quickie. I'm a JavaScript newbie. I have had a crack programming with it but I need some questions answered to help my understanding. Please tell me the convention that governs the use of "" and '', because so many articles that I am finding in my learning journey are using them interchangeably and it is so confusing. For instance, but not limited to, take the id and value tags of an <input type=... of whatever. Is it best to use '' or "" for the labels you give? What is the convention governing the use of a ; (semicolon) because so many people use one where others do not. I'm under the impression it is an EOL terminator like in Bash, right? So it goes after declaring variables or after something within an if statement perhaps? Thanks QF I am new to java and tried writing the code for practice but it doesn't seem to work <html> <Head> <title>Discount</title> <script language ="Javascript"> <!-- function CalculateBalance(numItems,totPrice,discount) { var balance; balance = (1 - discount)*totPRice; alert ('Your balance is $'+balance +' Thank You.'); document.write("<br>YOu bought "+ numItems+" items for $"+totPrice); document.write("<br>Your balance is $"+ balance+" your discount was"+discount*100+"% Thank you"); } //--> </script> </head> <script language ="Javascript"> <!-- var discount; var numItems = parseInt(prompt('HOw many time did you buy [ >=12 is 20% and >= 6 is 10% discount]',"0")); alert ('You bought '+numItems +' items.'); document.write("You bought "+ numItems+" items."); var totPrice = parseFloat(prompt('The total price that you paid was',"0.0")); if(numItems >= 12) {discount = .2;} else if (numItems >=6) {discount+ .1} else {discount = 0;} CalculateBalance(numItems,totPrice,discount); //--> </script> </html> It only prints to the screen the number of items I bought I tried posting this: <button type="button" onclick="JavaScript:alert('Let's assume.....')"> <img src="question.jpg" alt="Click here" /> <br />Click for Answer!</button> and it shows the button with the picture, but I am unable to click it. Can you please help me? Thank you in advance. Don't even know where to post this as I have never thought about it; I've just made my game have a image upload script in, and a album showing the users images. How could I make have a link saying "Copy Link" that if clicked will copy the picture url to clip board. I've seen places like w3schools use in but not as tuts though. Please this will really help, desplayin the link is ugly EDIT: I've found the following code but I don't understand how I turn it into a link or button. Code: <script> window.clipboardData.setData('text','This has been copied to your clipboard.'); </script> Urghh I've always done it this way but it's nagging me. Is there a better way of checking if a value is equal to 1 or 2 or 3 than doing it this way. Code: if(var === Cat || var === Dog || var === Chicken || var === Frog) Not working code ^ lol Cheers guys I know that global variables are properties of the window object... so does that mean that local variables are properties of the function they belong to? And does that mean that functions are methods of the window object and that nested functions are methods of the function they belong to?
|