Javascript Conditional Division Resize

I can't get code like this to work, the logic is right, but I
can't get it to work on 2 divisions that properties initially the
height is set to auto.
function resizeContent(){
if(document.getElementById("content_left").style.height <
'405px'){
document.getElementById("content_left").style.height='405px';
if(document.getElementById("content_right").style.height
< '405px'){
document.getElementById("content_right").style.height='405px';
}

Hello,
First you didn't make all the changes that were suggested before
this
&lt;script language="JavaScript1.1" type="text/javascript">
function beware()
if(html_GetElement('P3_BOARD_GROUP_TYPE_ID')==6)
{(!(confirm('Warning!  This will change all Timers to default values.  Continue?')))}
{html_GetElement('P3_EMULATION').focus()}
&lt;/script
still wouldn't work anyway
now what you need to do is either supress or allow doSubmit in your javascript.
So first change the select to a regular select so the proper onchange is applied
Second use this javascript
&lt;script language="JavaScript1.1" type="text/javascript">
function beware(){
if(html_SelectValue('P3_BOARD_GROUP_TYPE_ID')==6){
var answer = confirm('Warning! This will change all Timers to default values. Continue?');
if(answer){doSubmit()}
else{html_GetElement('P3_EMULATION').focus()}
&lt;/script>
You should take a quick run through this javascript tutorial http://www.w3schools.com/js/js_intro.asp and hour or two spent here is going to save you countless hours later and allow you to build more adavced (and working) functionality.
Carl

Similar Messages

  • Conditional Image Resizing

    Hi
    Ive been using batch processing in photoshop since version 7, however Ive recently found the need to do conditional actions - which apparently can be done with photoshop scripting.
    What Im trying to do is resize an image if it is over a certain size (document dimensions that is) but leave it at its original size if not.
    If I was coding in C or something Id probably do (forgive the poor pseudo code)
    if(document.height*document.width>640000){document.resize("50%");}
    Can anybody point me in the right direction for creating this type of script in photoshop CS4?
    Many thanks
    James

    JamesAdler wrote:
    Hi, thanks for replying.
    Your response has caused me to rethink and discover that it is not always going to be possible to achieve what I want. It relies entirely on the aspect ratio of the image that you start out with. A complete oversight.
    James  If you know the size you want it would be easy to do if a fitted center crop would fill your needs.  However I must warn you that center crops do not work all that when you change Landscape to portraits and portraits to landscapes. Here are some examples of what happen when there are orientation mismatches.
    Documentation and Examples

  • Javascript conditional check

    Hi,
    See Javascript below.
    I'm trying to pop-up a warning message window conditionally if P410_BOARD_GROUP_TYPE_ID = 6 and the user selects a different value in the Select List. It seems ilke I am either A) passing in the value of P410_BOARD_GROUP_TYPE_ID incorrectly, or B) choosing the wrong type of event handler. Can someone spot where I'm going wrong? It's as though the function isn't even being calling on my page when I run it.
    <b>In the HTML Form Element Attributes box for P410_EMULATION:</b>
    onSelect=beware('P410_BOARD_GROUP_TYPE_ID');
    <b>In the HTML Header:</b>
    <script language="JavaScript1.1" type="text/javascript">
    function beware()
    if(html_Element('P410_BOARD_GROUP_TYPE_ID')=6)
          {(!(confirm('Warning!  This will change all Timers to default values.  Continue?')))}
          {html_GetElement('P410_EMULATION').focus()}
    </script>

    Hello,
    First you didn't make all the changes that were suggested before
    this
    &lt;script language="JavaScript1.1" type="text/javascript">
    function beware()
    if(html_GetElement('P3_BOARD_GROUP_TYPE_ID')==6)
    {(!(confirm('Warning!  This will change all Timers to default values.  Continue?')))}
    {html_GetElement('P3_EMULATION').focus()}
    &lt;/script
    still wouldn't work anyway
    now what you need to do is either supress or allow doSubmit in your javascript.
    So first change the select to a regular select so the proper onchange is applied
    Second use this javascript
    &lt;script language="JavaScript1.1" type="text/javascript">
    function beware(){
    if(html_SelectValue('P3_BOARD_GROUP_TYPE_ID')==6){
    var answer = confirm('Warning! This will change all Timers to default values. Continue?');
    if(answer){doSubmit()}
    else{html_GetElement('P3_EMULATION').focus()}
    &lt;/script>
    You should take a quick run through this javascript tutorial http://www.w3schools.com/js/js_intro.asp and hour or two spent here is going to save you countless hours later and allow you to build more adavced (and working) functionality.
    Carl

  • Executing JavaScript conditionally ?

    Hi all,
    is there a way to execute a JavaScript code conditionally according to a managed bean property value ?
    Consider the following :
    a Calling window named CALLER
    a Called window named CALLED
    Having the following scenario:
    1- CALLER window open CALLED window :
    window.open("CALLED");
    2. CALLED window is submitted by a command action which either return
    a "failed" or "success" return code (additivily that action may set a managed
    bean value "please_refresh_CALLER" to true or false) , and in any cases the
    CALLED will be directed to redisplay itself.
    3. if the CALLED "please_refresh_CALLER" value is set to true , and after the
    CALLED being redisplayed , the CALLER need to be redisplayed accordingly :
    opener.document.form.submit();
    Step 3 is little obscure to me , as how may I execute a JavaScript code conditionally according to a managed bean value ?
    Any comments?
    Thx

    Hi again
    what about creating a custom component that renders the required managed bean property as a javascript variables :
    example
    <h:publish value="#{managedBean.propertyName}" />
    which renders the following :
    <SCRIPT language="JavaScript">
    var managedBean_propertyName = theValue
    </SCRIPT>
    so as to let the rest of javascript code, process that variable and do the necessary action accordingly.
    any suggestions ?

  • Javascript Bookmark to resize Safari Windows

    Despite searching all over, I could not easily find how to keep Safari from opening new windows that were just a bit off on the left or the right sides of the screen. I had read tips about making a new window, resizing it and then closing it. Sure enough, the next new window would open with that size and position. But open a 2nd new window and Safari would position it a little bit to the right, thus leaving the scroll bars slightly off the right side of the screen.
    So I tried to find a javascript to solve this problem. Nothing did exactly what I wanted, so I have customized what I found and the following works for me:
    Step 1) Save any webpage as a bookmark to the Bookmarks Bar (Click "Bookmarks" then "Add Bookmark...", OR Click Apple-D, then choose "Bookmarks Bar", "Add").
    Step 2) Open "Bookmarks" "Show All Bookmarks", then choose "Bookmarks Bar" on the left under "COLLECTIONS".
    Step 3) Find the bookmark you added in Step 1 and change the Bookmark's name to "Resize Window to Fill screen" or whatever you want (click once on the name and after a delay click a second time, then type).
    Step 4) Change the bookmark's address to "javascript:self.moveTo(0,0);self.resizeTo(1440,screen.availHeight);" (click once on the bookmark's address and after a delay click a second time, then type or copy and paste what is inside the quotation marks above).
    Step 5) In any window, click Apple-1 and the window will resize!
    Note: I have a 17" iMac. For different size screens, just play around with the number "1440" in the javascript above. Make it larger or smaller until it is the exact size you want. Also, if you add new bookmarks to the Bookmarks bar, it may change the keyboard shortcut number for this "Resize Window" bookmark. You can always drag to reorder the bookmarks. The top ones will have keyboard shortcuts "Apple-1", "Apple-2", etc.
    Hope this helps someone else!

    This helped me, and thanks again!!

  • Using Javascript & Actions to resize an image and add the filename as text

    Hello,
    I am currently working on a way to take an image, resize it and add exactly what is in it's file name (before extension) as a text layer. I have succeded in this BUT am having issues with file names that require more than one line of text.
    I need the text to align to the bottom of the image & the script or action must then resize the image so that the text does not overlap.
    Any ideas on how this can be done?
    At the moment I am using:
    -"Fit Image.jsx" to resize my image to a specific size (This was included in the Photoshop CS5 scripts)
    - A script to add the file name without extension and place the file name at a specific position.
    AdFileName.jsx
    if ( documents.length > 0 )
    var originalRulerUnits = preferences.rulerUnits;
    preferences.rulerUnits = Units.PIXELS;
    try
      var docRef = activeDocument;
      // Now create a text layer at the front
      var myLayerRef = docRef.artLayers.add();
      myLayerRef.kind = LayerKind.TEXT;
      myLayerRef.name = "Filename";
      var myTextRef = myLayerRef.textItem;
      // strip the extension off
      var fileNameNoExtension = docRef.name;
      fileNameNoExtension = fileNameNoExtension.split( "." );
      if ( fileNameNoExtension.length > 1 ) {
       fileNameNoExtension.length--;
      fileNameNoExtension = fileNameNoExtension.join(".");
      myTextRef.contents = fileNameNoExtension;
      // off set the text to be in the middle
      myTextRef.position = new Array( docRef.width / 2, docRef.height / 2 );
      myTextRef.size = 12;
            myTextRef.font="Arial-BoldMT"
            //set position of text
            myTextRef.justification = Justification.CENTER;
            myTextRef.kind = TextType.PARAGRAPHTEXT;
            myTextRef.width= docRef.width;
            myTextRef.height= docRef.height/ 2;
            myTextRef.position= [0, docRef.height * 0.88];
    catch( e )
      // An error occurred. Restore ruler units, then propagate the error back
      // to the user
      preferences.rulerUnits = originalRulerUnits;
      throw e;
    // Everything went Ok. Restore ruler units
    preferences.rulerUnits = originalRulerUnits;
    else
    alert( "You must have a document open to add the filename!" );
    Can the position be changed to allow more rows of text but keep it aligned with the bottom of the layer?
    How can I script in a way to make the image resize based on the amount of text lines?
    Any help would be greatly appreciated.

    You can add a text layer any where the only thing you need to worry about is the size of the font you use.  You can normally calculate a font size by saving the images resoltuion and then setting its resolution to 72 DPI calculate a font size basied of the images pixel width and the number of characters you want in a line. After adding the text layer you can restore the image to its original resolution and align the text layer by making a selection and alignint the text layer to the selection.  There are nine posibilites like the positions in the selection you can align to like a tick tack toe board. You need to use a script to add the text layer because your retrieving the filename.  The positioning of the text layer could be done easily in an action the would use the scriot to add a text layer the do a select all  the align the added text layer to the selection.
    About your script don't make text paragraph just add new line characters to make a multi line text layer So it can be positioned easily
    I do just that with my stampexif action.  The action uses my stampexif Photoshop java script to add a multi line text layer containing some formatted EXIF data then the action centers the text layer and add a layer style to it. Link http://www.mouseprints.net/old/dpr/StampExif.jsx Example

  • Javascript Setiing default to blank

    I created a contract form in adobe acrobat pro x and I have been using simplified field notation. What it currently does is calculate 5% of the contract amount into several boxes in the form. This is the equation I am currently using.
    Calc2_A * 0.05
    When I leave box "Calc2_A" blank it sets the default value of the area its being calculated in as $0.00
    I think what I need is a javascript conditional statement that says if box = blank then calculation should be blank, not $0.00.
    I am very new to the program so maybe there is something I am missing.
    Any help is greatly appreciated
    Thank You

    You could create a custom calculation script that looks like:
    (function () {
        // Get the field value, as a string
        var s = getField("Calc2_A").valueAsString;
        // If the field is not blank, perform the calculation. Otherwise set this field to blank
        event.value = s ? 0.05 * s : "";
    Since it's an area and not a dollar amount, set the formatting option of the fields to not include a currency symbol.

  • Using JavaScript to extend the height of a DIV to the height of a document or page.

    Hello everyone,
    How can I use JavaScript to dynamically resize a DIV on a page so that the div extends vertically to the size of the page or document.
    I have been experimenting all evening with different methods, some don't even work.
    Thanks everyone!
    WE

    Thanks for responding, I'll gladly explain further, hopefully you can help me.
    I have a DIV on the right side of the page (sidebar) it has very little content and does not extend to the botom of the page.
    However, I have another DIV with text that extend further down the page.
    What I am trying to do is have the sidebar extend to the bottom of the page or window height.
    This way as more text is place in the other DIV and the page stretches down, the sidebar stays extend at the bottom.
    I know the CSS method but I would like to experiment with JavaScript.
    I want to be the cook with many knives!
    Thanks for helping!
    WE
    garywpaul wrote:
    I'm not sure I understand you question. It sounds to me like you want div columns to match in size regarless of content amount?  If that is the case, you want to use faux columns.
    Read about it here:
    http://www.paulgdesigns.com/faux-columns.php
    If I am not understanding you, post back.
    gary

  • Can we use JSP in a JavaScript method

    Hi,
    I have a following code. and I want to do a validation that whether a file exists or not before previewing it on my screen.
    The code does not seem to work.
    Is it the correct approach.
    Please help.
    <HTML>
    <HEAD>
    <TITLE> This is frame1 </TITLE>
    <!%
    private static boolean exists (String filename) {
    return exists (filename, new File ("c:/image/"));
    private static boolean exists (String filename, File dir) {
         boolean exists = false;
         filename=filename+".jpg";
        if (new File (dir, filename).exists ()) {
              exists = true;
            } else {
                File[] subdirs = dir.listFiles ();
                int i = 0;
                int n = (subdirs == null) ? 0 : subdirs.length;
                while ((i < n) && ! exists) {
                    File subdir = subdirs;
    if (subdir.isDirectory ()) {
    exists = exists (filename, subdir);
    i ++;
    return exists;
         %>
    <script type="text/javascript">
    <!-- Begin
    // width to resize large images to
    var maxWidth=150;
    // height to resize large images to
    var maxHeight=150;
    // the id of the preview image tag
    var outImage="previewField";
    function preview(what){
    var test;
    var path = "C:/image/";
    var source=what.value;
    var finalpath = path+source+".jpg";
    test= <%=exists((String)(request.getParameter("user")))%>
    alert(test);
    if(test = 'false')
         alert("file does not exist");
         //alert(finalpath);
    // var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
    //for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
    globalPic=new Image();
    var i = 0;
    //alert(what.value);
    globalPic.src=finalpath;
    //alert(globalPic.src);
    var field=document.getElementById(outImage);
    var x=parseInt(globalPic.width);
    var y=parseInt(globalPic.height);
    if (x>maxWidth) {
    y*=maxWidth/x;
    x=maxWidth;
    if (y>maxHeight) {
    x*=maxHeight/y;
    y=maxHeight;
    field.style.display=(x<1 || y<1)?"none":"";
    field.src=globalPic.src;
    field.width=x;
    //alert(x);
    field.height=y;
    //alert(y);
    </script>
    </HEAD>
    <BODY>
    <table>
    <form name=myform>
    <tr>
    <td>
    <div align="center" style="line-height: 1.9em;">
    Please enter the file name:
    </td>
    </tr>
    <tr>
    <td>
    <input type="text" name = "user" id="picField" value='1-007156SKL'>
    </td>
    </tr>
    <tr>
    <td>
    <INPUT TYPE="Submit" value="Submit" onClick = "parent.passText(this.form.user.value)">
    </td>
    </tr>
    </table>
    </form>
    <INPUT TYPE="button" value="Show Image" onClick = "preview(myform.user)">
    <img id="previewField" src="images.jpg">
    </BODY>
    </HTML>

    Here's the full code snippet :
    <HTML>
    <HEAD>
    <TITLE> This is frame1 </TITLE>
    <!%
    private static boolean exists (String filename) {
    return exists (filename, new File ("c:/image/"));
    private static boolean exists (String filename, File dir) {
         boolean exists = false;
         filename=filename+".jpg";
        if (new File (dir, filename).exists ()) {
              exists = true;
            } else {
                File[] subdirs = dir.listFiles ();
                int i = 0;
                int n = (subdirs == null) ? 0 : subdirs.length;
                while ((i < n) && ! exists) {
                    File subdir = subdirs;
    if (subdir.isDirectory ()) {
    exists = exists (filename, subdir);
    i ++;
    return exists;
         %>
    <script type="text/javascript">
    // width to resize large images to
    var maxWidth=150;
    // height to resize large images to
    var maxHeight=150;
    // the id of the preview image tag
    var outImage="previewField";
    function preview(what){
    var test;
    var path = "C:/image/";
    var source=what.value;
    var finalpath = path+source+".jpg";
    test= <%=exists((String)(request.getParameter("user")))%>
    alert(test);
    if(test = 'false')
         alert("file does not exist");
         //alert(finalpath);
    // var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
    //for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
    globalPic=new Image();
    var i = 0;
    //alert(what.value);
    globalPic.src=finalpath;
    //alert(globalPic.src);
    var field=document.getElementById(outImage);
    var x=parseInt(globalPic.width);
    var y=parseInt(globalPic.height);
    if (x>maxWidth) {
    y*=maxWidth/x;
    x=maxWidth;
    if (y>maxHeight) {
    x*=maxHeight/y;
    y=maxHeight;
    field.style.display=(x<1 || y<1)?"none":"";
    field.src=globalPic.src;
    field.width=x;
    //alert(x);
    field.height=y;
    //alert(y);
    </script>
    </HEAD>
    <BODY>
    <table>
    <form name=myform>
    <tr>
    <td>
    <div align="center" style="line-height: 1.9em;">
    Please enter the file name:
    </td>
    </tr>
    <tr>
    <td>
    <input type="text" name = "user" id="picField" value='1-007156SKL'>
    </td>
    </tr>
    <tr>
    <td>
    <INPUT TYPE="Submit" value="Submit" onClick = "parent.passText(this.form.user.value)">
    </td>
    </tr>
    </table>
    </form>
    <INPUT TYPE="button" value="Show Image" onClick = "preview(myform.user)">
    <img id="previewField" src="images.jpg">
    </BODY>
    </HTML>

  • IFrame Resizing

    I know that we can resize the IFrame based on the height of the Content.
    Now the problem I have is that I am using a URL iView and want the height of the IFrame to be auto adjusted based on the content shown in the IFrame.
    To achieve this I need to call a Javascript function to resize the IFrame, but I don't know how to get handle of the current IFrame. This IFrame is generated by the Portal Framework and there is no ID/Name attached to it.
    So is there a way to get the handle of the IFrame from within the content. For e.g. can the content get access to the IFrame in which it is being shown.
    Thanks in Advance.
    Ankur

    Ankur
    You can get the portal to resize the content automatically using the propertys of the iview/page and setting the page height to automatic. However, this will only work if the domain of the website that you are accessing is the same domain as the portal, i.e. if your portal is myportal.mydomain.com then the domain of the portal is mydomain.com. If the website is then mywebsite.internaldomain.com, then, unless the websites domain (by default) is mysebsite.internaldomain.com. Even if the website relaxed its domain to internaldomain.com the automatic resizing would not work. This is a security feature of browsers and can not be coded around. There are threads regarding the 'Access Denied' messages when trying to perform cross-domain scripting
    I hope this helps
    D

  • Jdev 11g richTextEditor resize

    Hi,
    i'm trying to make richTextEditor stretchable. I almost got it by tweaking css, but it won't resize smaller than a certain size. Firs I thought I had problems with css,
    but then I realised there was javascript messing with resize. I figured there is resizeNotify function, but the code is quite obscurated and big, so Firebug is choking on it and so am I.
    Does anybody know why javascript won't allow resize and if minimum size is configurabile (it doesn't seem to be affected by css min-size).
    This is the div blocking resize. It's located directly above the hidden textarea. If I change id (in static html) it becomes resizable...
    <div id="j_id_id8::cont" src="/Psa-PsaView-context-root/afr/blank.html" class="xez" title="Editing Region">
    </div>
    Jernej

    The documentation only mentions width, but I'd like it to be stretchable by width and height.
    Actually, I got the stretching part, it's shrinking that is blocked by javascript after size riches some point.

  • Re:Copy Condition record

    Is there any solution if I maintain the condition record of particular condition type ,the value of this condition record is auomatically copy to another condition record.

    hi,
    you can use common disrtibution channel and common division
    img>sales and distribution>master data-->common distribution channel,common division
    Reference distribution channel for conditions
         Specifies a distribution channel that you want to use as a reference for
         condition data for other distribution channels.
    Example
         Distrib.channel                Ref.distrib.channel
         01                             01
         02                             01
         03                             01
         04                             04
    Reference division for conditions
         Specifies a division where you can define conditions and share them with
         other divisions.
    Example
                   Division       Condition-division
                      01                  01
                      02                  01
                      03                  01
                      04                  04
    regards
    senya

  • Perplexed about resizing swf to window

    Hi all,
    I cannot change both the width 100% and height 100% of my SWF in the properties panel of DW and have the movie load on my website (it is missing).  I can change the width to 100% and the height to any size (100 to 2000 px) and the movie will fit horizontally all the way across my screen but is either to short or to tall vertically, respectively.
    I can change all kinds of parameters (adding or deleting) and get the same result.  I see a lot of conversation about this in the forums but not a straight forward fix for the non-java types. I have changed alot of info for the tags inculding padding and margin to 0 and height and width to 100%.
    I am using DW CS5.  Any suggestions?
    Thanks,
    Randy

    Hi
    Setting height and width to 100% -
    In some browsers it will work, to some degree, in others it will not without a little JavaScript and/or resizing the page,
    For an example of resizing swf to the page, (try this in various browsers, to see how they differ, and that all do) - http://www.pziecina.com/design/turorial_demos/autoresize_flash.php. View source to see how it is done.
    PZ

  • Manually trigger the responsive resize method

    I am building slide type webpage, and each slide is set to display: none, and removed from view until the viewer hits the button to slide to the next or previous slide. Edge compositions set there do play, but they do no resize accordingly when the viewer slides over. Does the Edge JavaScript API allow for us to externally trigger the resizing of Edge compositions?

    Hemanth Kumar,
    Thanks for the reply! I went and tested what you suggested, but unfortunately nothing actually happens to resizing the Edge composition — unless I physically resize the browser window with my mouse. Triggering it via JavaScript does not  resize the composition.
    To explain a bit more about the issue: The Edge composition does this weird behavior only when, the composition is loaded, I move to the next slide (the previous slide with the active Edge composition) is set to display: none. Now, on the new slide, I resize the browser window, and then move back to the previous slide (now set to display: block). This results in the Edge composition being scaled very small, until I resize the browser with my mouse then it rescales back to full size (fit its parent container).
    Any suggestions or thoughts? Thanks.

  • Opening SWF to its exact size in HTML (ASP page)

    Hi,
    I have one popup window to open any SWF. User clicks a button
    from some other page and the file name is passed to this popup
    window through parameter. The popup window itself is sized at 100%
    to accomodate with any SWF file.
    For the SWF object, if width and height parameters are
    missing, the animation has a default size, if width and height are
    specified at 100%, the animation is resized much bigger...
    Is it possible to find the exact size of the SWF (either by
    VBScript or Javascript) and to resize the control to its original
    size, either using VB variables when the page is built or with
    Javascript once the page is loaded ?
    Many thanks for your help
    Jean-Pierre

    I found the solution.
    Many thanks for your help
    Jean-Pierre

Maybe you are looking for

  • Is  there any another BI tools ( other than  Mltiprovider / Infoset )  for

    For connecting two different information .. of two cubes  with a single matching columb , Multiprovoider / Infoset Is there is any another tool  ? Thanks Regards Sanjeev Kumar

  • 1560 series prints only error message?

    Wireless printing was working fine, then all of a sudden, if I attempt to print the printer prints a page with the following: PCL XL Error Subsystem: KERNEL Error: IllegalTag File Name: Kernel.c Line Number: 1921 The "Error" line is not always the sa

  • Apex IR Page

    Dear All, I have an IR in which the data runs to multiple pages. Below, the page number is displayed for navigation. I have another report which is a popup based on a link in the previous report. I move to page say 30 and click on the link and the da

  • Incident/Accident Log - Create description field in new tab page

    Dear all, I have a question about Incident/Accident Log. In the Incident/Accident Log, a new tab page and fields inside it can be created using class and characteristics, respectively. The characteristic value field is limited to 30 characters length

  • Slow NWDS Startup for 7.0.9

    Hi I just installed NWD Studio 7.0.9 and it takes about 5 minutes or more to come up compared to 2.0.18 which was almost instantly Anybody have any idea what the reasoning is  for that. Also there is a new option called NWDS Console. I'm looking for