Calling/running a javascript

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Calling/running a javascript

    This is driving me off the edge. I've downloaded a javascript from the web - a
    table sort script ([url]http://4umi.com/web/javascript/tablescroll.htm[/url]) This page
    explains exactly what to do, however I can not call this script from
    dreamweaver. I've attempted to embed the script in my page and I've tried to
    call it from the dreamweaver Actions directory (Program
    Files\Macromedia\Dreamweaver MX 2004\Configuration\Behaviors\Actions).
    Clearly, I'm an idiot...I think I do not understand how to call the script, or
    how to pass the correct variables as indicated in the above mentioned webpage.
    I'm very familiar with Dreamweaver, but not with executing canned scripts. Can
    someome help me. I only want a way to sort table columns and this script looks
    great! I am not using server based scripting so I want it to be embedded in my
    page.

    Thanks!!!
    Script-Challenged-Dude!:confused;

    Faffles Guest

  2. Similar Questions and Discussions

    1. output text in control location; calling control javascript from page javascript
      Hi; If you don't know, I'm just learning javascript and aspnet, but I have a pretty good grounding in windows programming. I'm trying to build a...
    2. Calling Javascript Functions
      Hi, I've done a function to populate a drop down list, but I cant seem to call it properly. ================== This is in the head of the...
    3. calling a web service on a standalone with no localhost running...
      is it possible to include a web service dll with your application and call its' methods without having an internet or localhost connection? I...
    4. Calling .NET Assembly from JavaScript...
      I have a requirement to call .NET assembly (Custom component) from thin client Page (ASPX). This Assembly talks only TCP/IP with an external server...
    5. Differences between running in VS and calling an ASP.Net page froma browser
      I have developed a little ASP.Net application that works fine when started in the VS IDE. However when I call it from our "home" page it doesn't...
  3. #2

    Default Re: Calling/running a javascript

    Show me your code, please.

    --
    Murray --- ICQ 71997575
    Team Macromedia Volunteer for Dreamweaver
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    [url]http://www.dreamweavermx-templates.com[/url] - Template Triage!
    [url]http://www.projectseven.com/go[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.dwfaq.com[/url] - DW FAQs, Tutorials & Resources
    [url]http://www.macromedia.com/support/search/[/url] - Macromedia (MM) Technotes
    ==================

    "Faffles" <webforumsuser@macromedia.com> wrote in message
    news:cv00s8$kta$1@forums.macromedia.com...
    > This is driving me off the edge. I've downloaded a javascript from the
    > web - a
    > table sort script ([url]http://4umi.com/web/javascript/tablescroll.htm[/url]) This
    > page
    > explains exactly what to do, however I can not call this script from
    > dreamweaver. I've attempted to embed the script in my page and I've tried
    > to
    > call it from the dreamweaver Actions directory (Program
    > Files\Macromedia\Dreamweaver MX 2004\Configuration\Behaviors\Actions).
    > Clearly, I'm an idiot...I think I do not understand how to call the
    > script, or
    > how to pass the correct variables as indicated in the above mentioned
    > webpage.
    > I'm very familiar with Dreamweaver, but not with executing canned scripts.
    > Can
    > someome help me. I only want a way to sort table columns and this script
    > looks
    > great! I am not using server based scripting so I want it to be embedded
    > in my
    > page.
    >
    > Thanks!!!
    > Script-Challenged-Dude!:confused;
    >

    Murray *TMM* Guest

  4. #3

    Default Re: Calling/running a javascript

    Here's the code in my page. Following that is the script.


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <script language="JavaScript" type="text/JavaScript">
    <!--
    function MM_callJS(jsStr) { //v2.0
    return eval(jsStr)
    }
    //-->
    onload=function(){
    initTable( 'Literature', ['number','html',null], 2 );
    }
    </script>
    </head>

    <table id="Literature" width="644" border="1">
    <tr>
    <th scope="col">Name</th>
    <th scope="col">Thumb</th>
    <th scope="col">PDF</th>
    </tr>
    <tr>
    <td>Jeff</td>
    <td>Sean</td>
    <td>Claire</td>
    </tr>
    <tr>
    <td>Ronnie</td>
    <td>Diane</td>
    <td>Eugene</td>
    </tr>
    <tr>
    <td>Mark</td>
    <td>Donna</td>
    <td>Milton</td>
    </tr>
    <tr>
    <td>Chris</td>
    <td>Henry</td>
    <td>Elaine</td>
    </tr>
    <tr>
    <td>Gerry</td>
    <td>Dorothy</td>
    <td>Marueen</td>
    </tr>
    </table>
    </body>
    </html>

    SCRIPT FOLLOWS:

    var T=[], globcol=0, globel=null;


    function initTable(id, types, first, func ) { first=first||0; func=func||0;
    T[id]={}; T[id].types=types; T[id].curcol = first; T[id].curdir = 'down';
    T[id].rank=false; T[id].func = func;
    var a = document.getElementById(id);
    var b = a.getElementsByTagName('thead')[0].getElementsByTagName('th');
    for (var i=0; i < b.length; i++) {
    b[i].style.position = 'relative';
    if(types[i]&&types[i].indexOf('rank')===0){
    addrank(id,i,types[i].substring(4)); T[id].rank=i; }
    else if(types[i]!==false) { b[i].onclick = function(){ globel=this;
    sortCursor(globel,'wait'); setTimeout('sortTable(globel);
    sortCursor(globel,\'\');',50); }; }
    }
    if(typeof window.onscroll!=='undefined'){
    window.onscroll=function(){ stickHead(id); };
    window.onresize=function(){ stickHead(id); };
    }else{
    setInterval('stickHead(\''+id+'\');',2000);
    }
    sortIndicator(b[first]); globcol = first;
    }

    function sortrank(e){
    if('string'===typeof e){e=document.getElementById(e);}
    var i, col=T[e.id].rank;
    var rows = e.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
    var newcols = new Array();
    i=rows.length; while (i--) {
    newcols[i] = rows[i].childNodes[col].cloneNode(true);
    }
    newcols.sort(compareRank);
    i=rows.length; while (i--) {
    rows[i].replaceChild(newcols[i], rows[i].childNodes[col]);
    }
    }

    function sortTable(e,col) {
    if('string'===typeof e){e=document.getElementById(e);
    if(col){e=e.getElementsByTagName('thead')[0].getElementsByTagName('th')[col];}}
    var newcol = 0; var i=e;
    if('undefined'!==typeof col){newcol=col;}else{while(i.previousSibling){
    newcol++; i=i.previousSibling; }}
    var table = e; while(table.tagName.toLowerCase()!=='table') { table =
    table.parentNode; }
    var tbody = table.getElementsByTagName('tbody')[0];
    var rows = tbody.getElementsByTagName('tr');
    var newrows = new Array();
    i=rows.length; while (i--) {
    newrows[i] = rows[i].cloneNode(true);
    }

    var
    th=table.getElementsByTagName('thead')[0].getElementsByTagName('th')[T[table.id]
    ..curcol];
    th.className = th.className.replace(' sorted','');
    for (i = th.firstChild; i !==null; i=i.nextSibling){
    if(i.src&&(/\/sort-(up|down).gif$/.test(i.src))){ th.removeChild(i);
    break; }
    }

    if (newcol === T[table.id].curcol) {
    T[table.id].curdir = T[table.id].curdir !== 'up' ? 'up' : 'down';
    newrows.reverse();
    } else {
    T[table.id].curcol = newcol; globcol=newcol;
    T[table.id].curdir = 'down';
    var how=T[table.id].types[newcol];
    if (how === 'html') {newrows.sort(compareHTML);}
    else if (how === 'number') {newrows.sort(compareNumber);}
    else if (how === 'money') {newrows.sort(compareMoney);}
    else if (how === 'time') {newrows.sort(compareTime);}
    else if (how === 'name') {newrows.sort(compareName);}
    else if (how === 'hid') {newrows.sort(compareHid);}
    else {newrows.sort(compare);}
    }
    var newtbody = document.createElement('tbody');
    for (i=0; i<newrows.length; i++) {
    newtbody.appendChild(newrows[i]);
    }
    table.replaceChild(newtbody, tbody);
    sortIndicator(e,T[table.id].curdir);
    if(typeof T[table.id].rank==='number'){sortrank(table)};
    eval(T[table.id].func);
    }

    function compare(a, b) {
    var aVal = gimmietext(a.childNodes[globcol]).toLowerCase();
    var bVal = gimmietext(b.childNodes[globcol]).toLowerCase();
    return (aVal === bVal ? 0 : trim(bVal)===''?1:(aVal > bVal ? 1 : -1));
    }
    function compareHTML(a, b) {
    var aVal = a.childNodes[globcol].innerHTML;
    var bVal = b.childNodes[globcol].innerHTML;
    return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    }
    function compareNumber(a, b) {
    var aVal = parseFloat('0'+gimmietext(a.childNodes[globcol]));
    var bVal = parseFloat('0'+gimmietext(b.childNodes[globcol]));
    return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    }
    function compareMoney(a, b) {
    var aVal = parseFloat('0'+gimmietext(a.childNodes[globcol]).substr(1));
    var bVal = parseFloat('0'+gimmietext(b.childNodes[globcol]).substr(1));
    return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    }
    function compareTime(a, b) {
    var aVal = gimmietext(a.childNodes[globcol]); while(aVal.length<9){
    aVal='0'+aVal; }
    var bVal = gimmietext(b.childNodes[globcol]); while(bVal.length<9){
    bVal='0'+bVal; }
    return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    }
    var regOLD=/(van( de(n|r)?)?|von|de(n|r|s)?|te(n|r)?|le|la)\s+/i;
    var reg=/^(van( de[nr]?)?|von|de[nrs]?|te[nr]?|l[ae])\s+/i;
    function compareName(a, b) {
    var aVal = gimmietext(a.childNodes[globcol]).replace(reg,'');
    var bVal = gimmietext(b.childNodes[globcol]).replace(reg,'');
    return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    }
    function compareHid(a, b) {
    var aVal =
    parseFloat('0'+gimmietext(a.childNodes[globcol].getElementsByTagName('span')[0])
    );
    var bVal =
    parseFloat('0'+gimmietext(b.childNodes[globcol].getElementsByTagName('span')[0])
    );
    return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    }
    function compareRank(a, b) {
    var aVal = parseInt(gimmietext(a));
    var bVal = parseInt(gimmietext(b));
    return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    }

    function sortIndicator(e, dir) {dir=dir||'down';
    e.className += ' sorted';
    var im = document.createElement('img');
    im.setAttribute('src', 'http://4umi.com/image/icon/arrow/sort-'+dir+'.gif');
    im.setAttribute('alt', dir);
    im.setAttribute('width', '8');
    im.setAttribute('height', '8');
    im.setAttribute('vspace', '1');
    im.setAttribute('hspace', '1');
    im.setAttribute('style', 'position:absolute');
    im.style.position='absolute';
    e.appendChild(im);
    }

    function stickHead(e){
    var d=document;
    var a=d.getElementById(e);
    var b=a.getElementsByTagName('thead')[0].getElementsByTagName('th');
    var y = typeof window.pageYOffset==='number' ? window.pageYOffset :
    d.documentElement && typeof d.documentElement.scrollTop==='number' ?
    d.documentElement.scrollTop : d.body.scrollTop;

    y=Math.min(a.scrollHeight-40,Math.max(0,y-a.offsetTop-parseInt(getstyle(document
    ..body,'margin-top'))));
    for(var i=0; i<b.length; i++){ b[i].style.top=y+'px'; }
    if(typeof beweeg==='function'){beweeg();}
    }

    function addrank(id,col,start){ col=col||0; start=parseInt(start)||1;
    var a = document.getElementById(id);
    var b = a.getElementsByTagName('colgroup');

    if(b&&b[0]&&b[0].childNodes[col]){b[0].insertBefore(document.createElement('col'
    ),b[0].childNodes[col]);}
    var row = a.getElementsByTagName('thead')[0].getElementsByTagName('tr')[0];
    var th=document.createElement('th');
    th.style.textAlign='center';
    th.style.position='relative';
    th.appendChild(document.createTextNode('#'));
    row.insertBefore(th,row.childNodes[col]);
    var rows = a.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
    var td=document.createElement('td');
    td.style.textAlign='right';
    td.style.fontSize='80%';
    td.style.fontFamily='\'MS Sans Serif\',Arial,sans-serif';
    var i=rows.length; while (i--) {
    th=td.cloneNode(true);
    th.appendChild(document.createTextNode((start+i)+' .'));
    rows[i].insertBefore(th,rows[i].childNodes[col]);
    }
    }

    function sortCursor(el,how){ document.body.style.cursor=how;
    el.style.cursor=how; var a=el.getElementsByTagName('a'); if(a){var i=a.length;
    while(i--){a[i].style.cursor=how; }} }

    if(typeof trim==='undefined'){ trim=function(s) {return
    s.replace(/^\s+/,'').replace(/\s+$/,'');}}

    if(typeof gimmietext==='undefined'){ gimmietext=function(node) {
    var s='';
    if(node.firstChild){
    for (var x = node.firstChild; x !==null; x=x.nextSibling) {
    if (x.nodeType === 3) {
    s += x.nodeValue;
    } else if (x.nodeType === 1) {
    s += gimmietext(x);
    }
    }
    }else if(node.nodeValue){
    s += node.nodeValue;
    }
    return s;
    }}

    if(typeof getstyle==='undefined'){ getstyle=function(el,prop){
    if(el.currentStyle){
    prop=prop.replace(/-(\w)/,function(t,a){return
    a.toUpperCase()});//backgroundColor
    return el.currentStyle[prop];
    }else if(window.getComputedStyle){
    var elstyle=window.getComputedStyle(el,'');
    return elstyle.getPropertyValue(prop);
    //background-color
    }
    }}

    Faffles Guest

  5. #4

    Default Re: Calling/running a javascript

    Hi,
    You don't need to call the script atall - this bit
    onload=function(){
    initTable( 'Literature', ['number','html',null], 2 );
    }
    will run the script when the page loads. So you can lose
    function MM_callJS(jsStr) { //v2.0
    return eval(jsStr)
    }

    I've got it working with 2 changes - first this line
    initTable( 'Literature', ['number','html',null], 2 );
    should be
    initTable( 'Literature', [null,null,null], 2 );

    Second this
    <tr>
    <th scope="col">Name</th>
    <th scope="col">Thumb</th>
    <th scope="col">PDF</th>
    </tr>
    should be
    <thead>
    <tr>
    <th scope="col">Name</th>
    <th scope="col">Thumb</th>
    <th scope="col">PDF</th>
    </tr>
    </thead>
    <tbody>
    ......your table stuff
    </tbody>

    If you want to see it running I put up your page here
    [url]http://216.119.89.70/tableScroll.htm[/url]

    Just view source and copy and paste back to your page.


    Cheers,
    Jon


    "Faffles" <webforumsuser@macromedia.com> wrote in message
    news:cv0g1f$e73$1@forums.macromedia.com...
    > Here's the code in my page. Following that is the script.
    >
    >
    > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    > "http://www.w3.org/TR/html4/loose.dtd">
    > <html>
    > <head>
    > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    > <title>Untitled Document</title>
    > <script language="JavaScript" type="text/JavaScript">
    > <!--
    > function MM_callJS(jsStr) { //v2.0
    > return eval(jsStr)
    > }
    > //-->
    > onload=function(){
    > initTable( 'Literature', ['number','html',null], 2 );
    > }
    > </script>
    > </head>
    >
    > <table id="Literature" width="644" border="1">
    > <tr>
    > <th scope="col">Name</th>
    > <th scope="col">Thumb</th>
    > <th scope="col">PDF</th>
    > </tr>
    > <tr>
    > <td>Jeff</td>
    > <td>Sean</td>
    > <td>Claire</td>
    > </tr>
    > <tr>
    > <td>Ronnie</td>
    > <td>Diane</td>
    > <td>Eugene</td>
    > </tr>
    > <tr>
    > <td>Mark</td>
    > <td>Donna</td>
    > <td>Milton</td>
    > </tr>
    > <tr>
    > <td>Chris</td>
    > <td>Henry</td>
    > <td>Elaine</td>
    > </tr>
    > <tr>
    > <td>Gerry</td>
    > <td>Dorothy</td>
    > <td>Marueen</td>
    > </tr>
    > </table>
    > </body>
    > </html>
    >
    > SCRIPT FOLLOWS:
    >
    > var T=[], globcol=0, globel=null;
    >
    >
    > function initTable(id, types, first, func ) { first=first||0;
    > func=func||0;
    > T[id]={}; T[id].types=types; T[id].curcol = first; T[id].curdir =
    > 'down';
    > T[id].rank=false; T[id].func = func;
    > var a = document.getElementById(id);
    > var b = a.getElementsByTagName('thead')[0].getElementsByTagName('th');
    > for (var i=0; i < b.length; i++) {
    > b[i].style.position = 'relative';
    > if(types[i]&&types[i].indexOf('rank')===0){
    > addrank(id,i,types[i].substring(4)); T[id].rank=i; }
    > else if(types[i]!==false) { b[i].onclick = function(){ globel=this;
    > sortCursor(globel,'wait'); setTimeout('sortTable(globel);
    > sortCursor(globel,\'\');',50); }; }
    > }
    > if(typeof window.onscroll!=='undefined'){
    > window.onscroll=function(){ stickHead(id); };
    > window.onresize=function(){ stickHead(id); };
    > }else{
    > setInterval('stickHead(\''+id+'\');',2000);
    > }
    > sortIndicator(b[first]); globcol = first;
    > }
    >
    > function sortrank(e){
    > if('string'===typeof e){e=document.getElementById(e);}
    > var i, col=T[e.id].rank;
    > var rows =
    > e.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
    > var newcols = new Array();
    > i=rows.length; while (i--) {
    > newcols[i] = rows[i].childNodes[col].cloneNode(true);
    > }
    > newcols.sort(compareRank);
    > i=rows.length; while (i--) {
    > rows[i].replaceChild(newcols[i], rows[i].childNodes[col]);
    > }
    > }
    >
    > function sortTable(e,col) {
    > if('string'===typeof e){e=document.getElementById(e);
    > if(col){e=e.getElementsByTagName('thead')[0].getElementsByTagName('th')[col];}}
    > var newcol = 0; var i=e;
    > if('undefined'!==typeof col){newcol=col;}else{while(i.previousSibling){
    > newcol++; i=i.previousSibling; }}
    > var table = e; while(table.tagName.toLowerCase()!=='table') { table =
    > table.parentNode; }
    > var tbody = table.getElementsByTagName('tbody')[0];
    > var rows = tbody.getElementsByTagName('tr');
    > var newrows = new Array();
    > i=rows.length; while (i--) {
    > newrows[i] = rows[i].cloneNode(true);
    > }
    >
    > var
    > th=table.getElementsByTagName('thead')[0].getElementsByTagName('th')[T[table.id]
    > .curcol];
    > th.className = th.className.replace(' sorted','');
    > for (i = th.firstChild; i !==null; i=i.nextSibling){
    > if(i.src&&(/\/sort-(up|down).gif$/.test(i.src))){ th.removeChild(i);
    > break; }
    > }
    >
    > if (newcol === T[table.id].curcol) {
    > T[table.id].curdir = T[table.id].curdir !== 'up' ? 'up' : 'down';
    > newrows.reverse();
    > } else {
    > T[table.id].curcol = newcol; globcol=newcol;
    > T[table.id].curdir = 'down';
    > var how=T[table.id].types[newcol];
    > if (how === 'html') {newrows.sort(compareHTML);}
    > else if (how === 'number') {newrows.sort(compareNumber);}
    > else if (how === 'money') {newrows.sort(compareMoney);}
    > else if (how === 'time') {newrows.sort(compareTime);}
    > else if (how === 'name') {newrows.sort(compareName);}
    > else if (how === 'hid') {newrows.sort(compareHid);}
    > else {newrows.sort(compare);}
    > }
    > var newtbody = document.createElement('tbody');
    > for (i=0; i<newrows.length; i++) {
    > newtbody.appendChild(newrows[i]);
    > }
    > table.replaceChild(newtbody, tbody);
    > sortIndicator(e,T[table.id].curdir);
    > if(typeof T[table.id].rank==='number'){sortrank(table)};
    > eval(T[table.id].func);
    > }
    >
    > function compare(a, b) {
    > var aVal = gimmietext(a.childNodes[globcol]).toLowerCase();
    > var bVal = gimmietext(b.childNodes[globcol]).toLowerCase();
    > return (aVal === bVal ? 0 : trim(bVal)===''?1:(aVal > bVal ? 1 : -1));
    > }
    > function compareHTML(a, b) {
    > var aVal = a.childNodes[globcol].innerHTML;
    > var bVal = b.childNodes[globcol].innerHTML;
    > return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    > }
    > function compareNumber(a, b) {
    > var aVal = parseFloat('0'+gimmietext(a.childNodes[globcol]));
    > var bVal = parseFloat('0'+gimmietext(b.childNodes[globcol]));
    > return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    > }
    > function compareMoney(a, b) {
    > var aVal = parseFloat('0'+gimmietext(a.childNodes[globcol]).substr(1));
    > var bVal = parseFloat('0'+gimmietext(b.childNodes[globcol]).substr(1));
    > return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    > }
    > function compareTime(a, b) {
    > var aVal = gimmietext(a.childNodes[globcol]); while(aVal.length<9){
    > aVal='0'+aVal; }
    > var bVal = gimmietext(b.childNodes[globcol]); while(bVal.length<9){
    > bVal='0'+bVal; }
    > return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    > }
    > var regOLD=/(van( de(n|r)?)?|von|de(n|r|s)?|te(n|r)?|le|la)\s+/i;
    > var reg=/^(van( de[nr]?)?|von|de[nrs]?|te[nr]?|l[ae])\s+/i;
    > function compareName(a, b) {
    > var aVal = gimmietext(a.childNodes[globcol]).replace(reg,'');
    > var bVal = gimmietext(b.childNodes[globcol]).replace(reg,'');
    > return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    > }
    > function compareHid(a, b) {
    > var aVal =
    > parseFloat('0'+gimmietext(a.childNodes[globcol].getElementsByTagName('span')[0])
    > );
    > var bVal =
    > parseFloat('0'+gimmietext(b.childNodes[globcol].getElementsByTagName('span')[0])
    > );
    > return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    > }
    > function compareRank(a, b) {
    > var aVal = parseInt(gimmietext(a));
    > var bVal = parseInt(gimmietext(b));
    > return (aVal === bVal ? 0 : (aVal > bVal ? 1 : -1));
    > }
    >
    > function sortIndicator(e, dir) {dir=dir||'down';
    > e.className += ' sorted';
    > var im = document.createElement('img');
    > im.setAttribute('src',
    > 'http://4umi.com/image/icon/arrow/sort-'+dir+'.gif');
    > im.setAttribute('alt', dir);
    > im.setAttribute('width', '8');
    > im.setAttribute('height', '8');
    > im.setAttribute('vspace', '1');
    > im.setAttribute('hspace', '1');
    > im.setAttribute('style', 'position:absolute');
    > im.style.position='absolute';
    > e.appendChild(im);
    > }
    >
    > function stickHead(e){
    > var d=document;
    > var a=d.getElementById(e);
    > var b=a.getElementsByTagName('thead')[0].getElementsByTagName('th');
    > var y = typeof window.pageYOffset==='number' ? window.pageYOffset :
    > d.documentElement && typeof d.documentElement.scrollTop==='number' ?
    > d.documentElement.scrollTop : d.body.scrollTop;
    >
    > y=Math.min(a.scrollHeight-40,Math.max(0,y-a.offsetTop-parseInt(getstyle(document
    > .body,'margin-top'))));
    > for(var i=0; i<b.length; i++){ b[i].style.top=y+'px'; }
    > if(typeof beweeg==='function'){beweeg();}
    > }
    >
    > function addrank(id,col,start){ col=col||0; start=parseInt(start)||1;
    > var a = document.getElementById(id);
    > var b = a.getElementsByTagName('colgroup');
    >
    > if(b&&b[0]&&b[0].childNodes[col]){b[0].insertBefore(document.createElement('col'
    > ),b[0].childNodes[col]);}
    > var row =
    > a.getElementsByTagName('thead')[0].getElementsByTagName('tr')[0];
    > var th=document.createElement('th');
    > th.style.textAlign='center';
    > th.style.position='relative';
    > th.appendChild(document.createTextNode('#'));
    > row.insertBefore(th,row.childNodes[col]);
    > var rows = a.getElementsByTagName('tbody')[0].getElementsByTagName('tr');
    > var td=document.createElement('td');
    > td.style.textAlign='right';
    > td.style.fontSize='80%';
    > td.style.fontFamily='\'MS Sans Serif\',Arial,sans-serif';
    > var i=rows.length; while (i--) {
    > th=td.cloneNode(true);
    > th.appendChild(document.createTextNode((start+i)+' .'));
    > rows[i].insertBefore(th,rows[i].childNodes[col]);
    > }
    > }
    >
    > function sortCursor(el,how){ document.body.style.cursor=how;
    > el.style.cursor=how; var a=el.getElementsByTagName('a'); if(a){var
    > i=a.length;
    > while(i--){a[i].style.cursor=how; }} }
    >
    > if(typeof trim==='undefined'){ trim=function(s) {return
    > s.replace(/^\s+/,'').replace(/\s+$/,'');}}
    >
    > if(typeof gimmietext==='undefined'){ gimmietext=function(node) {
    > var s='';
    > if(node.firstChild){
    > for (var x = node.firstChild; x !==null; x=x.nextSibling) {
    > if (x.nodeType === 3) {
    > s += x.nodeValue;
    > } else if (x.nodeType === 1) {
    > s += gimmietext(x);
    > }
    > }
    > }else if(node.nodeValue){
    > s += node.nodeValue;
    > }
    > return s;
    > }}
    >
    > if(typeof getstyle==='undefined'){ getstyle=function(el,prop){
    > if(el.currentStyle){
    > prop=prop.replace(/-(\w)/,function(t,a){return
    > a.toUpperCase()});//backgroundColor
    > return el.currentStyle[prop];
    > }else if(window.getComputedStyle){
    > var elstyle=window.getComputedStyle(el,'');
    > return elstyle.getPropertyValue(prop);
    > //background-color
    > }
    > }}
    >

    Jon Spivey Guest

  6. #5

    Default Re: Calling/running a javascript

    Hey maybe you guys can help me out too.
    so i got a template with a java script animation in the header. I edited this animation and it looks awesome.
    the point is that I created some new pages in dreamweaver doing a simple copy/paste inside the files panel, however the java animation is not working in these new pages.
    any suggestions?
    Joel Frewa is offline Junior Member
    Join Date
    Oct 2011
    Posts
    1

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139