471,573 Members | 1,039 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,573 software developers and data experts.

Creating URLs from function call operators

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
2 2065

"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
"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.

Similar topics

reply views Thread by Kid A | last post: by
3 posts views Thread by mikea_59 | last post: by
1 post views Thread by George2 | last post: by
21 posts views Thread by coolguyaroundyou | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.