Jump to content

nogray

Members
  • Posts

    930
  • Joined

  • Last visited

Posts posted by nogray

  1. You can alter the id values for the divs to include the input name as a substring and use the this.id in the input click event.

     

    e.g.

    <div id="radio1">
    <input type='radio' name='name' id='radioci1' value='yes' onclick="reveal(this.name)" ><label for='radioci1' class='yes'>Yes</label>
    <input type='radio' name='name' id='radioci2' value='no' onclick="hide(this.name)" ><label for='radioci2' class='no'>No</label>
    </div>
    
    <div id="dynamic_name" ><input type="text" name="textfield" value="" /></div>
    
    
    function reveal(id) {
    document.getElementById('dynamic_'+id).style.display="block";
    }.....
    
    

     

  2. If your site breaks when zooming, it might break when the window size is small. Try to resize the browser window and see if the design holds up.

     

    If you want pixel perfect design, you would need to set the widht and height of each div and set the overflow property to either hidden or auto (auto will add scroll bars if there is too much content).

  3. You should review the Acrobat JavaScript Scripting Reference at http://partners.adobe.com/public/developer/en/acrobat/sdk/pdf/javascript/AcroJS.pdf

     

    In Page 507, you'll find the following example,

    // get the printParams object of the default printer
    var pp = this.getPrintParams();
    // set some properties
    pp.interactive = pp.constants.interactionLevel.automatic;
    pp.colorOverride = pp.colorOverrides.mono;
    // print
    this.print(pp);
    

     

     

    You would need to review the document for details though.

  4. Hide or show a div (or any other object)

    <div id="my_div1">some text</div>
    <script>
    // hide
    document.getElementById('my_div1').style.display = 'none';
    
    // show
    document.getElementById('my_div1').style.display = '';
    </script>
    

  5. You can add on onkeypress event that will check the length of the input value and focus to the next field. You can review the example below (make sure to use the right id)

    <input type="text" onkeypress="if (this.value.length >= 5) document.getElementById('next_field').focus();" />
    <input type="text" id="next_field" />
    

  6. In you main page you'll need to add a function to add an option to the select

     

    i.e.

    function add_option(val, txt){
        var opt = document.createElement("option");
        opt.value = val;
        opt.txt = txt;
        document.getElementById('MY_SELECT_ID').appendChild(opt);
        document.getElementById('MY_SELECT_ID').selectedIndex = document.getElementById('MY_SELECT_ID').options.length - 1;
    }
    

    Not Tested

     

    In the opened window, you'll need to call this function with the text and value;

    i.e. you're using a link

    <a href="#" onclick="window.opener.add_option('some value', 'some text'); window.close();">Select Me</a>
    

    Again Not Tested.

  7. I assume you are using this for a tooltip, since each object (html element) will have it's own tip, you can simple keep the string value inside the function () (like the wrong string) for each object.

     

    Second option is to use the title attribute in the HTML element and use the "this" scope in your function to get the title

     

    for example

     

    HTML...
    <input type="text" title="Hello World" id="input_1" />
    
    Script...
    document.getElementById('input_1').onmouseover = function(e){
        showTip(e, this.title);
    };
    

    Not Tested

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.