Randomizer help (javascript)

I am using iweb to create a website to conduct an experiment for a class. I need to link the first page to one of two different pages at random, so as my participants are equally subjected to both experimental conditions. I have tried using the following javascript: <script type="text/javascript" language="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! <a class="jive-link-external-small" href="http://javascript.internet.com">http://javascript.internet.com</a> -->
<!-- Begin
function go_to(url) {
window.location=url;
function rand_link() {
var a;
a = 1+Math.round(Math.random()*3); ? // a = random number between 1-2
if (a==1) goto("http://web.me.com/clarajsimpson/Claras_BiologySurvey/Ants.html");
if (a==2) go_to(" <a class="jive-link-external-small" href="http://web.me.com/clarajsimpson/ClarasBiology_Survey/Sugar_Gliders.html">http://web.me.com/clarajsimpson/Claras_Biolog y_Survey/SugarGliders.html</a>");
// End -->
</script>
<center>
<form name="myForm"><input type="button" name="myButton" value="click here"></form>
</center>
<center>Free JavaScripts provided
by The JavaScript Source</center>
however this only creates a small window in the middle of the screen that cannot be made any bigger. Is there any other way I could do this? Thanks, Clara

however this only creates a small window in the middle of the screen that cannot be made any bigger
Drag the handles of the Snippet after clicking Apply. Or embed the code in a <div> with style="width: nnpx; height: nnpx;" and other attributes.
Besides that, I doubt the code will work. The form has no code to trigger the JavaScript and if it has the page will be displayed in the HTML Snippet. Try this :
parent.window.location=url;
You may have to learn HTML/CSS/JavaScript.
But that is not an iWeb issue.
Message was edited by: Wyodor

Similar Messages

  • Seeking Pdf form help - javascript formula to auto-populate fields based on data from other fields.

    Hi there, I am new to PDF form work, and am wondering if someone could help me with a javascript formula.
    I want to auto-populate the EXPIRYDATE field, as the same date as the entered AUTHORIZATIONDATE field, but 4 years later.
    So, I want to be able to enter 11/14/2014 in the AUTHORIZATIONDATE date, and have 11/14/2018 auto populate in the EXPIRYDATE field.
    Seems simple I know, but I've messed around quite a bit and can't seem to make it work. Is this possible??
    Any help would be very much appreciated!!

    And what have you done?
    This can only be done with custom JavaScript programing.
    The value of date type fields are text field and not numeric data. The first task is to convert the dates to a number on some type of number sequence that is a mapping to dates.
    Have you looked at the Acrobat JavaScript API Reference, the MDN JavaScript reference?
    I would use the Acrobat JavaScript util.scand to covert the date string to the number of milliseconds from January 1, 1970 midnight. and then use the getFullYear method of the date object for the year value and add 4 years to that value and then use the setFullYear method to set the year for the date object. Now you can use the util.printd method to format the date object as a date string with a specific format.
    // get the date value, format of date string and years to add;
    var cDate = "11/14/2014"; // date value;
    var cFormat = "mm/dd/yyyy"; // date format;
    var nYears = 4; // years to add;
    // convert date string to date object;
    var oDate = util.scand(cFormat, cDate);
    if(oDate == null) {
    app.alert("Error converting " + cDate + " using format " + cFormat, 0, 1);
    // add years to date object;
    oDate.setFullYear(oDate.getFullYear() + nYears);
    // display result;
    var cExpireyDate = util.printd(cFormat, oDate);
    app.alert("Authorization Date: " + cDate + "." +
    "\nExpire Date: " + cExpireyDate, 3, 0);

  • Help JavaScript Browser Detection for CSS

    Hi Guys,
    I have developed this online catalogue using php/mysql. The site works 100% in firefox and chrome but does not seem to work in IE, any version. I used spry dropdown menu and the menu works but the menu css gets dropped by IE. I am looking for a small javascript script which will detect the browser and should the browser be IE it should use different colors for the CSS.
    I am not skilled in Javascript at all so any help would be great.
    Thanks Guys,
    Owen

    As Ken has stated, a link to your site will allow us to have a look at the code.
    In the meantime I can only guess that you have changed the background of the menu items and left the background for IE untouched as in
    @media screen, projection
        ul.MenuBarHorizontal li.MenuBarItemIE
            display: inline;
            f\loat: left;
            background: #FFF;
    Gramps

  • HELP: Javascript dropdown menu

    Hi all,
    i am currently developing a website which is all ready to be
    uploaded but
    cant because of a javascript dropdown menu.. I have a flash
    slideshow in the
    center and on the rightside are 6 images (mainlinks) one
    below the other.
    Some of these mainlinks have sublinks which need to be
    displayed as
    dropdowns. The dropdown needs to be as Javascript for easy
    future
    changes/additions and not in flash.
    I visited many websites - javascripts.com / simplythebest /
    dynamicdrive
    /hotscripts and many other sites..but failed to find a
    suitable, easily
    editable and compatible script..
    REQUIREMENT -
    1) dropdown menu on image Mousever
    2) The script should have/allow to set the respective x,y
    (left,top) values
    which some scripts lack.
    3) Compatible for IE and Firefox
    The only 1 compatible and easy editable script i had was
    mm_menu by Andy
    Finnell. But sadly the script is missing something and giving
    errors.
    PLEEASE HELP//
    thanx

    if you're using flash 8 you can use the externalinterface
    class. otherwise, the best you can do is very much browser
    dependent.

  • HELP - JavaScript error on Rollover Image

    Hello Everyone,
    I am really enjoying working with Dreamweaver until errors
    like the following come up. Could someone please help me!!
    The error reads:
    "While executing onLoad in Rollover.htm the following
    JavaScript error occured:
    In file "Rollover";
    Reference Error: initializeUI is not defined.
    How do I solve this?????

    You can try this simple fix -
    Quit DW.
    Find this folder -
    C:\Documents and Settings\<username>\Application
    Data\Macromedia\Dreamweaver
    8\Configuration\WinFileCache-*.dat
    (these folders are normally hidden - you may have to use
    Explorer > Tools >
    Folder Options to unhide them)
    or on Mac -
    Library/Application Support/Macromedia/Dreamweaver
    8/Configuration/MacFileCache-*.dat
    and delete it.
    Restart DW. Works better?
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "hmmt13" <[email protected]> wrote in
    message
    news:ekq8jc$4qj$[email protected]..
    > Hello Everyone,
    >
    > I am really enjoying working with Dreamweaver until
    errors like the
    > following
    > come up. Could someone please help me!!
    > The error reads:
    >
    > "While executing onLoad in Rollover.htm the following
    JavaScript error
    > occured:
    > In file "Rollover";
    > Reference Error: initializeUI is not defined.
    >
    > How do I solve this?????
    >
    >
    >

  • Please help JavaScript

    Hello,
    I have a blackberry curve 8320
    i don't know why but all my programs like msn and Blackberry messege are deleted of my phone,
    I want to instal blackberry app world but when i do that there comes a message that Javascript is not turnd on, I have try to find this programe on my phone but i cant seem to find it,.
    Mabey it better to programe the phone again> can anybody help me with this pleas?!!

    You should be able to enable javascript from your browser under the options menu.
    BB 9810
    BB10 Alpha
    BB Playbook

  • Help Javascript related advertising

    Hi guys,
    I'm running OS X 10.8.2 and use java to access bank accounts. Lately java is having problems related to security, that's the reason why Safari has blocked it out for a few times. Today I accessed store.apple.com/br and a lot of cheap ads appeared in the middle of the page, as per attached screenshot. I noticed that If I disable Javascript, the problem goes away, but that cannot be the most plausible solution. Can I anyone help me to get this annoying advertisements out?
    Thanks,
    Emerson

    From the Safari menu bar, select
    Safari ▹ Preferences ▹ Extensions
    If any extensions are installed, disable them and test.

  • I used to run this scrip before updating my FireFox and it worked fine, now it is not working, plz help javascript:%20void%200

    I used to use this Java Scrip before updating my FireFox
    now its not working, the script is as under
    javascript:%20void%200
    this script open more then 50 pages in sequence as per the http addresses given on few web pages.
    please help

    All I am trying to do is enable "one click" functions for downloading gifts on Farmtown. I am on Windows Vista; have upgraded to Firefox5; updated Java today. When I try to download stuff from www.farmtown-links.com, a tab appears with "javascript:%20void%200" I have NO IDEA what this all means...I need an easy fix, PLEASE. I know a lot of FT people are going to this site. I have also added this addon: http://www.grizzlyape.com/addons/multilinks/. Still no luck. Even though some claim Chrome works better, I am still a happy camper w/Firefox and hardly ever use IE.

  • Help : Javascript in report template

    Hi,
    I created a report template named "MyFirstTemplate". In this template I use javascript to print an optionnel field named "COMMENTARY" when it is not empty here is the code :
    <br><br>
    <script language="javascript"><br>
    if("#COMMENTARY#" != " - ") // because null caracter is replaced by " - "<br>
    {     <br>
    document.writeln('<tr>')<br>
    document.writeln('<td class="t2data" colspan=6>')<br>
    document.writeln('<font color="#7E587E#"><b>Commentary: </b></font>') <br>
    document.writeln('#COMMENTARY#')<br>
    document.writeln('</td>')<br>
    document.writeln('</tr>')<br>
    }<br>
    </script><br>
    <br><br>
    My problem is :<br>
    1. When commentary have " ' " caracter like : " It's a good deal ", I will have an error message like : ")" is missing on line... <br>
    I guess it's on this line : document.writeln('#COMMENTARY#') .
    Does anybody knows how to fix it ?
    <br><br>
    2. How can I know if the field is empty without using this " - " in
    if("#COMMENTARY#" != " - ") ?<br><br>
    Thanks a lot.<br>
    Benn

    Thank you ageller1, it works.
    <br><br>
    I use this :<br><br>
    if(escape("#COMMENTARY#") != " - "){<br>
    . . . <br>
    var Commentary_esc = escape("#COMMENTARY#") <br>
    ...<br>
    document.writeln('Commentary : ', unescape(Commentary_esc))<br>
    ...<br>
    }<br><br>
    Tks a lot<br>
    Benn

  • Help:Javascript on OA page

    Hi,
    I am using javascript to open a popup window when i click on a Button at OA page.
    In the popup window i am having a cancel button whose destination function is pointing to base page.When i click on cancel, base page is opening in popwindow only.But i want the popup window to close when i click on Cancel.
    Also there is one more button called 'Accpet' on popup window,whose destination function is set to some page 'B'.When i click on Accept page 'B' is opening in the popwindow only.Instead i want the popwindow to close and and 'B' should open as main browser window.
    Please suggest how to do it.
    Thanks,
    ashok

    Ashok,
    Have you searched through the forum threads. Mukul has provided step by step details for this kind of scenario in a couple of threads.
    --Shiv                                                                                                                                                                                                                                                                                                                   

  • Responsive gallery help (javascript issue?)

    I'm trying to add this responsive gallery to my site (http://tympanus.net/codrops/2011/09/20/responsive-image-gallery/) - I'm still working on customizing the style, but my main issue is that it's not responsive - I copied everything from the downloaded files, even tried with a clean HTML page when it failed to work within my site, but the gallery does not adjust when I resize the browser window.
    http://atenndesign.com/photos/cuba.html
    I'm not experienced in javascript but I copied those files and link paths as is... what am I missing?

    The gallery is responsive (you can test this by adding a small width to your <div class="content"> which will resize the gallery). However, your website is not. For the gallery to work, you need to make the rest of the site responsive by using % widths and preferrably no tables. There are a few posts about responsive sites in this forum or you can have a look here: http://www.smashingmagazine.com/responsive-web-design-guidelines-tutorials/

  • Help JavaScript code to form Acrobat XI

    This form must Text Field, Check box and Dropdown list. The action of this JavaScript is that when the form is saved using the options Save or File> Save As only Text Field, Check box and Dropdown list that have been used to pass Read only and NOT those that the user does not use.
    What you want to achieve with this action is:
    Save the data written to it can not be edited.
    Allow user to finish filling out the form on another occasion.
    The JavaScript that follows requires me to put in the Dropdown list as default value (Select  one) otherwise all the passes to Read only and the user can no longer use those that I do not use at the time of storage. Otherwise, it works great.
    for (var i=0; i<this.numFields; i++) { 
        var f = this.getField(this.getNthFieldName(i));
        if (f==null) continue; 
        if (f.type=="button") continue; 
        if (f.readonly==false && f.value!=f.defaultValue) { 
            f.readonly = true; 
    Please, I need to correct this JavaScript to NOT force me to put the default (Select one) in the drop down lists and run this action only in those in which the user select an option from the list.
    Thanks to all who work in this forum.

    You cannot create a dropdown value as a null string using the UI.
    Have you considered using the default values of a field instead of the null stirng?
    How well does your script deal with buttons?

  • HELP -- javascript failing when enabled

    A few days after upgrading to 10.4.9:
    Safari hangs and then crashes on any site using javacript such as the New York Times. If I disable javascript, then such pages will load. Of course, many pages, such as Fidelity, will not work.
    Hoping to get a new load of javascript, i download and installed Safari 3 beta. It behaves the same way.
    So -- when javascript is screwing-up -- how can it be fixed?
    I downloaded the newest javascript and it claims it can't be installed.
    This exact same problem many others are reporting.
    Message was edited by: Steve Mullen

    Solved. Not java at all. Although I did learn a lot about java by replacing everything.
    Seems CS3 loads a flash plug-in that conflicts with one that was previously installed. I deleted the old one and kept the one that came with CS3.

  • Help Javascript

    Hello All-
    I have a for field in a loop

    Solved. Not java at all. Although I did learn a lot about java by replacing everything.
    Seems CS3 loads a flash plug-in that conflicts with one that was previously installed. I deleted the old one and kept the one that came with CS3.

  • HELP: Javascript online form not submitting from dynamic html site

    See attached code

    Here's the php input form:
    <title>Apply Online -
    Purchase.</title><p>(?php
    </p>
    <p>$mail_to = "[email protected]"; </p>
    <p>$mail_subject = "Apply Online - Purchase.";
    </p>
    <p>mail_body = "You have got a new mail by form:\Apply
    Online - Purchase."; </p>
    <p>if (isset($Loan_Officer_Name)==1) $mail_body .=
    "Loan_Officer_Name: $Loan_Officer_Name\n"; </p>
    <p>if (isset($Best_Time_To_Call)==1) $mail_body .=
    "Best_Time_To_Call: $Best_Time_To_Call\n"; </p>
    <p>if (isset($Borrower)==1) $mail_body .= "Borrower:
    $Borrower\n"; </p>
    <p>if (isset($Borrower_DOB)==1) $mail_body .=
    "Borrower_DOB: $Borrower_DOB\n"; </p>
    <p>if (isset($Borrower_SS)==1) $mail_body .=
    "Borrower_SS: $Borrower_SS\n"; </p>
    <p>if (isset($Co_Borrower)==1) $mail_body .=
    "Co_Borrower: $Co_Borrower\n"; </p>
    <p>if (isset($Co_Borrower_DOB)==1) $mail_body .=
    "Co_Borrower_DOB: $Co_Borrower_DOB\n"; </p>
    <p>if (isset($Co_Borrower_SS)==1) $mail_body .=
    "Co_Borrower_SS: $Co_Borrower_SS\n"; </p>
    <p>if (isset($Borrower_Address)==1) $mail_body .=
    "Borrower_Address: $Borrower_Address\n"; </p>
    <p>if (isset($Borrower_Home_Phone)==1) $mail_body .=
    "Borrower_Home_Phone: $Borrower_Home_Phone\n"; </p>
    <p>if (isset($Borrower_City)==1) $mail_body .=
    "Borrower_City: $Borrower_City\n"; </p>
    <p>if (isset($Borrower_State)==1) $mail_body .=
    "Borrower_State: $Borrower_State\n"; </p>
    <p>if (isset($Borrower_Zip)==1) $mail_body .=
    "Borrower_Zip: $Borrower_Zip\n"; </p>
    <p>if (isset($Borrower_Cell_Phone)==1) $mail_body .=
    "Borrower_Cell_Phone: $Borrower_Cell_Phone\n"; </p>
    <p>if (isset($email)==1) $mail_body .= "email:
    $email\n"; </p>
    <p>if (isset($Borrower_Cell_Phone)==1) $mail_body .=
    "Borrower_Cell_Phone: $Borrower_Cell_Phone\n"; </p>
    <p>if (isset($email)==1) $mail_body .= "email:
    $email\n"; </p>
    <p>if (isset($Borrower_Current_Employer)==1) $mail_body
    .= "Borrower_Current_Employer: $Borrower_Current_Employer\n";
    </p>
    <p>if (isset($Borrower_Years_on_Job)==1) $mail_body .=
    "Borrower_Years_on_Job: $Borrower_Years_on_Job\n"; </p>
    <p>if (isset($Borrower_Position)==1) $mail_body .=
    "Borrower_Position: $Borrower_Position\n"; </p>
    <p>if (isset($Borrower_Gross_Monthly_Salary)==1)
    $mail_body .= "Borrower_Gross_Monthly_Salary:
    $Borrower_Gross_Monthly_Salary\n"; </p>
    <p>if (isset($Borrower_Work_Phone)==1) $mail_body .=
    "Borrower_Work_Phone: $Borrower_Work_Phone\n"; </p>
    <p>if (isset($Borrower_Bankruptcy)==1) $mail_body .=
    "Borrower_Bankruptcy: $Borrower_Bankruptcy\n"; </p>
    <p>if (isset($Borrower_Work_Phone)==1) $mail_body .=
    "Borrower_Work_Phone: $Borrower_Work_Phone\n"; </p>
    <p>mail($mail_to, $mail_subject, $mail_body);
    ?) </p>

Maybe you are looking for