By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,379 Members | 1,759 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,379 IT Pros & Developers. It's quick & easy.

Creating URLs from function call operators

P: n/a
Hi, I'm new to JavaScript so forgive me if the answer to this question is
(a) ridiculously obvious, or (b) beyond the realms of JavaScript....

Is it possible to create URLs from function call operators?

For example, I'm trying to program an onClick function which will load a
webpage in one frame and an image in another, based on the name of the
button which is being clicked. So clicking the button with name="help" will
open "webpages/help_page1.html" in one frame, and "images/help.jpg" in
another.

To do this I was hoping that the following would work, where the function
had been called by onClick=activate(help)...

function activate(buttonName) {
webpageURL="webpages/"+buttonName+"_page1.html"
imageURL="images/"+buttonName+".jpg"
parent.frame1.location.href=webpageURL
parent.frame2.picture.src=imageURL
}

But this doesn't work, because the browser (IE6) looks for
"webpages\[object]_page1.html" and "images\[object].jpg".

Hope someone out there can help!

Thanks in advance,

Cliff
Jul 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"Smogo" <sm***@ntlworld.com> schreef in bericht
news:be************@ID-173915.news.dfncis.de...
....
For example, I'm trying to program an onClick function which will load a
webpage in one frame and an image in another, based on the name of the
button which is being clicked. So clicking the button with name="help" will open "webpages/help_page1.html" in one frame, and "images/help.jpg" in
another.

To do this I was hoping that the following would work, where the function
had been called by onClick=activate(help)...

function activate(buttonName) { .... But this doesn't work, because the browser (IE6) looks for
"webpages\[object]_page1.html" and "images\[object].jpg".


Be shure that you pass it a string a not an object, e.g.:

Not:

<input type="button" name="help" onClick="activate(this)">

But

<input type="button" name="help" onClick="activate(this.name)">
JW

Jul 20 '05 #2

P: n/a
"Janwillem Borleffs" <jw*@jwbfoto.demon.nl> wrote in message
news:3f***********************@news.euronet.nl...


Be shure that you pass it a string a not an object, e.g.:

Not:

<input type="button" name="help" onClick="activate(this)">

But

<input type="button" name="help" onClick="activate(this.name)">


Thanks, that fixed it!

Cliff
Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.