...

View Full Version : Can anyone help me please, im a beginner...



zil
07-05-2004, 10:53 AM
Hello all...
Im a beginner in javascript and ive to modify some codes in a website...i know a little of javascript but the codes below, already existed in the page make me perplex...
Can anyone explain to me the codes please?

function MM_findObj(n, d)
{
var p,i,x;

if(!d) d=document;
if((p=n.indexOf("?"))>0&&parent.frames.length)
{
d=parent.frames[n.substring(p+1)].document;
n=n.substring(0,p);
}

if(!(x=d[n])&&d.all) x=d.all[n];

for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];

for(i=0;!x&&d.layers&&i<d.layers.length;i++)
x=MM_findObj(n,d.layers[i].document);

if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function flevSubmitForm()
{
var sF = arguments[0], oF = MM_findObj(sF), sA = (arguments.length > 1) ? arguments[1] : "";

if (oF) {if (sA != "")
{oF.action = sA;}
oF.submit();
document.MM_returnValue = false;}
}

What is arguments.length stands for?
What is layers for?
I would be very grateful if someone can help me...

___________________________
Zil.

jbot
07-05-2004, 11:01 AM
my suggestion to you, is to learn JS and replace the Dreamweaver code with your own.

since I and other people don't know wot it is you want to modify, and that the Dunceweaver code is itself pitiably poor, it's kinda difficult to help you precisely.

btw: the arguments.length is referring to number of parameters passed to the function. the layers object refers to layers tags in Netscape 4.x, now deprecated.

btw: it's better to search online for simple questions like this. you'll get more thorough answers and more of them. just go to Google and search.

personal rant: why have you been given JS to code when you don't how to do it. or did you falsely claim on your CV (resume) that you could, when you obviously can't).

SpiritualStorms
07-05-2004, 11:01 AM
how much of the code do you actually understand, and how much of it do you not? Would help if you broke it down for us.

SpiritualStorms
07-05-2004, 11:04 AM
LOL:


personal rant: why have you been given JS to code when you don't how to do it. or did you falsely claim on your CV (resume) that you could, when you obviously can't).

Aint nothing like false advertising, LOL. Now, if we could get the heavy weight advertisers from falsifying, we would be ok.

zil
07-05-2004, 11:49 AM
Lol!!
Well jbot, im in fact trainee in a company and ive been assigned to shift some html works to asp...well ive been doing javascript in the uni but since there were lots to do i didnt have time to practice JS as i wanted to...yeah i know the basics of JS but unfortunately i dont master it...in fact i came into that forum to be able to learn more about JS so that i can enhance the work:)
Thx for the answer that really nice and well nice quote about the falsifying cv lol!!:)

________________________
Zil.

jbot
07-05-2004, 12:00 PM
Thx for the answer that really nice and well nice quote about the falsifying cv


you originally said you were a beginner and knew little of javascript, which normally reads on here as not having done it before and wanting someone else to do your dirty work for you. apologies tho, if that's not the case.

something you'll soon learn tho, as a professional and a graduate, is that there are plently of poeple out there developing websites and apps who have little or no experience and have blagged their way to getting jobs. yet, you'll often find them on here pleading for you to do their work for them, because they've not yet mastered the simple art of googling. apologies tho, because that obviously doesn't apply to you.

hope that settles it.

btw: if you're moving the HTML over to ASP, surely any JS can just be moved into an SSI or a JSi (Javascript include - basically, an external JS file). if the JS worked with the normal HTML page, it's gonna also work with the ASP, surely.

zil
07-05-2004, 12:21 PM
Oh oh Jbot why taking that on that tone??
well im not the kinda make others do my job...i tell u i know only the basics, well does that mean that im an expert in JS??btw im also looking for other notes about JS, browsing on lotta links...since i want to go faster i register in that forum so that i can get help...from my previous post, have i said please do the work for me??!??Please re-read it and tell me...i asked if someone can help me so that i can understand better and modify the code or produce my own code...i dont c y i need to apologise....
I just register today & im not coming here to make enemies coz i feel u r really rude, being cynical the first time, then telling that i wanted u to do the work for me...the first time i take it easy and laugh at it...
I just want to make thgs clear jbot...im here to learn and not to tell others to do my job, nor im falsyfing my cv, nor to fight and all...
If there is someone who must apologise, its u jbot, not me...

______________________
Zil.

LynxGrr
07-05-2004, 12:37 PM
yet, you'll often find them on here pleading for you to do their work for them, because they've not yet mastered the simple art of googling. apologies tho, because that obviously doesn't apply to you.

But <sniff> if we all googled for our answers and went elsewhere <sniffle> then coding forums would... would be no more ! :(

zil
07-05-2004, 12:53 PM
That's rite LynxGrr:)
the prob is that certain person dont realise that...
_________________
Zil.

jbot
07-05-2004, 12:57 PM
.. coding forums would... would be no more ! :(

true, but' c'mon guys. we're all capable of doing our own research and then figuring out how to do things for ourselves. if i was an employer, i'd be looking for developers like that.

at the end of the day, yes we all need some help. none of us are experts. but the forums should be for last resorts, when we can't find elsewhere online what we're looking for, or when we just can't work it out for ourselves, or when we can't get the b-u-g-g-e-r-s debugged, or when we wanna take it to an advanced level. they shouldn't be used as an excuse for lazy coders to get other's to work out simple code for them. (not naming names!)

geeez, i really am unhappy in my job! :(

LOL

zil
07-05-2004, 01:10 PM
oh u mean that many lazy coders exploit forums?i just guess that ur so unhappy in ur work that u feel frustrated and you relief ur frustration on lazy coders, as you name them...
Where there are lazy coders, others are frustrated coders...
Anyway thks for those helping through:)

___________
Zil.

jbot
07-05-2004, 01:21 PM
Oh oh Jbot why taking that on that tone??
well im not the kinda make others do my job...i tell u i know only the basics, well does that mean that im an expert in JS??btw im also looking for other notes about JS, browsing on lotta links...since i want to go faster i register in that forum so that i can get help...from my previous post, have i said please do the work for me??!??Please re-read it and tell me...i asked if someone can help me so that i can understand better and modify the code or produce my own code...i dont c y i need to apologise....
I just register today & im not coming here to make enemies coz i feel u r really rude, being cynical the first time, then telling that i wanted u to do the work for me...the first time i take it easy and laugh at it...
I just want to make thgs clear jbot...im here to learn and not to tell others to do my job, nor im falsyfing my cv, nor to fight and all...
If there is someone who must apologise, its u jbot, not me...

______________________
Zil.


honestly, i'm not taking any tone. not meaning to anyway. and i have apologised. honestly. :)

but there are people who come on the forums and get agitated if no one writes the code for them, then never thank you when you do. if you don't believe me, do a wee search and see. that's also why there's a sticky post for logging threads - to set guidelines and help users post better.

zil
07-05-2004, 01:37 PM
No worries, im not that kinda person...
In fact, this work needs to be done quickly coz there's deadline and that's y i come here in this forum...let me apologise too for being a bit rude too but i was somehow deceived when u mean that im here so that others do my job...that was sincerely never my intention, and isn't nor will be.
Well i appreciated the fact that u told me about the arguments and layers object:) thx dude...

________________________
Zil.

jbot
07-05-2004, 01:51 PM
No worries, im not that kinda person...
In fact, this work needs to be done quickly coz there's deadline and that's y i come here in this forum...let me apologise too for being a bit rude too but i was somehow deceived when u mean that im here so that others do my job...that was sincerely never my intention, and isn't nor will be.
Well i appreciated the fact that u told me about the arguments and layers object:) thx dude...

________________________
Zil.

cool, that's settled then. :cool:

is it a JS problem, or do you just need to move the JS into an include?

i find the Dreamweaver code above quite unreadable, hence my suggestion to re-write it. another reason for doing so, is that it makes it easier to upgrade in the future, especially for others (you and I in this scenario) that maybe aren't quite aware of the original author's intentions.

the MM_findObj(n, d) method seems to be creating a cross-browser method for getting an HTML object from the page. that's why d.all, d.layers and d.getElementById are all mentioned in the same function (where d is short for document).

that's quite self-explanatory, so you probably already knew that tho. but on the face of it, it does look quite accomplished code, but in truth it's overkill.

really all you need nowadays is to access your individual elements using the getElementById method. for multiple elements of the same name, such as radio buttons, you'd use getElementsByName, and to get all elements of a particular tag you can use getElementsByTagName.

these three methods are part of the DOM. to find out more DOM methods, you can visit http://www.mozilla.org/docs/dom/domref/. it's one of the best references out there.

hope that helps (a little) :)

zil
07-05-2004, 02:00 PM
well i feel sorry that we started a bit bad, ur a nice guy tho:)
Thx a lot for the information...for the links im gonna have a look at it later coz its already time here for me to go now...
Take care!
Cheers!
_______________________
Zil.

SpiritualStorms
07-06-2004, 04:33 AM
LOL.......this thread has turned into a battle of a sorts. LOL.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum