Avatar billede spg10 Nybegynder
10. november 2003 - 06:46 Der er 4 kommentarer og
1 løsning

vindue der åbner

<!-- TWO STEPS TO INSTALL WINDOWS BUTTONS:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  fz@galeza.com (Paco Zarabozo A.) -->
<!-- Web Site:  http://galeza.com -->
<!-- Begin
var button = new Array();
var action = new Array();
var buttonWidth = new Array();

/////////////////////////////////////////////////////////////////////////////
/////////////////////// BEGIN OF EDITABLE SECTION ///////////////////////////
/////////////////////////////////////////////////////////////////////////////

// Edit this for your buttons text and actions.
// You can add or remove as much buttons as you want.
// Just be sure to use "button[number]", "buttonWidth[number]" and "action[number]"
//     for each button, using the same button number for the three variables!
//
// Text format is: '...text...<u>underlined_letter</u>...text...';
// Important: Underline just ONE letter and be very carefull from
//     NOT to use the same letter for more than one button!!
// Try also not to use letters that already have a function under
//      the browser (i.e. If you use "e", you'll activate your button
//    AND the already asigned combination for "EDIT" menu.)
//
// In the time you need to refer to some button on other scripts, each button
//    has an id based on "bnumber". For example, button 1 has the id "b1".
//
// Let's use 5 buttons for this example:

button[1] = 'Ente<u>r</u> our site';
buttonWidth[1] = 150;    //This is the button's width, in pixels.
action[1] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com');
    // End of actions for button 1.
}

button[2] = 'Suscribe to our <u>n</u>ewsletter';
buttonWidth[2] = 150;    //This is the button's width, in pixels.
action[2] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com');
    // End of actions for button 1.
}

button[3] = '<u>C</u>heck your mail at yahoo.com';
buttonWidth[3] = 150;    //This is the button's width, in pixels.
action[3] = function () {
    // Place here you actions for button 1:
    window.open('http://javascripts.com');
    // End of actions for button 1.
}

button[4] = 'Tel<u>l</u> a friend';
buttonWidth[4] = 150;    //This is the button's width, in pixels.
action[4] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com');
    // End of actions for button 1.
}

button[5] = 'View <u>s</u>ource code';
buttonWidth[5] = 150;    //This is the button's width, in pixels.
action[5] = function () {
    // Place here you actions for button 1:
location.href='view-source:http://javascript.internet.com';
    // End of actions for button 1.
}

///////////////////////////////////////////////////////////////////////////
/////////////////////// END OF EDITABLE SECTION ///////////////////////////
///////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
//            Don't edit bellow or you could get errors!          //
////////////////////////////////////////////////////////////////////////////

function placeButton(value) {
    if (button[value]) {
        if (button[value].indexOf('<u>') != -1) {
            document.write('<button id="b'+value+'" style="Width : '+buttonWidth[value]+'px ; Height : 22px" onClick="action['+value+']()"><font face="MS Sans Serif" size="1">'+button[value]+'</button>');
        } else {
            alert('You didn\'t specify the underlined letter for the button number '+value+'. This button cannot be placed until you specify the underlined letter by using <u> and </u> tags.');
        }
    } else {
        alert('You are trying to place the button number '+value+', but you didn\'t declare its values on the variables area. \r\rThe button '+value+' will not be placed until you specify the variables "button['+value+']" and "action['+value+']".');
    }
}

document.write('<script'+'>');
document.write('function myfocus(n) {');
for (a=1; a<button.length; a++) {
    document.write('if (n=='+a+') {document.all.b'+a+'.focus()}');
}
document.write('}');
document.write('<'+'/script>');

function chkKey(evt) {
    var mykey, alt, ctrl, shift;
    if (window.Event) {
        mykey = evt.which;
        alt = (evt.modifiers & Event.ALT_MASK) ? true : false;
        ctrl = (evt.modifiers & Event.CONTROL_MASK) ? true : false;
        shift = (evt.modifiers & Event.SHIFT_MASK) ? true : false;
    } else {
        mykey = evt.keyCode;
        alt = evt.altKey;
        ctrl = evt.ctrlKey;
        shift = evt.shiftKey;
    }
    if (mykey!=0 && mykey!=16 && mykey!=17 && mykey!=18) {
        if (alt) {
            for (i=1; i<button.length; i++) {
                ui = button[i].indexOf('<u>');
                ul = button[i].substring(ui + 3, ui + 4).toLowerCase();
                if (String.fromCharCode(mykey).toLowerCase() == ul) {
                    myfocus(i);
                    action[i]();
                    break;
                }
            }
        }
    }
    return true;
}
if (window.Event) {
    document.captureEvents(Event.KEYDOWN);
    document.onkeydown = chkKey;
} else {
    document.onkeydown = function() {
        return chkKey(event);
    }
}
//  End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<!-- STEP TWO: Insert in the desired place for the button "<script>placeButton(number)</script>" for each declared button as follows: -->

<script>placeButton(1)</script>            <br>
<script>placeButton(2)</script>            <br>
<script>placeButton(3)</script>            <br>
<script>placeButton(4)</script>            <br>
<script>placeButton(5)</script>            <br>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>



hvordan for jeg den til at åbne i samme vindue
Avatar billede heavybreezer Nybegynder
10. november 2003 - 08:10 #1
<!-- TWO STEPS TO INSTALL WINDOWS BUTTONS:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  fz@galeza.com (Paco Zarabozo A.) -->
<!-- Web Site:  http://galeza.com -->
<!-- Begin
var button = new Array();
var action = new Array();
var buttonWidth = new Array();

/////////////////////////////////////////////////////////////////////////////
/////////////////////// BEGIN OF EDITABLE SECTION ///////////////////////////
/////////////////////////////////////////////////////////////////////////////

// Edit this for your buttons text and actions.
// You can add or remove as much buttons as you want.
// Just be sure to use "button[number]", "buttonWidth[number]" and "action[number]"
//    for each button, using the same button number for the three variables!
//
// Text format is: '...text...<u>underlined_letter</u>...text...';
// Important: Underline just ONE letter and be very carefull from
//    NOT to use the same letter for more than one button!!
// Try also not to use letters that already have a function under
//      the browser (i.e. If you use "e", you'll activate your button
//    AND the already asigned combination for "EDIT" menu.)
//
// In the time you need to refer to some button on other scripts, each button
//    has an id based on "bnumber". For example, button 1 has the id "b1".
//
// Let's use 5 buttons for this example:

button[1] = 'Ente<u>r</u> our site';
buttonWidth[1] = 150;    //This is the button's width, in pixels.
action[1] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com', '_self');
    // End of actions for button 1.
}

button[2] = 'Suscribe to our <u>n</u>ewsletter';
buttonWidth[2] = 150;    //This is the button's width, in pixels.
action[2] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com');
    // End of actions for button 1.
}

button[3] = '<u>C</u>heck your mail at yahoo.com';
buttonWidth[3] = 150;    //This is the button's width, in pixels.
action[3] = function () {
    // Place here you actions for button 1:
    window.open('http://javascripts.com');
    // End of actions for button 1.
}

button[4] = 'Tel<u>l</u> a friend';
buttonWidth[4] = 150;    //This is the button's width, in pixels.
action[4] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com');
    // End of actions for button 1.
}

button[5] = 'View <u>s</u>ource code';
buttonWidth[5] = 150;    //This is the button's width, in pixels.
action[5] = function () {
    // Place here you actions for button 1:
location.href='view-source:http://javascript.internet.com';
    // End of actions for button 1.
}

///////////////////////////////////////////////////////////////////////////
/////////////////////// END OF EDITABLE SECTION ///////////////////////////
///////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
//            Don't edit bellow or you could get errors!          //
////////////////////////////////////////////////////////////////////////////

function placeButton(value) {
    if (button[value]) {
        if (button[value].indexOf('<u>') != -1) {
            document.write('<button id="b'+value+'" style="Width : '+buttonWidth[value]+'px ; Height : 22px" onClick="action['+value+']()"><font face="MS Sans Serif" size="1">'+button[value]+'</button>');
        } else {
            alert('You didn\'t specify the underlined letter for the button number '+value+'. This button cannot be placed until you specify the underlined letter by using <u> and </u> tags.');
        }
    } else {
        alert('You are trying to place the button number '+value+', but you didn\'t declare its values on the variables area. \r\rThe button '+value+' will not be placed until you specify the variables "button['+value+']" and "action['+value+']".');
    }
}

document.write('<script'+'>');
document.write('function myfocus(n) {');
for (a=1; a<button.length; a++) {
    document.write('if (n=='+a+') {document.all.b'+a+'.focus()}');
}
document.write('}');
document.write('<'+'/script>');

function chkKey(evt) {
    var mykey, alt, ctrl, shift;
    if (window.Event) {
        mykey = evt.which;
        alt = (evt.modifiers & Event.ALT_MASK) ? true : false;
        ctrl = (evt.modifiers & Event.CONTROL_MASK) ? true : false;
        shift = (evt.modifiers & Event.SHIFT_MASK) ? true : false;
    } else {
        mykey = evt.keyCode;
        alt = evt.altKey;
        ctrl = evt.ctrlKey;
        shift = evt.shiftKey;
    }
    if (mykey!=0 && mykey!=16 && mykey!=17 && mykey!=18) {
        if (alt) {
            for (i=1; i<button.length; i++) {
                ui = button[i].indexOf('<u>');
                ul = button[i].substring(ui + 3, ui + 4).toLowerCase();
                if (String.fromCharCode(mykey).toLowerCase() == ul) {
                    myfocus(i);
                    action[i]();
                    break;
                }
            }
        }
    }
    return true;
}
if (window.Event) {
    document.captureEvents(Event.KEYDOWN);
    document.onkeydown = chkKey;
} else {
    document.onkeydown = function() {
        return chkKey(event);
    }
}
//  End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<!-- STEP TWO: Insert in the desired place for the button "<script>placeButton(number)</script>" for each declared button as follows: -->

<script>placeButton(1)</script>            <br>
<script>placeButton(2)</script>            <br>
<script>placeButton(3)</script>            <br>
<script>placeButton(4)</script>            <br>
<script>placeButton(5)</script>            <br>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
Avatar billede heavybreezer Nybegynder
10. november 2003 - 08:33 #2
Hovsa!
Så lige der var flere. Denne kode, er den du skal bruge:


<!-- TWO STEPS TO INSTALL WINDOWS BUTTONS:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the last code into the BODY of your HTML document  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  fz@galeza.com (Paco Zarabozo A.) -->
<!-- Web Site:  http://galeza.com -->
<!-- Begin
var button = new Array();
var action = new Array();
var buttonWidth = new Array();

/////////////////////////////////////////////////////////////////////////////
/////////////////////// BEGIN OF EDITABLE SECTION ///////////////////////////
/////////////////////////////////////////////////////////////////////////////

// Edit this for your buttons text and actions.
// You can add or remove as much buttons as you want.
// Just be sure to use "button[number]", "buttonWidth[number]" and "action[number]"
//    for each button, using the same button number for the three variables!
//
// Text format is: '...text...<u>underlined_letter</u>...text...';
// Important: Underline just ONE letter and be very carefull from
//    NOT to use the same letter for more than one button!!
// Try also not to use letters that already have a function under
//      the browser (i.e. If you use "e", you'll activate your button
//    AND the already asigned combination for "EDIT" menu.)
//
// In the time you need to refer to some button on other scripts, each button
//    has an id based on "bnumber". For example, button 1 has the id "b1".
//
// Let's use 5 buttons for this example:

button[1] = 'Ente<u>r</u> our site';
buttonWidth[1] = 150;    //This is the button's width, in pixels.
action[1] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com', '_self');
    // End of actions for button 1.
}

button[2] = 'Suscribe to our <u>n</u>ewsletter';
buttonWidth[2] = 150;    //This is the button's width, in pixels.
action[2] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com', '_self');
    // End of actions for button 1.
}

button[3] = '<u>C</u>heck your mail at yahoo.com';
buttonWidth[3] = 150;    //This is the button's width, in pixels.
action[3] = function () {
    // Place here you actions for button 1:
    window.open('http://javascripts.com', '_self');
    // End of actions for button 1.
}

button[4] = 'Tel<u>l</u> a friend';
buttonWidth[4] = 150;    //This is the button's width, in pixels.
action[4] = function () {
    // Place here you actions for button 1:
    window.open('http://javascript.internet.com', '_self');
    // End of actions for button 1.
}

button[5] = 'View <u>s</u>ource code';
buttonWidth[5] = 150;    //This is the button's width, in pixels.
action[5] = function () {
    // Place here you actions for button 1:
location.href='view-source:http://javascript.internet.com';
    // End of actions for button 1.
}

///////////////////////////////////////////////////////////////////////////
/////////////////////// END OF EDITABLE SECTION ///////////////////////////
///////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////////
//            Don't edit bellow or you could get errors!          //
////////////////////////////////////////////////////////////////////////////

function placeButton(value) {
    if (button[value]) {
        if (button[value].indexOf('<u>') != -1) {
            document.write('<button id="b'+value+'" style="Width : '+buttonWidth[value]+'px ; Height : 22px" onClick="action['+value+']()"><font face="MS Sans Serif" size="1">'+button[value]+'</button>');
        } else {
            alert('You didn\'t specify the underlined letter for the button number '+value+'. This button cannot be placed until you specify the underlined letter by using <u> and </u> tags.');
        }
    } else {
        alert('You are trying to place the button number '+value+', but you didn\'t declare its values on the variables area. \r\rThe button '+value+' will not be placed until you specify the variables "button['+value+']" and "action['+value+']".');
    }
}

document.write('<script'+'>');
document.write('function myfocus(n) {');
for (a=1; a<button.length; a++) {
    document.write('if (n=='+a+') {document.all.b'+a+'.focus()}');
}
document.write('}');
document.write('<'+'/script>');

function chkKey(evt) {
    var mykey, alt, ctrl, shift;
    if (window.Event) {
        mykey = evt.which;
        alt = (evt.modifiers & Event.ALT_MASK) ? true : false;
        ctrl = (evt.modifiers & Event.CONTROL_MASK) ? true : false;
        shift = (evt.modifiers & Event.SHIFT_MASK) ? true : false;
    } else {
        mykey = evt.keyCode;
        alt = evt.altKey;
        ctrl = evt.ctrlKey;
        shift = evt.shiftKey;
    }
    if (mykey!=0 && mykey!=16 && mykey!=17 && mykey!=18) {
        if (alt) {
            for (i=1; i<button.length; i++) {
                ui = button[i].indexOf('<u>');
                ul = button[i].substring(ui + 3, ui + 4).toLowerCase();
                if (String.fromCharCode(mykey).toLowerCase() == ul) {
                    myfocus(i);
                    action[i]();
                    break;
                }
            }
        }
    }
    return true;
}
if (window.Event) {
    document.captureEvents(Event.KEYDOWN);
    document.onkeydown = chkKey;
} else {
    document.onkeydown = function() {
        return chkKey(event);
    }
}
//  End -->
</script>

</HEAD>

<!-- STEP TWO: Copy this code into the BODY of your HTML document  -->

<BODY>

<!-- STEP TWO: Insert in the desired place for the button "<script>placeButton(number)</script>" for each declared button as follows: -->

<script>placeButton(1)</script>            <br>
<script>placeButton(2)</script>            <br>
<script>placeButton(3)</script>            <br>
<script>placeButton(4)</script>            <br>
<script>placeButton(5)</script>            <br>

<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>
Avatar billede spg10 Nybegynder
10. november 2003 - 16:07 #3
det var sq da utroligt så gode alle er
1000tak du er sq da god til javascript
Avatar billede heavybreezer Nybegynder
10. november 2003 - 16:53 #4
Hm.. Tja, man lærer jo med tiden :)
(Jeg har lagt et svar ;))
Avatar billede spg10 Nybegynder
10. november 2003 - 17:16 #5
ups nåå ja
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester