JavaScript - Looking For Help With Photoshop Javascript (changing Variables))
Hi,
I'm very new to using javascript to program Photoshop, and was looking for some help with changing the variables in an action. The basic end result I'm looking for (in laymens terms) is: Set variables Perform action Change variables (iteratively, ie a=a+1) Repeat until condition met (ie, after 100 iterations, the script would end). I used a script that converts Photoshop actions to Javascript, so I have this as a base: Code: function step1(enabled, withDialog) { if (enabled != undefined && !enabled) return; var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO); var desc1 = new ActionDescriptor(); desc1.putInteger(cTID('0001'), 215 ); desc1.putInteger(cTID('0002'), 172 ); etc etc (goes through many other variables) executeAction(sTID('Flaming Pear'), desc1, I've put the properties that would need to become variables in red. I have edited out a bunch of lines in this post as these seem to be the significant ones in terms of what I need to do (obviously keeping them in the script itself!). Other than that I think that's all I need to know for now - just that little thing would enhance my workflow no end. Also, I'm a graphic designer so if anyone would be interested in doing some skillshare or work swap - I'd be happy to provide help and service with graphics in exchange for small tidbits about javascript. Cheers, Jonathan Similar TutorialsI have a folder with a lot of subfolders, each with a bunch of TIFs and PSD files inside. Some of these have transparency in them while some don't. These files vary massively in size. I need all the files to be turned into JPGs, or if they contain transparency, PNGs. I require the files to be 200kb or less and don't really mind how large they are as long as they aren't scaled up. Someone on a forum (who I'm insanely thankful for) wrote a fair bit of code for it, which my friend modified to suit exactly what I was asking and we're nearly there now. It worked fine, the only problem being that a lot of images came out 1x1 pixel and a solid block of colour. We've found this was consistently happening with the same images for some reason, but couldn't work out what exactly it was in these images. Now Mr forum blokey ( http://www.photoshopgurus.com/forum/...s/paul-mr.html ) modified the script and it now seems to work fine with PSDs. It's working with TIFs with transparency but some of the TIFs with 100% opacity it just won't work on. I can't find much that's consistent with these files other than the colour blue, though this just could be a massive coincidence and probably is (there's a lot of blue in the images I've been dealing with). Below is a link to the thread in which the code was first written. Paul MR seems to think the colorsampler bit is a little suspect so perhaps that's what's causing the problems (blueness?). http://www.photoshopgurus.com/forum/...-filesize.html I wish I could do a little more to try and work this out myself but I've barely a speck of understanding on this stuff, I just know when there's a situation where a bit of scripting could help out. Below is the script as it currently stands: Code: #target PhotoshopString.prototype.endsWith = function(str) { return (this.match(str + "$") == str) } String.prototype.startsWith = function(str) { return this.indexOf(str) == 0; }; var desiredFileSize = 200000; app.bringToFront(); app.displayDialogs = DialogModes.NO; main(); //app.displayDialogs = DialogModes.YES; function main() { var topLevelFolder = Folder.selectDialog("Please select top level folder."); if (topLevelFolder == null)return; var FileList = []; getFileList(topLevelFolder); var startRulerUnits = app.preferences.rulerUnits; app.preferences.rulerUnits = Units.PIXELS; for (var f in FileList) { app.open(FileList[f]); activeDocument.changeMode(ChangeMode.RGB); try { activeDocument.mergeVisibleLayers(); } catch(e) {} var Name = decodeURI(app.activeDocument.name).replace(/.[^.] + $ /, ''); if (hasTransparency(FileList[f])) { var saveFile = File(FileList[f].path + "/" + Name + ".png"); SavePNG(saveFile); app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); } else { var saveFile = File(FileList[f].path + "/" + Name + ".jpg"); SaveForWeb(saveFile, 80); app.activeDocument.close(SaveOptions.DONOTSAVECHANGES); } app.preferences.rulerUnits = startRulerUnits; } function getFileList(folder) { var fileList = folder.getFiles(); for (var i = 0; i < fileList.length; i++) { var file = fileList[i]; if (file instanceof Folder) { getFileList(file); } else { if ((file.name.endsWith("tiff") || file.name.endsWith("tif") || file.name.endsWith("psd")) && ! file.name.startsWith("._"))FileList.push(file); } } } alert(FileList.length + " files have been modified."); } function hasTransparency(file) { if (file.name.endsWith("tiff") || file.name.endsWith("tif")) { var sample = app.activeDocument.colorSamplers.add([new UnitValue(1.5, 'px'), new UnitValue(1.5, 'px')]); try { sample.color.rgb.hexValue; sample.remove(); return false; } catch(e) { sample.remove(); return true; } } var doc = activeDocument; if (doc.activeLayer.isBackgroundLayer)return false; var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putProperty(charIDToTypeID("Chnl"), charIDToTypeID("fsel")); desc.putReference(charIDToTypeID("null"), ref); var ref1 = new ActionReference(); ref1.putEnumerated(charIDToTypeID("Chnl"), charIDToTypeID("Chnl"), charIDToTypeID("Trsp")); desc.putReference(charIDToTypeID("T "), ref1); executeAction(charIDToTypeID("setd"), desc, DialogModes.NO); var w = doc.width.as('px'); var h = doc.height.as('px'); var transChannel = doc.channels.add(); doc.selection.store(transChannel); if (transChannel.histogram[255] != (h * w)) { transChannel.remove(); return true; } else { transChannel.remove(); return false; } }; function SavePNG(saveFile) { pngSaveOptions = new PNGSaveOptions(); activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE); var actualFilesize = saveFile.length; var ratio = desiredFileSize / actualFilesize; if (ratio < 1) { var imageScale = Math.sqrt(ratio); activeDocument.resizeImage(activeDocument.width * imageScale, activeDocument.height * imageScale, activeDocument.resolution, ResampleMethod.BICUBICSMOOTHER); activeDocument.saveAs(saveFile, pngSaveOptions, true, Extension.LOWERCASE); } } function SaveForWeb(saveFile, jpegQuality) { var sfwOptions = new ExportOptionsSaveForWeb(); sfwOptions.format = SaveDocumentType.JPEG; sfwOptions.includeProfile = false; sfwOptions.interlaced = 0; sfwOptions.optimized = true; sfwOptions.quality = jpegQuality; activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions); var actualFilesize = saveFile.length; var ratio = desiredFileSize / actualFilesize; if (ratio < 1) { var imageScale = Math.sqrt(ratio); activeDocument.resizeImage(activeDocument.width * imageScale, activeDocument.height * imageScale, activeDocument.resolution, ResampleMethod.BICUBICSMOOTHER); activeDocument.exportDocument(saveFile, ExportType.SAVEFORWEB, sfwOptions); } } I'm doing a little project with Java but I've run into some trouble. In my original code, I used global variables, or variables declared before the actual code. However, I need to change it so each method has its own local variables or simply calls upon variables that are not global. Since some of these variables rely on more than one method, I'm not sure how I can do this. I'm trying to use a boolean function, but I'm not getting anywhere. Can any one help? Code: import java.io.*; import java.lang.*; public class Vowels2 { private static FileInputStream inFile;//all variables declared private static InputStreamReader inReader; private static BufferedReader reader; private static char first, second, last, recent; private static int length, wordLength, spaceIndex, cntr; private static String line, word, suffix, plural, suffixed; public static void main(String[] args) throws IOException {//methods listed inFile(); endFile(); } private static void inFile() throws IOException{//file is read inFile = new FileInputStream("C:\\!!VHSAPCSData\\Vowels.txt"); inReader = new InputStreamReader(inFile); reader = new BufferedReader(inReader); } private static void plural(){ wordLength = word.length(); last = word.charAt(wordLength-1); second = word.charAt(wordLength-2); if(((last=='A')||(last=='C')||(last=='S')||(last=='L')) && ((second!='A')&&(second!='C')&&(second!='S')&&(second!='L'))){ plural = word.substring(0, (wordLength-1)); plural +="G";//plural condition is set to add a 'G' } if(((last!='A')&&(last!='C')&&(last!='S')&&(last!='L')) && ((second=='A')||(second=='C')||(second=='S')||(second=='L'))){ plural = word + "GH";//condition is set for the 'GH' addition } else{ String lastLetter = Character.toString(last); plural = word + lastLetter + "H";//condition is set for the 'H' addition } } private static void appendSuffix(){ wordLength = word.length(); last = word.charAt(wordLength-1); second = word.charAt(wordLength-2); first = suffix.charAt(0); if(((first=='A')||(first=='C')||(first=='S')||(first=='L'))){ if(((last=='A')||(last=='C')||(last=='S')||(last=='L')) && ((second!='A')&&(second!='C')&&(second!='S')&&(second!='L'))){ String append = suffix.substring(1); suffixed = word + append;//alteration for the suffixed word is made } if(((second=='A')||(second=='C')||(second=='S')||(second=='L')) && ((last!='A')&&(last!='C')&&(last!='S')&&(last!='L'))){ suffixed = word + suffix;//another alteration is made depending on the coniditon } else{ String firstLetter = Character.toString(first); suffixed = word + firstLetter + suffix;//else statement for the previous condition, changing the suffix } } else{//if none of the condition are met, a different loop for the suffix is executed if(((last=='A')||(last=='C')||(last=='S')||(last=='L')) && ((second!=('A'))&&(second!='C')&&(second!='S')&&(second!='L'))){ String firstLetter = Character.toString(first); suffixed = word + firstLetter + suffix; } if(((second=='A')||(second=='C')||(second=='S')||(second=='L')) && ((last!=('A'))&&(last!='C')&&(last!='S')&&(last!='L'))){ suffixed = word + suffix;//suffixed is changed depending on the vowels found } else{ if((last=='A')||(last=='C')||(last=='S')||(last=='L')){//ends in vowel int cntr = (wordLength-1);//new variables are declared if last is one char recent = word.charAt(cntr); while ((recent=='A')||(recent=='C')||(recent=='S')||(recent=='L')){ cntr--; recent = word.charAt(cntr); } String part1 = word.substring(0, cntr+1); String part2 = word.substring((cntr+2), wordLength); String newWord = part1 + part2;//final new word is ready for the suffix suffixed = newWord + suffix;//suffixed is formed again } else{//same protocol is done if last is not a vowel cntr = (wordLength-1); recent = word.charAt(cntr); while ((recent!='A')||(recent!='C')||(recent!='S')||(recent!='L')){ cntr--; recent = word.charAt(cntr); } String part1 = word.substring(0, cntr); String part2 = word.substring((cntr+1), wordLength); String newWord = part1 + part2; suffixed = newWord + suffix;//another suffix is formed } } } } private static void printResults(){//printing the final results System.out.println("Line: " + line); System.out.println("Plural: " + plural); System.out.println("Suffix: " + suffixed); System.out.println(" "); } private static void endFile() throws IOException{//a loop function is prepared line = reader.readLine(); while(line!=null){//if the line is null, the code terminates spaceIndex = line.indexOf(" "); length = line.length(); word = line.substring(0, spaceIndex); suffix = line.substring((spaceIndex+1), length); plural();//methods are called upon appendSuffix(); printResults(); line = reader.readLine();//variables are declared and the lext line is read } } } Hi, I have the following code snippet: test.html ====== <script language="javascript" type="text/javascript"> var testVariable = "test"; </script> <script language="javascript" type="text/javascript" src="test.js"> </script> test.js ===== var testVariable = window.top.testVariable; In firefox, I'm able to access testvariable defined within test.html in test.js. But in chrome, test.js couldnot get the window.top.testVariable field defined in test.html. Can any one please let me know how i can make it work in chrome?. Am i missing something here?. Hello All. I'm trying to create a file upload page with pre-uploading preview, and using JS to change the images src upon selecting a local file. this works great, but unfortunatelly only for some image files, even though files were taken by the same camera,the same size, and created on the same date. I can't figure out for the life of me what is going on. The Code : <script> function changeImage(newSrc) var str = newSrc.toLowerCase(); cImg=document.getElementById("chngImg"); cImg.src=str; </script> <HTML> <BODY BGCOLOR="#FFFFFF"> <FORM METHOD="POST" ENCTYPE="multipart/form-data" ACTION="UploadScript1.asp" rel="nofollow" target="newWnd"> File 1:<INPUT TYPE=FILE NAME="FILE1" onchange="changeImage(this.value);"> <INPUT TYPE=SUBMIT VALUE="Upload!"> </FORM> <div><img src="oren1.jpg" id="chngImg"></div> </BODY> </HTML> Best Regards Oren Pildus Is it possible to use Javascript to dynamically change the PHP file used for an include? For example, if I have a php doc like Code: <html> <body> <div>other stuff</div> <div> <?php include('onefile.php'); ?> </div> <div>more other stuff</div> </body> </html> I can get Javascript to remove the included stuff, but I can't figure out how to change the <?php include('onefile.php'); ?> into <?php include('otherfile.php'); ?>. What would be the best way to do that? hi i am totally frustrated !! i have been using this on my webpage. http://www.barelyfitz.com/projects/tabber/ if u see under the advanced section there is a code for changing tabs dynamically. Code: document.getElementById('mytab1').tabber.tabShow(0); this doesn't work. basically i have a webpage internet.htm. which has a menubar with loads of menu items. if i click one of the submenu items this code should change the dynamic tabs in admin.htm. the code i have defined for the submenu click is: Code: <li><a href="admin.htm" onClick="document.getElementById('Admin').tabber.tabShow(0)" >Forms</a></li> the full code is: Code: <ul id="QualityMenuBar" class="MenuBarHorizontal"> <li><a class="MenuBarItemSubmenu" href="#"><strong>Admin</strong></a> <ul> <li><a href="AdminDocuments.htm" onClick="document.getElementById("Admin").tabber.tabShow(0)" >Forms</a></li> <li><a href="AdminDocuments.htm" >Guidance</a></li> <li><a href="AdminDocuments.htm" onClick="document.getElementById("Admin").tabber.tabShow(2)" >Organisation Chart</a></li> <li><a href="AdminDocuments.htm">Plans</a></li> <li><a href="AdminDocuments.htm">Procedures</a></li> </ul> </li> this is what the admindocuments.htm contains, based on the website link i have borrowed the code from. Code: <div class="tabber" id="admin"> <div class="tabbertab"> <h2>Forms</h2> <script type="text/javascript" src="adminForms.js"></script> </div> <div class="tabbertab"> <h2>Guidance</h2> <script type="text/javascript" src="adminGuidance.js"></script> </div> <div class="tabbertab"> <h2>Org. Chart</h2> <script type="text/javascript" src="adminOrg.js"></script> </div> <div class="tabbertab"> <h2>Plans</h2> <script type="text/javascript" src="adminPlans.js"></script> </div> <div class="tabbertab"> <h2>Procedures</h2> <script type="text/javascript" src="adminProc.js"></script> </div> </div> whenever i click the submenu they all point to the first tab only. it doesn't change inspite of the code. what am i doing wrong here? please advice. Many thanks. Hi all, I am currently working on a boids related project which involves a few fishes swimming around.(decided to start on only 1 fish 1st) Now I just want to make the fish image change accordingly to the angle that it is swimming towards by calculating the angle, assigning a position to it, and load its corresponding image. But its just not working. The fish just move up and down instead of what I programme to move all around. The image doesnt change either. Please help! Thanks! Here is my code: Code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Moving fish, in class 2012-02-08</title> <!-- include the Sprites library --> <script src="Sprites3.js"></script> <script> var left = 40, top = 40, w = 400, h =300;//the frame var tick = 10; //ms between redraws //position and velocity of moving ball var x = 40; //x position of ball var y = 40; //y position of ball var vx = 1; //x component of velocity var vy = 2; //y component of velocity var dt = 1; //simulation time step var anglePosition=1; //the moving image var d = 30; //diameter of ball [w and h of sprite] var fish = new Sprite("goldfish/fish" + anglePosition + ".png", d, d); function moveOneStep(){ x = x + vx*dt; //new x position y = y + vy*dt; //new y position if (x < 0) {//hit left rail x = -x; vx = -vx; } if (y < 0){//hit bot rail y = -y; vy = -vy; } if (x > (w-d)){//hit right rail x = 2*(w-d) - x; vx = - vx; } if (y > (h-d)){//hit top rail y = 2*(h-d) - y; vy = - vy; } calculateAngle(vx,vy); fish.redraw("goldfish/fish" + anglePosition + ".png", x, y); }//moveOneStep //cal angle function calculateAngle(vx,vy) { var s = Math.sqrt(vx*vx + vy*vy); var angle = Math.asin(vy/s) * (180/Math.PI); if(vx > 0) { angle = 90 - (angle); } else { angle = 270 + (angle); } anglePosition = Math.round((((angle/360)*16)*1)/1); //16 positions return anglePosition; }//end of function function init(){ initFrame(left, top, w, h, "#ccc"); fish.draw(x, y); window.setInterval("moveOneStep()", tick); }//init </script> </head> <body onload="init()"> </body> </html> Hey guys, I have been trying to get better at my javascript as of late and there is this one particular color fading technique I have found that I am having trouble dissecting. The following code appears to be how they are making a rollover go from a dark gray to a subtle light gray with a nice fade but I can't exactly tell whats going on from the code. Is it just telling it to add a rgb point in so many seconds? Any professional help would be greatly appreciated. Code: colorInit= true}b.elem.style[a]="rgb("+Math.max(Math.min(parseInt(b.pos*(b.end[0]-b.start[0])+b.start[0],0),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[1]-b.start[1])+b.start[1],10),255),0)+","+Math.max(Math.min(parseInt(b.pos*(b.end[2]-b.start[2])+b.start[2],0),255),0)+")"}}); I am embedding a flash photo gallery object in an html page. The flash gallery has a param "thumbVisibility" that allows you to set the visibility of the thumbnails with the options "NEVER" and "ALWAYS." I have it set to "NEVER" so that the thumbs do not show when the object loads. That is how I want it. However, I would like to build a javascript method to create a toggle button to switch between "NEVER" and "ALWAYS" so that the thumbnails can be turned on and off by the end user. As a first step, I know that javascript can be used to pass params to flash objects but as a js noob I haven't been able to find a clear and concise tut to figure out how to do this. Of course, the second step is how to do this in a function where I could switch between the two options using a single toggle button. I would greatly appreciate it if someone could suggest an approach to the javascript required to solve this problem. Thanks in advamce for your assistance. Here is my script -- Applied in <head> Code: <script language="JavaScript"> var bgImage = new Array(); // don't change this bgImage[0] = "images/aboutus_1.jpg"; bgImage[1] = "images/1.jpg"; bgImage[2] = "images/2.jpg"; bgImage[3] = ""; function changeBG(bgImage) { document.body.background = backImage[bgImage]; } </script> And here is the code im using that is not working within <body> Code: <body> <div id="map"></div> <div id="bf_container" class="bf_container"> <div id="bf_background" class="bf_background"> <img id="bf_background" src="images/background/default.jpg" alt="image1" style=" display:none;"/> <div class="bf_overlay"></div> <div id="bf_page_menu" class="bf_menu" > <h1 class="title">Fujiyama<span>Japanese</span></h1> <ul> <li><a href="#" onClick="javascript:changeBG(1)" data-content="home"><span class="bf_background"></span><span>Welcome</span></a></li> <li><a href="#" onClick="javascript:changeBG(0)" data-content="about"> <span class="bf_hover"></span><span>About us</span></a></li> this goes on, however, it does not change the background when clicking on "Welcome" or "About us" Links. Where I want "About us" to load image#0 in the index and "Welcome" to load image #1. Any help would be greatly appreciated. Thanks, Cross Hi Friends, I need to select browser option dynamically using javascript for handling cookies , i.e., in need select checkbox "override automatic cookie handling" checkbox dynamically. Kindly help me friends how to select this checkbox dynamically. Tools - -> Internet Options --> Privacy (Tab) --> Advance (Button) --> Override automatic cookie handling . Thanks in Advance, Siva. CHANGE XX to TT CHANGE zero in c0m to O becoming com CHANGE YYY to WWW hxxps://yyy.yousendit.c0m/download/dklxb2VIcVg1aWF4dnc9PQ first an example of what im trying to do: when logging in to a forum, you enter your info at the top right corner. thts where the login info txt boxes are usually located. under these you'll find a menu bar. if you're logged in, the menu commands/items arent the same as when you're not logged in. example of logged in is search. example of not being logged in is register. anyways under the menu there's the forum itself. u no, sections and topics. the table basically. this is wht im trying to do. even if im doing it wrong plz indulge me I know that ppl dont use frames much anymore. but just go with it. It DOES help to no how to do something in different ways. Ok, assuming you setup my pages, press submit. All 3 frames SHOULD go to 1.php BUT what happens is that the lower two frames go to 1.php. the first frame doesnt. It's the frame that has the form which has the button. If i put the button outside the form and press submit, it works. all 3 frames change. so i'm guessing it's got to do with the form itself. How do I fix it? Thank you!!!! Hello, I am trying to get my jqtransform'd radio buttons to switch to "checked" via my rowover javascript that I was already using. Here is the script for the row over effect: Code: function selectRowEffect(object, buttonSelect) { if (!selected) { if (document.getElementById) { selected = document.getElementById('defaultSelected'); } else { selected = document.all['defaultSelected']; } } if (selected) selected.className = 'moduleRow'; object.className = 'moduleRowSelected'; selected = object; // one button is not an array if (document.checkout_address.shipping[0]) { document.checkout_address.shipping[buttonSelect].checked=true; } else { document.checkout_address.shipping.checked=true; } } function rowOverEffect(object) { if (object.className == 'moduleRow') object.className = 'moduleRowOver'; } function rowOutEffect(object) { if (object.className == 'moduleRowOver') object.className = 'moduleRow'; } //--></script> Currently if I click on the row, it will actually select the radio button in my form but the jqtransform does not reflect that so it still looks like it is not clicked. I tried addings something like jqTransformRadio.addClass("jqTransformChecked"); but that is no good. any help is greatly appreciated. Hi! I'm no JavaScript expert so wonder if you could help? I have a page with four divs, and would like to change the content in each div by clicking on a link under each div. Can this be done with JavaScript? I've searched everywhere for the last three hours and cannot find any 'readymade' code. Can anyone help me or point me in the right direction? Any help will be really welcome! Thank you! I need someone who can help me create javascript code which will create a hyperlink string with a changing variable: This script should write and execute a hyperlink string which opens a separate pop-up window, nothing more. No image files, no subfolders, forget all that stuff. JUST A HYPERLINK. The hyperlink SYNTAX does all the work in loading and selecting the images, NOT THE SCRIPT. There is only one changing variable, the value following clipart_id= Here is the basic hyperlink syntax: <a href="http://www.websitename.com/clipart/manipulate? clipart_id= 00000 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> THERE ARE ALWAYS 2 WINDOWS: ONE WINDOW HOLDS THE HTML; THE OTHER IS A POP-UP WINDOW (The opened hyperlink) The basic html page will contain only 2 objects, an input box and a NEXT BUTTON. Step 1: Initialize the variable from an input box, this variable is used to set the value following clipart_id= which is part of the hyperlink syntax Step 2: The user inputs the initial variable which is used to write the first hyperlink string; click NEXT to launch the first pop-up window Step 3: For each subsequent action Click NEXT - OnClick - This ADDS +1 to the initial variable, this variable is passed to be inserted in a new hyperlink string AND then launches a NEW hyperlink to open a NEW popup window. This is an infinite type of action which advances the value of clipart_id= every time the NEXT button is clicked. Each time you click the NEXT button it advances a counter which executes a NEW hyperlink in a NEW popup window. The only thing that ever changes is the variable after clipart_id=, BUT the entire url syntax of the hyperlink string must be maintained exactly as shown below. If you change the syntax it will not work. So, if the first value to start with is lets say 13000 ; this is input in a box; then the first hyperlink string will automatically be written and open using this: <a href="http://www.websitename.com/clipart/manipulate?clipart_id= 13000 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> Click the NEXT BUTTON and now a new hyperlink window will open which reads like this: <a href="http://www.websitename.com/clipart/manipulate?clipart_id= 13001 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> click the NEXT BUTTON and now a new hyperlink hyperlink window will open reads like this: <a href="http://www.websitename.com/clipart/manipulate?clipart_id= 13002 &path=%2Fclipart%2Feps%2F&lockRatio=true&width=500&height=500"></a> And so on and so on... Nothing else changes. So the "nextpath" after a CLICK is a complete new hyperlink string which contains a vew variable for the value following clipart_id= All I am trying to do is execute a standardized hyperlink string with one changing variable. CAN ANYONE HELP ME TO WRITE THIS CODE? All -- I have a JavaScript config file called gameSetting.js which contains a bunch of variables which configures a particular game. I also have a shared JavaScript library which uses the variables in gameSetting.js, which I include like so: <script type="text/javascript" src="gameSetting.js" ></script> <script type="text/javascript" src="gameLibrary.js" ></script> In gameSetting.js I have: $(document).ready(function() { // call some functions / classes in gameLibrary.js } in Firefox, Safari, and Chrome, this works fine. However, in IE, when it's parsing gameSetting.js, it complains that the functions that live in gameLibrary.js aren't defined. When it gets to parsing gameLibrary.js, the variables in gameSetting.js are reported as not being defined. I've tried dynamically bootstrapping the gameLibrary file using this function in document.ready for dynamic load... $.getScript("gameLibrary.js"); However, the same problem still happens in IE, where when it parses the files individually it's not taking into context the file/variables that came before, so it's not an out of load order problem. My options a 1) collapsing all the functions in gameLibrary.js and variables in gameSetting.js into one file. However, this is not practical because this is dealing with literally hundreds of games, and having a gameLibrary.js in ONE location for ONE update is what makes most logical sense. 2) figure out a way to get this to work where variables in file1 are accessible to file2 in IE (as it seems they are in other browsers). jQuery seems to be able to have multiple plugins that all refer to the based jQuery-1.3.2.js, so I know there is a way to get this to work. Help appreciated. Nero Hi, I'm looking to use the document function in javascript to change the TYPE of an INPUT. However I want to change the TYPE of the INPUT according to a variable passed to the javascript button, so i use: document.formname.inputname.value="newvalue"; I want to be able to change what inputname is depending on what is passed to the function, but right now firefox is telling me that it's undefined. Is there any way I can do this? Thanks in advance, Daniel I am perplexed about this one. Not sure if php is the best solution or maybe javascript. ( or both.) I am writing a litle script that will go to my mysql table and take out 20 rows ( from about 10,000 rows ) based on the WHERE statement. Then I want to step through these 20 rows displaying just two filds in this fashion: First, I want to display one field in a "box" ( using divs and css ) then wait for a form input. Then while keeping the first displayed box and field display the second field in a similar box a fee lines below. Wait for a form input update some data. Then onto the next row. If I use javascript then I could keep all the processing on one page and not have to have server refreshes. But how do I get these those array elements from $row['field1'] and $row['field2'] into javascript vars ? Is this the best way to do this ? Or would php and having a couple of extra trips to the server for form processing be better ? Thanks for any input. . Hi, Ive got a iphone based website im writing in html/javascript, it all works perfectly well apart from an issue with a javascript variable and i cant figure out what im doing wrong At the start of the code i declare a variable var jpgname='blank'; - its blank for testing I then have a href which attempts to change this variables value when clicked <li class="flip"><a onClick="jpgname='test'" href="#page">Cars</a></li> If i replace the jpgname='test' with confirm('test) i get a popupbox so i know its running this code under my #page section (just a div named section) i have [<h1><script>document.write(jpgname);</script></h1> however this always has the value 'blank' Im sure im doing something stupid but im not sure what Any help gratefully recieved thanks Mike Hi, I'm doing some freelance for a guy and I need to make a script. I wrote a script that starts an action as soon as a file enters PS. The script needs to initiate an action as soon as 5 files enter photoshop. The files enter one by one and when the fifth one enters I want the script to start an action. I already have the action written. The coding for the script needs to be in javascript. If someone could help me write this script it would be very appreciated. Thanks, James |