*-----------
05/25/2004
---------------
Help287.htm
http://www.jsworkshop.com/bb/viewtopic.php?t=1510
JS3 hour/lesson 15
As always You are the first to help and answer.Thank You for
that.You have my gratitude.I readed Your articles several times
and it helped me,but Im maybe little slow to understand(I will in
time). As for var i=1; and var Record=new Array(); I think I
understand what you are trying to say.I think I mixed global
variables with local(those inside function).Am I right?So I
removed function init() completly and leaved only those two
variables.Also I think problem with that PrintCard() function is
in the last line where instead...
document.write(line1,line2,line3,line4,line5); should be...
Dispwin.document.write(line1,line2,line3,line4,line5);
Am I understand this correctly?Or the problem is in function
WiewRec() last line... Dispwin=Record[i].PrintCard();
Or nothing of above?I tried both but still it dosent work.What is
the problem? And what other changes I have to make with "i".I
looked and looked and didnt think of anything.Do I maybe have to
use some kind of loop in AddRec() function?And what means.. var
Record=new Array(); // defines record but it has nothin in it yet
Is that some kind of problem,because there is nothing in it,or is
it just a constatation? And lastly I didnt understand... (My help
file for this question is: Help287.htm)
Im very,very sorry if Im annoying you and if Im not understading
something maybe crystal clear but I just dont.I hope I dont sound
stupid with all this problems and please accept my apologies for
horrific English and constant pestering.Im sorry too for breaking
rules of KISS.Thanks again. P.S And I get object expected errors
on both AddRec() and WiewRec() functions.Arrghh.
Back to top
-----
05/25/04
Thanks for the kind words, even though I know I'm not always the
first to respond. I get on when I can and right now I have a bit
more time since the consulting has slacked off a bit.
You are on the right track.
I will say that the line: Dispwin=Record[i].PrintCard(); does not
work, as you've found out.
Neither does
Dispwin.document.write(line1,line2,line3,line4,line5);
To point you in the right direction remember that you are writing
HTML into a blank page, so it might be best to add
and to the HTML you are trying to write to the new
page.
Now, another hint, when you call the function PrintCard return
the HTML that you want to write into the open window. Then, look
up how to use innerHTML. Hope that helps, good-luck & don't
bother apologizing since this is the kind of help Michael
designed the site to give. Also, no question is "stupid" NOT
asking a question when you need help is stupid. As to KISS, the
example you sent was right in line with the idea.
For your WiewRec() problem use alert(i) to see what the value of
i is for the record you are trying to view.
-----
Jojosh Posted: Mon May 24, 2004 5:40 pm Post subject:
--------------------------------------------------------------------------------
Hello and thanks for answering.Now about problems....
As for PrintCard() I do it in this way...
function PrintCard(){
Dispwin.document.write("");
Dispwin.document.write("");
Dispwin.document.write("Name: " + this.name + " " );
Dispwin.document.write("Address: " + this.address + " " );
Dispwin.document.write("Workphone: " + this.workphone + " " );
Dispwin.document.write("Homephone: " + this.homephone + " " );
Dispwin.document.write("Emailaddress: " + this.email + "" );
Dispwin.document.write("");
Dispwin.document.write("");
}
and it works.Is this way to do it?Are you did it this way?This
works for me. As for WiewRec() I dont know what to do so I leave
it like this...
function WiewRec(){
Dispwin=window.open("","NewWin","toolbar=no,status=no,width=300,height=200")
Dispwin=Record[i].PrintCard();
}
What is wrong with this.I dont understand.Can you explain me please?
I noticed that this works all fine when instead of...
Dispwin=Record[i].PrintCard(); I use only...
Dispwin=PrintCard();
so it means problem is in that damn Record[i].Why?Why?I defined
it right on start,both of them Record and i.What Im doing
wrong.Because of my bad English Im posting an example....
Dio4.Cas15.
In IE I dont get any error message for AddRec() but for WiewRec()
I get... "'Record[...]' is null or not an object".What this
mean?I used Record[i]=new Card.How can be "not an object"?.I also
tried to create new object like this..
Record[i]=new Card();
Record[i].name=document.a.N.value;
Record[i].address=document.a.A.value;
Record[i].workphone=document.a.W.value;
Record[i].homephone=document.a.H.value;
Record[i].Emailaddress=document.a.E.value;
Record[i].PrintCard=PrintCard;
but it seems it has not any influence at anything.I would like to
ask You kindly if You can post me complete code of how You did
it.I know that You hinted me for the start for my own good,but I
will start to pluck my hair if I dont learn how this can be
done.I know that You tried to learn me,by hinting not showing me
complete code,and I tank You for that very friendly and smart
metod of teaching but Im on edge of my nerves with this.I just
dont know how do do it.So can You please,please show me how this
can be done and how you did it.I suspect that what Im doing wrong
has some connection with declaring variables or how I use
function and arrays but I just cant figure what Im doing
wrong.The whole time I guided myself by using example from lesson
7 where code folows like this...
To me this look some kind similiar what Im trying to do(as for
Arrays at least).I dont understand how this works but when I used
it it doesent.When Im looking in this its semms to me that I
declared and defined variables the same way and used Record[i]
same way like names[i] was used in this example.But Im know im
mistaking...but I dont know in what.So once more I would like If
You could post complete code of how You did it with commentaries
on specific and crucial places(in wich Im making mistakes),and to
explain me what Im doing wrong.Im sorry for this long and tedious
post but Im really frustrated with this and with myself at the
moment.Please forgive for my annoyingnes.And THANKS VERY MUCH.
Grateful in advance.
-----
05/26/04
[quote]and it works.Is this way to do it?Are you did it this way?This
works for me. As for WiewRec() I don't know what to do so I leave
it like this...[/quote]
No that's not the way I did it, too much typing for my liking. I
simply built the string up & then used one command to send it to
the page. But, whatever works & you understand is the best to
use.
For "function WiewRec(){ " put in the alert statement to look at
the value of i before you try to view the record. Make sure there
is a record of that index and if, not fix it. The reason you're
getting a problem with the Record is that you're assuming
something which is NOT the case. Put the alert statement in there
and think about what it is telling you.
Then reread my debugging article if you're still having problems,
especially the section on our assumptions causing us problems.
THIS IS WHERE YOUR PROBLEM IS!
As I told you before I have it working here so NO your vars are OK.
Reread my hints and previous postings, I will not re-write the
same things again. You haven't yet thought through the other
postings of mine completely yet. If you had your questions would
be different and more in line with where I'm trying to lead you.
Stick with it, you are getting there. Learning is ALWAYS much
more work than simply being told the answer. But in the end, it
is far more helpful for your future programming tasks.
*-----------
08/11/2003
---------------
http://forums.webdeveloper.com/showthread.php?s=&postid=80036#post80036
http://www.jsworkshop.com/bb/viewtopic.php?p=4372#4372
-----
I want to execute the following menu as many times as the user
want. Please take a look and give me some suggestion. First the
user will be asked the number of time he/she wants to execute the
menu bar in the same page (without opening a new page).
Please help me???
-----
How about this?
[code]