Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript How-To
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript How-To Ask your "How do I do this with Javascript?" questions here.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript How-To section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 19th, 2005, 06:51 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
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 passing variable to function in innerHTML

Code:
                seat_zelle.innerHTML = "<input type='text' id='specify"+s+"' name='specify"+s+"' "+
                                       "title='Insert Seat Number for Pax: "+ passagier + " " + passNo + " / Segment "+ parseFloat(s+1) +"' "+
                                       "class='selects' size='5' onBlur='concatSeats(this.value,"+passNo+",this.id);' onKeyUp='this.value=this.value.toUpperCase(); return IsNumeric(this.value,this.id);' />";
How can i pass a variable called 'pass' to the function concatSeats?
this works for 3 paramaters concatSeats(this.value,"+passNo+",this.id), but when i try
concatSeats(this.value,"+passNo+",this.id,"+pass+" ) i get a error.

Picco


www.crmpicco.co.uk
__________________
_______________________
Ayrshire Minis - a Mini E-Community
http://www.ayrshireminis.com
http://www.crmpicco.co.uk
Reply With Quote
  #2 (permalink)  
Old October 19th, 2005, 07:17 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii Crmpicco!!

Are you sure to define all the variables??
Since in my case its working properly,
Here is the tested Code ,Working fine
<script>

function callme(){
s=1
passagier=1
passNo=1
pass=2
seat_zelleobj=document.getElementById("seat_zelle" )
seat_zelleobj.innerHTML = "<input type='text' id='specify"+s+"' name='specify"+s+"' "+
                                       "title='Insert Seat Number for Pax: "+ passagier + " " + passNo + " / Segment "+ parseFloat(s+1) +"' "+
                                       "class='selects' size='5' onBlur='concatSeats(this.value,"+passNo+",this.id, "+pass+") ;' onKeyUp='this.value=this.value.toUpperCase(); return IsNumeric(this.value,this.id);' />";

}

</script>
<div id=seat_zelle></div>
<input type=button onclick="callme()" value=check>

Hope this will help you

Cheers :)

vinod
Reply With Quote
  #3 (permalink)  
Old October 19th, 2005, 08:43 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
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

hi vinod, yes i have definately declared and defined them:

this seems to work, but im confised:
Code:
                seat_zelle.innerHTML = "<input type='text' id='specify"+s+"' name='specify"+s+"' "+
                                       "title='Insert Seat Number for Pax: "+ passagier + " " + passNo + " / Segment "+ parseFloat(s+1) +"' "+
                                       "class='selects' size='5' onBlur='concatSeats(this.value,"+passNo+","+pass+",this.id);' onKeyUp='this.value=this.value.toUpperCase(); return IsNumeric(this.value,this.id);' />";
www.crmpicco.co.uk
Reply With Quote
  #4 (permalink)  
Old October 19th, 2005, 09:58 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
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

No thats not working either actually, still seem to be experiancing problems with this script?

www.crmpicco.co.uk
Reply With Quote
  #5 (permalink)  
Old October 19th, 2005, 10:12 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
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

/*
FUNCTION NAME: specifySeat
Hide the 'Seat' image and build a text box for the cell
for user to enter seat number into
*/
function specifySeat(passType,passNo,seg,seatReq)
{

    var doc = document.form;
    var df = document.forms["form"];

    var noa = doc.noa.value;
    var noc = doc.noc.value;


    if (passType == "ADT")
    {
        var passagier = "Adult";
        pass = "AD";
    }
    else if (passType == "CHD")
    {
        var passagier = "Child";
        pass = "CH";
    }

    alert("pass = " + pass);

    // If the user selected to specify their own seat
    if (seatReq == "specify_seat")
    {
        for(s=0; s<=seg; s++)
        {
            if (document.getElementById("FL"+s) != null)
            {
                var seat_zelle = document.getElementById("FL"+s);
                //seat_zelle.style.visibility = "hidden";

                if (document.getElementById("seat_img"+s) != null)
                {
                    var seat_img = document.getElementById("seat_img"+s);
                    seat_img.style.visibility = "hidden";
                }
                //var temp = "TEST";
                alert("pass = " + pass);
                temp = pass;
                alert("temp = " + temp);
                seat_zelle.innerHTML = "<input type='text' id='specify"+s+"' name='specify"+s+"' "+
                                       "title='Insert Seat Number for Pax: "+ passagier + " " + passNo + " / Segment "+ parseFloat(s+1) +"' "+
                                       "class='selects' size='5' onBlur='concatSeats(this.value,"+passNo+",this.id, "+pass+");' onKeyUp='this.value=this.value.toUpperCase(); return IsNumeric(this.value,this.id);' />";
                //seat_zelle.onClick = "return test();";
                bOpenWin = false;
                var selectedSeats = true;

                //alert("CHanged selectedSeats = " + selectedSeats);
            }
        }
    }
}

www.crmpicco.co.uk
Reply With Quote
  #6 (permalink)  
Old October 19th, 2005, 10:25 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
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

it seems to be struggling sending a string to the function, it sends a integer ok though?????

www.crmpicco.co.uk
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
send variable in function to another function schoolBoy Javascript How-To 6 March 3rd, 2007 09:16 AM
Passing variables from within innerHTML Sebastiaan VBScript 0 November 22nd, 2006 11:20 AM
passing variable to function Boszky Pro PHP 2 December 15th, 2005 03:01 AM
Passing variable to a public variable Hudson40 Access VBA 2 February 25th, 2005 06:23 AM
Passing a variable into the id() function EstherMStrom XSLT 5 January 19th, 2005 02:32 PM



All times are GMT -4. The time now is 07:46 PM.


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