Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2005, 10:33 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 425
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Again the code you posted works fine.

The choice of font size almost makes me wish it didn't though. If I'm using IE that's one page I'm not going to be able to read. :(

--
http://yupapa.com
 
Old November 8th, 2005, 07:04 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

Still trying to make my code cross-browser for public usage, this code below doesnt seem to work.
I get the error: obj.filters has no properties, works OK in IE - not in FF though??

Code:
// Make the DIV disappear
function fadeOut(obj)
{
    obj.style.filter="blendTrans(duration=0.5000)";
    if (obj.filters.blendTrans.status != 0.5000)
    {
        obj.filters.blendTrans.apply();
        obj.style.visibility="hidden";
        obj.filters.blendTrans.play();
    }


    if((document.form.booking_details_minimized)!=null)
    {
        booking_details_minimized.style.filter="blendTrans(duration=1)";
        if (booking_details_minimized.filters.blendTrans.status != 1)
        {
            booking_details_minimized.filters.blendTrans.apply();
            booking_details_minimized.style.visibility="hidden";
            booking_details_minimized.filters.blendTrans.play();
        }
    }
}

// Make the MiniRules gradually appear
function fadeIn(obj)
{
    obj.style.filter="blendTrans(duration=0.5000)";
    if (obj.filters.blendTrans.status != 0.5000)
    {
        obj.filters.blendTrans.apply();
        obj.style.visibility="visible";
        obj.filters.blendTrans.play();
    }    
}
Also, having errors building a table dynamically using insertRow and insertCell, is this IE only?

Picco


www.crmpicco.co.uk
 
Old November 8th, 2005, 07:09 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi Picco,

blendTrans is IE only. Try this article for an alternative that works cross browser: http://www.brainerror.net/scripts_js_blendtrans.php

HTH,

Chris
 
Old November 8th, 2005, 07:10 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

think you forgot to post the article link there Chris

www.crmpicco.co.uk
 
Old November 8th, 2005, 07:38 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

lol. well spotted Picco (now added)
 
Old November 8th, 2005, 07:56 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

thanks Chris

www.crmpicco.co.uk
 
Old November 8th, 2005, 08:00 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

what about insertRow() and insertCell()? Does that not work in FF?


www.crmpicco.co.uk
 
Old November 8th, 2005, 08:30 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

insertRow() & insertCell() both work in FF / Mozilla, but one thing that can catch you out is that you need to supply an index number for the row or cell you are adding, e.g. insertRow(0) for cell in index position 0.

HTH,

Chris

 
Old November 8th, 2005, 12:16 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

brilliant chris!

www.crmpicco.co.uk
 
Old November 8th, 2005, 12:29 PM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

Code:
function build_header(id,airline,contract,title,fareId)
{    
    headerRow = document.getElementById("demodiv_SpecialInfo").insertRow(0);    
    cell2 = headerRow.insertCell(0);
    cell2.noWrap = "true";
    cell2.innerHTML = "Airline:  ";
    cell2.innerHTML = cell2.innerHTML + airline; // Insert the Airline Name into the cell

    cell4 = headerRow.insertCell(0);
    cell4.noWrap = "true";
    cell4.innerHTML = "Title:  ";

    // If the length of the Contract title is too long to
    // display then cut it up and only show first 55 chars
    if (title.length > 60)
    {
        var temp = title;
        var temp_title = temp.slice(0,55);
        cell4.innerHTML = cell4.innerHTML + temp_title + "...";        
    }
    else
    {
        cell4.innerHTML = cell4.innerHTML + title;  // Insert the Contract Title into the cell
    }

    cell3 = headerRow.insertCell(0);
    cell3.noWrap = "true";
    cell3.innerHTML = "Contract:  ";
    cell3.innerHTML = cell3.innerHTML + contract; // Insert the Contract Code into the cell

    cell = headerRow.insertCell(0);
    cell.align = "right";
    cell.noWrap = "true";
    cell.innerHTML = "ID:  ";
    cell.innerHTML = cell.innerHTML + id + " / " + fareId; // Insert the Contract ID / Fare Id into the cell
}
I changed insertCell() for insertCell(0) and it worked for the function above. But it didnt seem to work for the function below:

Code:
function build_rules(contract_id,heading,content,contracts,counter,records,SpecialInfo)
{
    heading_str = heading_str + "~" + heading;
    content_str = content_str + "~" + content;

    contentArr = content_str.split("~");
    headingArr = heading_str.split("~");

    row = document.getElementById('demodiv_t').insertRow()

    cell = row.insertCell()
    cell.vAlign = "top"
    cell.noWrap = "true"    
    cell.style.wordWrap = "break-word"


    for(temp=0; temp<=headingArr.length; temp++)
    {
        //alert(headingArr[temp]);    
    }
    //if (typeof(headingArr[a+1]) != "undefined")
    //{
//        alert("records = " + records);



        if (typeof(headingArr[a]) != "undefined")
        {
            //alert("counter = " + counter);
            //alert("headingArr.length = " + headingArr.length);
            if (parseFloat(counter+1) != parseFloat(headingArr.length))
            {
                //alert("linie 165");
                cell.innerHTML = headingArr[a+1];//.toProperCase();
                //alert("counter = " + counter);
                //alert("headingArr.length = " + headingArr.length);
                if ((counter+1) == headingArr.length)
                {
                    //cell.innerHTML = "XXX";
                }
            }
            else if (parseFloat(counter+1) == parseFloat(headingArr.length))
            {                
                //cell.innerHTML = "XXX";//.toProperCase();
            }
            else
            {
                //cell.innerHTML = "XXX";
            }
            //for(temp=0; temp<=headingArr.length; temp++)
            //{
                //alert("headingArr " + temp + " = " + headingArr[temp]);
            //}
        }
        else if (typeof(headingArr[a+1]) != "undefined")
        {
            //alert("linie 184");
            cell.innerHTML = headingArr[a+1].toProperCase();
        }
        else 
        {    
            for(temp=0; temp<=headingArr.length; temp++)
            {
                //alert("headingArr " + temp + " = " + headingArr[temp]);
                cell.innerHTML = headingArr[temp-1];
            }            
        }
        /*
        if (typeof(headingArr[a+1]) != "undefined")
        {
            cell.innerHTML = headingArr[a+1].toProperCase();
        }
        */
    //}

    cell2 = row.insertCell()
    cell2.vAlign = "top";
    //cell2.noWrap = "true";
    //if (typeof(contentArr[a+1]) != "undefined")
    //{

        if (typeof(contentArr[a]) != "undefined")
        {
            cell2.innerHTML = contentArr[a+1];
        }
        else if (typeof(contentArr[a+1]) != "undefined")
        {
            cell2.innerHTML = contentArr[a+1];            
        }
        else
        {
            for (temp=0; temp<=contentArr.length; temp++)
            {
                cell2.innerHTML = contentArr[temp-1];
            }
        }
        /*
        if (typeof(contentArr[a+1]) != "undefined")
        {
            cell2.innerHTML = contentArr[a+1];
        }
        */

    //}

    // Build 'Special Information' Table Row at top of the DIV
    // This will show any 'WARNING' information related to this fare
    // e.g. 'Only valid on AA1234 outbound and AA5678 inbound'
    if(bSpecialInfoBuilt!=true)
    {
        if(SpecialInfo!="")
        {
            SI_row = document.getElementById('demodiv_SpecialInfo').insertRow()    
            cell = SI_row.insertCell()
            cell.colSpan = "4"
            cell.style.border = "1"
            cell.style.borderTopColor = "#000000"
            cell.innerHTML = cell.innerHTML + "<img src=images/flashing_exclam.gif height=15>"
            cell.innerHTML = cell.innerHTML + "&nbsp;&nbsp;" + SpecialInfo
        }
    }

    bSpecialInfoBuilt = true;
    a=a+1;
}

www.crmpicco.co.uk





Similar Threads
Thread Thread Starter Forum Replies Last Post
Css layout not work well in Firefox kumiko CSS Cascading Style Sheets 0 March 31st, 2008 10:27 AM
cant get beerhouse Login to work in FireFox br BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 2 October 7th, 2006 12:09 AM
CMS doesn't appear to work with Firefox 1.5 abel714 BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 September 18th, 2006 10:45 AM
Why does this work in Firefox but not in IE???? Ov1 Javascript 2 August 11th, 2006 05:47 AM
code in CH11 not work in FireFox din BOOK: Professional JavaScript for Web Developers ISBN: 978-0-7645-7908-0 2 January 18th, 2006 09:21 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.