SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    A js quickie, javascript accpet/decline

    I want to create a page similar to that seen when you accept the license agreement in installing software.

    An agreement will be in a text box and the user will have to check a radiobutton to say that they accept/decline the agreement and are redirected accordingly.

    I know that this will be incredibly easy for you out there so thanks in advance

  2. #2
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    UK
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Haven't heard of this ability in JavaScript.

    Alerts (boxes with text and an exclamation mark icon) can be made like this:

    Code:
    alert("Some text for the box")
    Prompts allow user imput, for example, to let the user assign a value to a variable:

    Code:
    var variableName = prompt("Type something in", "Something")
    Confirm is a yes/no box, basically constructed as:

    Code:
    confirm("Do you like my site")
    That's all the 'boxes' allowed in JavaScript to the best of my knowledge.

    There are some dialogues, but I doubt that's what you're after.

  3. #3
    Gone!
    Join Date
    Aug 2001
    Location
    Witty Location Parody
    Posts
    3,889
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I probably wasnt clear in my explanation but the text box containing the license wiould be purely cosmetic. All I really want is that if a certain radio button is checked and a 'submit' or next button is clicked then then the user is taken to another page, but id they check another box, i.e. they dont except the licence, then they are taken to another page.

    Thanks

  4. #4
    ********* obeah makeda's Avatar
    Join Date
    Jun 2001
    Location
    rollin' on dubs
    Posts
    492
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i don't know what browser support is for this method but i know it works with IE5.5:

    var oOut = new Object();
    oOut = window.showModalDialog('../yourUrl,html',dialogArguements,displayAttributes-width, height, help button etc.);

    all you need to do is create the page you want and load it into one of these. it has the same effect as a modal window by disabling everything under it. i usually pass the dialog arguments as an object. when the user clicks submit, save the value of the radio button in an onClick event:

    oOut.returnVal = document.myForm.myRadioButton.value;
    window.close();

    your main page will now be able to use this value:

    if(oOut.returnVal == 'yes') {
    document.location = "page1.html";
    }
    else {
    document.location = "page2.html";

    }
    Last edited by makeda; Sep 14, 2001 at 13:08.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •