Setting styles with javascript

getelementby('id').setAttribute lets you change a HTML objects attributes
However the style attirubute (getelementby('id').setAttribute("style","value goes here")); actually contatins many settings in what javacript sees as a single attribute.
as a result everytime i change a style setting with this i have to re-insert all of the other styles.
this is inconvinient at best.
and at worst means i have to store all of the set styles as javascript attributes and re-insert the whole lot.
is there another way of doing this
so that i can add or delete styles without the rest of the set styles being affected?

function(){return A.apply(null,[this].concat($A(arguments)))}
I_Know_Nothing_at_all wrote:
I'm confused. Are you using the getElementby to write or set an individual style for multiple elements all over a page?
I use it to set a style for an element or elements where the style is dependant on some other factor, or has to be changed in responce to an event.
CSS alone cant do this because it does not have event listenters (except for psudo events such as :hover) cannot detect the styles and setting of anything (except for media rules) and does not have any sort of evaluative functions such as IFs, CASEs and basic arithmetic.

Similar Messages

  • Setting shadow with Javascript

    For some odd reason, none of the Indesign's VBA-scripts works with InDesign CS5 anymore, maybe then reason is Office 2010 64-bit.
    Anyway, Javascript works just fine, but I'm having difficulties to write following script with JavaScript. Can anybody help?
    Simply script by setting up drop shadow for an active object.
    Set myInDesign = CreateObject("InDesign.Application")
    Set myObject = myInDesign.Selection.Item(1)
    myObject.transparencySettings.dropShadowSettings.angle=135
    myObject.transparencySettings.dropShadowSettings.opacity=33
    myObject.transparencySettings.dropShadowSettings.distance=1
    myObject.transparencySettings.dropShadowSettings.mode=2020623440
    myObject.transparencySettings.dropShadowSettings.blendMode=1852797549

    Hey!
    Here is the same code in JavaScript:
    var myObject = app.selection[0];
    with(myObject.transparencySettings.dropShadowSettings){
        angle = 135;
        opacity = 33;
        distance = 1;
        mode = ShadowMode.DROP;
        blendMode = BlendMode.NORMAL;
    Hope that helps.
    tomaxxi
    http://indisnip.wordpress.com/
    http://inditip.wordpress.com/

  • Set Date With Javascript

    I have 2 date fields, A and B.
    What I need to do is once I tab out of A, I need to set B to A+1year-1day.
    I can do this in a page process on submit with
    ADD_MONTHS(:P_A, 12)-1
    but I need this to be done on change of field A.
    Any help appreciated
    Gus

    Hi Gus,
    you need to provide the date format you are using.
    Add this to your FIELD A "html form element attributes":
    onblur="javascript:fnc_field_b(this)"Add this to your page header:
    <script>
    function fnc_field_b(v_field_a){
    /* Input: mm/dd/yyyy */
    /* Output: dd.mm.yyyy */
    /* Documentation: http://www.javascriptkata.com/2007/04/27/mastering-of-the-date-object-in-javascript/ */
    /*                http://programming.top54u.com/post/Javascript-Convert-String-to-Date.aspx            */
    /* Create date object */
    var myDate = new Date(v_field_a.value);
    /* Add 1 year */
    myDate.setDate(myDate.getDate() + 365);
    /* Create output string DD.MM.YYYY */
    /* Day */
    var myStr = (myDate.getDate() < 10 ? "0" + myDate.getDate().toString() : myDate.getDate().toString()) +  ".";
    /* Month */
        myStr = myStr + (myDate.getMonth()+1 < 10 ? "0" + (myDate.getMonth()+1).toString() : (myDate.getMonth()+1).toString()) + ".";
    /* Year */
        myStr = myStr + myDate.getFullYear().toString();
    /* Set value */
    $s('P1_FIELD_B',myStr);
    &lt;/script>Change the field P1_FIELD_B to the name of your field B name.
    Best regards,
    Tobias
    Edited by: Tobias Arnhold on Mar 7, 2011 4:44 PM

  • Printing PDF attachments with Javascript?

    I am very new to Javascript (and not a programmer) so please excuse my basic or un-correct terminology here! I've created an interactive pdf, and have set buttons (with javascript code) to print specific ranges of pages from the document. I've now been asked to have said buttons print attachments (which are also pdf's) in the same style... is this possible, and if so, does anyone have example code? The code that I used to print the page ranges, for example:
    print ({nStart: 0, nEnd: 5});
    Any assistance/guidance/help would be greatly appreciated!

    The document first has to be opened. You can do this via JavaScript with the doc.openDataObject method: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.509.html
    This method returns a doc object, which you can use with the print method to print the document. You should then use the closeDoc method to close the document, as mentioned in and demonstrated in the documentation linked to above.

  • Setting User Preferences With Javascript In Acrobat X

    Hi All,
    Is there a way thru Javascript to programatically set a value in the User Preferences?
    I am trying to create a batch sequence that exports PDFs to HTMLs. In the Acrobat X preferences, there is a conversion option that sets the option of "Run OCR If Needed" to true or false.
    Edit --> Preferences --> Convert From PDF --> HTML --> Run OCR if needed (True|False)
    Depending on conditions, I need to programtically set the value of this preference during the batch sequence before I export the document to HTML. Is this possible? Any help would be greatly appreaciated.
    Thank you,
    Teri

    There are very few user preferences that can be controlled with JavaScript, and this isn't one of them.

  • Dynamically set y axis (position) with javascript

    Hello
    I wonder if it is possible with javascript to set a y position of flowed subform in non interactive adobe form?
    For example: For a certain subform  which is inclued in (flowed) main I want to be shown at certain vertical (y) position but only in the last page at bottom of main.
    Last page I can find with
    if(xfa.layout.page(this) == xfa.layout.pageCount())
    but when changing
    this.y = "100 mm"
    it doesn't changes subform position.
    I also tried with this.y = "100in", but result is the same.
    Does anybody now a solution?

    It's not a field, it's a complete subform with a table and some texts fields, which I want to show only in last page.
    I tried changing subform to a positioned already before and changing it's y axis in javascript (tried in all events) doesn't work.
    Could it be that syntax posted in first post isn't correct?
    In that case (positioned subform) I have blank space on all pages but last one. For example, if a complete layout of a page is 100%, main 70% and subform 30%, I get 30% of blank space on all pages before last one, which I would like to avoid, so that main would be 100% in every page but last one and in the last one main should be only 70% and subform 30%.

  • Button Background style change with JavaScript

    How I can set the style of button background style with Java Script?
    Style solid, Linear-to right..............

    Here are some general examples:
    https://acrobat.com/#d=Nz29rbl-52INvXVMUBZglQ
    https://acrobat.com/#d=myCjj2hLJ5nZqiPUzO8d0w
    Hope that helps,
    Niall

  • How to set style italic when i use ole2 to deal with excel?

    hi ,every body.
    i received a requirement today,in which user want to set style italic?
    pls tell me how can i do it, tks!

    Use
    SET PROPERTY OF GS_FONT 'Italic' = '1' .

  • XML IDOC post to R/3 Via WAS - want to see error content with JavaScript

    Hi,
    I am posting XML IDOCs to our R/3 system via a webpage that I have built with JavaScript.  I am posting to the WAS, which is configured to read the XML IDOC with SAP's standard class handler CL_HTTP_IDOC_XML_REQUEST.  We are on basis 620 support pack SAPKB62041.
    In my webpage, I have the JavaScript code set to read the status and statusText so I can see the response from WAS when I post my XML IDOC.  However, I am getting back very generic information when I encounter a 409 error.  THe statusText is always "input_not_found".  So I debugged the class handler code and found that SAP is returning back the more descriptive error info in HTML format.
    I ran a packet sniffer to see what WAS returns and the info looks like this:
    <html><head><title>IDoc-XML-inbound not ok</title><h1>IDoc-XML-inbound not ok</h1></head><body>
    E:Table Lookup Error:300 Cannot map value for field MESCOD in table ZFI_IF_IDOCORG using values
    SNDSAD = |TE|  and RCVLAD = |GL|  and MESTYP = |ACC_DOCUMENT|</body></html>
    I want to know how I can get my webpage to read this HTML info and store that into an alert so I can read this text that I'm returning back to the HTTP post.
    This is how my script looks.  I'm using IE6.
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
         <title>Test XML</title>
    <SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
    <!--
    function XMLHTTPButton_onclick(DataToSend) {
         var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
         xmlhttp.Open("POST","http://some_server:1089/sap/bc/zxml_idoc?sap-client=200&sap-language=EN",false);
         xmlhttp.setRequestHeader("Content-Type", "text/xml");
         xmlhttp.send(DataToSend);
            alert(xmlhttp.Status);
            alert(xmlhttp.statusText);
         alert(xmlhttp.responseXML.xml);
    //-->
    </SCRIPT>
    </head>
    <body>
    <BR>
    This page posts to
    <BR>
    http://some_server:1089/sap/bc/zxml_idoc?sap-client=200&sap-language=EN
    <FORM name=xmlform method=post >
    <P><TEXTAREA style="WIDTH: 623px; HEIGHT: 369px" name=xmlData rows=23 cols=77>
    </TEXTAREA>
    <P>
    <INPUT type="button" value="Submit XMLHTTP" id=XMLHTTPButton name=XMLHTTPButton
    LANGUAGE=javascript onclick="return XMLHTTPButton_onclick(document.xmlform.xmlData.value)">
    </form>
    Previously with this class handler, SAP returned the detailed info back to the "alert(xmlhttp.statusText)" and I had no problem seeing the return info.  But now they have decided to format it in HTML and I don't know how to view this text since it has no ID on it to pull this into an alert box.
    If anyone has any ideas, please let me know.
    Thanks,
    Andrea

    Ok!
    I have solve the problem. So, I was trying to connect via SSO within an user that was not registered in R/3 and I forgot it.
    Sorry for the inconvenience.

  • Netui:Checkboxoption, set checked without javascript

    I am working on weblogic 8 portal and attempting to set the checkboxoption to checked when the page initially renders with the following code with style=(quotes) checked:true (quotes), sorry if i'm typing (quotes) since it's emptying it out on the forum.
    <netui:checkBoxGroup dataSource="{pageFlow.displayDocuments}">
    <%
    if (pageContext.getAttribute("isDocumentExposedToInternet").toString().equalsIgnoreCase("true")) {
    %>
    <netui:checkBoxOption value="{container.index}" tagId="chkBox" style=(quotes) checked:true (quotes) onClick="setRdoValue(this)">TRUE</netui:checkBoxOption>
    <%
    } else {
    %>
    <netui:checkBoxOption value="{container.index}" tagId="chkBox" style=(quotes) checked:true (quotes) onClick="setRdoValue(this)">FALSE</netui:checkBoxOption>
    <%
    %>
    </netui:checkBoxGroup>
    does anyone know if this is the only way to set the checkbox value? I can't really do it with javascript since i need an onclick event to access it and i need this to be checked when the page initially renders.
    thanks in advance.
    Edited by: user12959394 on May 21, 2010 7:21 AM
    Edited by: user12959394 on May 21, 2010 7:22 AM
    Edited by: user12959394 on May 21, 2010 7:22 AM

    Hi
    This is the code snippet I have that is working fine and checking the check boxes values properly.
    <netui:checkBoxGroup dataSource="actionForm.credTechHighFreq" orientation="vertical">
         <c:forEach items="${sessionScope.GRACE_LOOKUPS['Credential_High Frequency']}" var="eachHighFreq">
              <%-- workshop:varType="com.hid.iod.forms.IoDLookUpForm" --%>
                   <netui:checkBoxOption value="${eachHighFreq.iodLookUpId}">${eachHighFreq.codeDescription}</netui:checkBoxOption>
         </c:forEach>     
    </netui:checkBoxGroup>
    In above code sniippet, I have actionForm.credTechHighFreq that stores the IDs of the selected checkbox. I can check multiple checkboxes. this is the variable I have in my Form class.
    private long[] credTechHighFreq;
    The checkboxOptions are retrieved from a session variable, which is kind of lookup value which has like Id and Desc. Desc is what I show on screen. Id is the one behind the screens.
    So when I retireve this data and open the page for the very first time, if my datasource [] is having say like 1, 3, 5, these 3 checkboxes are checked.
    NOW if you want to have default values, then you need to fill the datasource [] list say with like 1, 3. So these are like default. Do this only if the list is empty. Infact I do this by adding alwasy [0] and the value wil lbe like "Please Select".
    For CheckBox or RadioButton, or SelectBoxes, always there will be like a Key/Value Pair. Like what we see next to checkbox and when we checkit or uncheckit, the datasource that is behind this visible value. Using style attribute is not the right way and may not work also. style attribute is used only for css stuff like for look and feel stuff only. You are iterating through "pageFlow.displayDocuments" and what is the object like datatype for each of these objects. Those should have like key/value paris.
    Inside a checkboxgroup, when we check any Checkbox (for now lets assume we can check only one), then the checked behind id value is what stored in the datasource attribute for checkBoxGroup. Incase if you can check multiple checkboxes, then the datasource will be Array/List of selected items.
    Incase if you can check only one option like True or False, instead of CheckBox use Radio Button.
    HTH
    Ravi Jegga

  • Open and Close Popup With Javascript

    Using Apex 3.2
    I have probably done this loads of times in my old job, but do not have access to the code and today I just can't get it to work properly.
    I have opened a pop up window with javascript
    Now I need to close it and refresh the calling page, but only if it passes the validation on the popup.
    I have a hidden item on my pop up called P7_FLAG.
    I have a page process after validation that sets P7_FLAG to (only set to 1, if passes validation).
    I also have a SUBMIT button.
    So once I click my SUBMIT button the page should look at the validations, if ok, set P7_FLAG to 1, then close the popup and refresh the calling page.
    My current javascript look like this
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>On my button
    javascript:saveChanges();The problem is that I need to click the SUBMIT button twice.
    First time it sets P7_FLAG
    Second time it closes page and refreshes.
    I have probably made some basic error, but today I cannot see it.
    Cheers
    Gus
    Edited by: Gus C on May 10, 2012 12:48 AM

    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    var test = $x('P7_FLAG').value;
    if(test == '1')
    window.close();
    window.opener.doSubmit('REFRESH');
    </script>javascript does not wait for the current action to complete and then perform the next line.
    means in your function call
    doSubmit('SUBMIT');is triggered and it carry on's to next line that is
    $x('P7_FLAG').value;this will not be set because you are setting the value of P7_FLAG to 1 in plsql and trying to check in javascript, which will not work.
    what you need to do is amend your js function like below
    <script type="text/javascript">
    function saveChanges(){
    doSubmit('SUBMIT');
    </script>create a page branch to procedure and make it conditional to when P7_FLAG = 1
    and set the branch source to below
    htp.p('window.close();');
    htp.p('window.opener.doSubmit(''REFRESH'');');

  • How to get real value from selectOneChoice with javascript?

    Hi,
    How to get real value from selectOneChoice with javascript? The event.getNewValue() only gets me the index of the selected item, not the value/title.
    JSF page:
    <af:resource type="javascript">
    function parseAddress(event)
    alert("new value: " + event.getNewValue());
    </af:resource>
    <af:selectOneChoice label="Location:" value="" id="soc4">
    <af:clientListener type="valueChange" method="parseAddress" />
    <f:selectItems value="#{Person.locations}" id="si7"/>
    </af:selectOneChoice>
    HTML :
    <option title="225 Broadway, New York, NY-10007" selected="" value="0">225 Broadway (Central Office)</option>
    <option title="90 Mark St., New York, NY-10007" value="1">90 Mark St. (Central Office)</option>
    Thanks a lot.

    Something I was missing ,
    You need to add valuePassThru="true" in your <af:selectOneChoice component. I have personally tested it and got the actual value in alert box. I hope this time you got the real solution. You can also test the following code by your end.
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:form id="f1">
    <af:panelBox text="PanelBox1" id="pb1">
    <af:selectOneChoice label="Set Log Level" id="soc1"
    value="#{SelectManagedBean.loggerDefault}"
    valuePassThru="true">
    <af:selectItem label="select one" value="First" id="s6"/>
    <af:selectItem label="select two" value="Second" id="s56"/>
    <af:clientListener method="setLogLevel" type="valueChange"/>
    </af:selectOneChoice>
    <af:resource type="javascript">
    function setLogLevel(evt) {
    var selectOneChoice = evt.getSource();
    var logLevel = selectOneChoice.getSubmittedValue();
    // var logLevelObject = AdfLogger.NONE;
    alert("new value is : " + logLevel);
    //alert(evt.getSelection);
    //alert(logLevelObject);
    evt.cancel();
    </af:resource>
    </af:panelBox>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>

  • Problem with Javascript and opening a new page

    Hi,
    I'm developping a website with Java Server Faces.
    I've a problem with JavaScript.
    I have a table, and each row of that table, has a button, to display more information about that specific row. I want to display this information in a new window. For this I want to use JavaScript.
    The new window, of course, needs some information of the other window, to show the right data.
    The first time I click the 'more-information-button', it works perfectly, but from than on, he keeps showing the same information...
    Here is my jsp-page of the first page (the one with the table):
    <?xml version="1.0" encoding="UTF-8"?>
    <jsp:root version="1.2" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:jsp="http://java.sun.com/JSP/Page">
        <jsp:directive.page contentType="text/html;charset=UTF-8" pageEncoding="UTF-8"/>
        <f:view>
             <f:loadBundle basename="languages.MessageBundle" var="bundle"/>
            <html>
                <head>
                    <meta content="no-cache" http-equiv="Cache-Control"/>
                    <meta content="no-cache" http-equiv="Pragma"/>
                    <title>- UCV-Period -</title>
                    <link href="resources/stylesheet.css" rel="stylesheet" type="text/css"/>
                </head>
                <body style="-rave-layout: grid">
                        <h:dataTable binding="#{UcvPeriod.dataTable1}" headerClass="list-header" id="dataTable1" rowClasses="list-row-even,list-row-odd" rows="5"
                            style="left: 24px; top: 168px; position: absolute" value="#{UcvPeriod.dataTable1Model}" var="currentRow">
                            <h:column binding="#{UcvPeriod.column1}" id="column1">
                                <h:outputText binding="#{UcvPeriod.outputUcvPeriod}" id="outputUcvPeriod" value="#{currentRow['UCVPERIOD']}"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText2}" id="outputText2" value="#{bundle.ucvPeriod_columnHeader_ucvPeriod}"/>
                                </f:facet>
                            </h:column>
                            <h:column binding="#{UcvPeriod.column11}" id="column11">
                                <h:commandButton action="#{UcvPeriod.btnDetails_action}" binding="#{UcvPeriod.btnDetails}" id="btnDetails" value="+" onclick="window.open('Details.jsp')"/>
                                <f:facet name="header">
                                    <h:outputText binding="#{UcvPeriod.outputText21}" id="outputText21" value=""/>
                                </f:facet>
                            </h:column>
                        </h:dataTable>
                    </h:form>
                </body>
            </html>
        </f:view>
    </jsp:root>Here is my action, when someone clicks on the 'more-information-button':
    public String bthnDetails_action() {
       Object s = outputUcvPeriod.getValue();
       BigDecimal ucvPeriod = (BigDecimal)outputUcvPeriod.getValue();
       this.getSessionBean().setUcvPeriod(new Integer(ucvPeriod.intValue());
       return "detail_ucvperiod";
    }Here is my constructor of the Detailspage.
        public Details() {
             this.txtUcvPeriod.setValue(this.getSessionBean().getUcvPeriod());
        }Here is the navigation part for this part of my faces-config.xml .
    <navigation-rule>
       <from-view-id>/UcvPeriod.jsp</from-view-id>
       <navigation-case>
           <from-outcome>detail_ucvperiod</from-outcome>
           <to-view-id>/UcvPeriod.jsp</to-view-id>
       </navigation-case>
    </navigation-rule>Thx a lot....
    Anneke

    See the tutorial "Sharing Data Between Two Pages" at http://devservices.sun.com/premium/jscreator/standard/learning/tutorials/data_sharing_twopages.html and the FAQ "How can I pass data between pages without creating SessionBean variables in Creator?" at http://devservices.sun.com/premium/jscreator/standard/reference/faqs/technical/javasource/passing_data.html. Since you can open a new window when your button is clicked, the tutorial and FAQ will explain ways to pass your data to the new window.

  • The combination of report with javascript

    Hi guys,
    I want to use report combined with javascript as follows:
    <APPLET NAME="ASMGridAppAssembly" ...
    PARAM NAME="QueryTemplate" VALUE="..../Reports/PTSD/AsmNCMFRXQuery">
    <PARAM NAME="DisplayTemplate" VALUE=".../Reports/AsmGrid">
    <param name="Param.1" value=>
    <param name="Param.2" value=>
    </APPLET>
    document.ASMGridAppAssembly.getQueryObject().setParam(3,Param3);
    document.ASMGridAppAssembly.getQueryObject().setParam(4,Param4);
    Can I achieve this?
    Thanks,
    Tony.
    Edited by: Tony Hu on Aug 8, 2008 7:07 PM

    Mike - Huh?  If javascript is called to an active applet on the page that received Param.1 and Param.2 through param overrides in the html (like shown in Tony's post) they will absolutely override any static ones that are in the query template itself.
    Tony - you need to instruct the applet to run the query with your 2 new parameters, so add this line after setting param 3 and 4:
    document.ASMGridAppAssembly.updateGrid(true);
    Regards,
    Jeremy

  • How to call hr_location_api.create_location for different address style with only those fields that belongs specific to  that address style.

    How to call hr_location_api.create_location for different address style with only those fields that belongs specific to  that address style. It should decide at run time means at run time it will come to know the type of address style and based on that only the fields which belong to address details mapped to calling hr_location_api.create_location.
    Thanks in advance.

    You can create a wrapper package on top of the API (hr_location_api.create_location)
    In the wrapper package you set all the values dynamically based on your requirements(say the style and add_line columns are populated on your conditions) and then you call the API.
    Does that not work ?

Maybe you are looking for

  • Samson C01U not working in LE8

    I can't get my Samson C01U USB microphone to work with LE8. Many others also have the same problem, while Apple stores sell both LE8 and the Samson C01U microphone. Is there someone out there that has the solution to make the microphone work with Log

  • ITunes freezing with error -50, -3259 and 9006

    Okay, so I have had a problem with iTunes freezing in relation to downloading Podcasts since around version 8.  After updating to 10.2.2 on 10.6.7, iTunes has turned into one big fail.  Downloading anything produces any of the following error codes:

  • Incorrect file size/date

    I had posted this subject about a month ago and did not get any replies... so here it is again a various times quicktime files and several other type of files will be shown as having a size of 7k but is obviously larger... when I open it... then it w

  • SQVI report

    Hi All, I wanted to make report for number of sales order created per day with plant.  On the initial screen Sales documnet, Plant, Sales org, Division, distribution channel, order type, plant, created on and created by. I have to use VBAK , VBAP tab

  • Java Programming Language, fourth edition

    Where can I get the code used in this book by Arnold, Gosling and Holmes?