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

a href with static and dynamic content using JavaScript

P: n/a
Hello all

I'm quite new to web development, so please be kind ;)

I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.

In the body part I use something like this:

<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>

but this doesn't work.
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
target="_blank"...>Linktext</a>
.... and some other stupid things.

Could you please help me out of this?! Will it ever work or do I have
to use other web-technologies to create my dynamic link?

Best regards,
Schuessi
Oct 29 '08 #1
Share this Question
Share on Google+
10 Replies


P: n/a
On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
Hello all

I'm quite new to web development, so please be kind ;)

I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.

In the body part I use something like this:

<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>

but this doesn't work.
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
target="_blank"...>Linktext</a>
... and some other stupid things.

Could you please help me out of this?! Will it ever work or do I have
to use other web-technologies to create my dynamic link?

Best regards,
Schuessi
Hello Schuessi.
try this..

<script language="JavaScript" type="text/javascript">
function getParam() {
return 'first';
}
function getLink() {
document.getElementById('link').href= 'mystaticlink.htm?
parameter=' + getParam();
}
</script>
<a href="#" onclick="getLink();" id="link">First</a>
Oct 29 '08 #2

P: n/a
On 29 Okt., 11:48, Suhas Dhoke <suhasdh...@gmail.comwrote:
On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
Hello all
I'm quite new to web development, so please be kind ;)
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.
In the body part I use something like this:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
but this doesn't work.
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
target="_blank"...>Linktext</a>
... and some other stupid things.
Could you please help me out of this?! Will it ever work or do I have
to use other web-technologies to create my dynamic link?
Best regards,
Schuessi

Hello Schuessi.
try this..

<script language="JavaScript" type="text/javascript">
function getParam() {
* * return 'first';}

function getLink() {
* * document.getElementById('link').href= 'mystaticlink.htm?
parameter=' + getParam();}

</script>
<a href="#" onclick="getLink();" id="link">First</a>
This works great, thank you!
Oct 29 '08 #3

P: n/a
On Oct 29, 6:48*am, Suhas Dhoke <suhasdh...@gmail.comwrote:
On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
Hello all
I'm quite new to web development, so please be kind ;)
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.
In the body part I use something like this:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
but this doesn't work.
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
target="_blank"...>Linktext</a>
... and some other stupid things.
Could you please help me out of this?! Will it ever work or do I have
to use other web-technologies to create my dynamic link?
Best regards,
Schuessi

Hello Schuessi.
try this..

<script language="JavaScript" type="text/javascript">
Don't use the language attribute.
function getParam() {
* * return 'first';}

function getLink() {
* * document.getElementById('link').href= 'mystaticlink.htm?
parameter=' + getParam();}

</script>
<a href="#" onclick="getLink();" id="link">First</a>
Ridiculous and inaccessible (whatever it is supposed to do.)
Oct 30 '08 #4

P: n/a
On Oct 29, 7:32*am, schuessi <schuessmas...@googlemail.comwrote:
On 29 Okt., 11:48, Suhas Dhoke <suhasdh...@gmail.comwrote:
On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
Hello all
I'm quite new to web development, so please be kind ;)
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.
In the body part I use something like this:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
but this doesn't work.
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
target="_blank"...>Linktext</a>
... and some other stupid things.
Could you please help me out of this?! Will it ever work or do I have
to use other web-technologies to create my dynamic link?
Best regards,
Schuessi
Hello Schuessi.
try this..
<script language="JavaScript" type="text/javascript">
function getParam() {
* * return 'first';}
function getLink() {
* * document.getElementById('link').href= 'mystaticlink.htm?
parameter=' + getParam();}
</script>
<a href="#" onclick="getLink();" id="link">First</a>

This works great, thank you!
No it doesn't. You have been advised to do something stupid. Agents
without script or with script disabled will feature a link that does
nothing.

If you can explain just what it is you are trying to do, perhaps you
will get some competent advice.
Oct 30 '08 #5

P: n/a
On Oct 29, 6:31*am, schuessi <schuessmas...@googlemail.comwrote:
Hello all

I'm quite new to web development, so please be kind ;)
If you are new to Web development, then why are you trying to write
scripted enhancements. You should concentrate on creating proper
static documents first. Worry about scripting later.
>
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.
A what of a what? This is what I am talking about. You are jumping
in with both feet before you know what you are getting into.
>
In the body part I use something like this:

<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>

but this doesn't work.
Which is hardly surprising. What made you think it would?
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
Programming by trial and error is not recommended.
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
You are officially lost.
target="_blank"...>Linktext</a>
... and some other stupid things.
Why are you wasting time with stupid things? Have you tried reading
about the subject?
>
Could you please help me out of this?! Will it ever work or do I have
to use other web-technologies to create my dynamic link?
I haven't the slightest idea what you are trying to do here.
Oct 30 '08 #6

P: n/a
On Oct 30, 5:55 am, David Mark <dmark.cins...@gmail.comwrote:
On Oct 29, 6:31 am, schuessi <schuessmas...@googlemail.comwrote:
Hello all
I'm quite new to web development, so please be kind ;)

If you are new to Web development, then why are you trying to write
scripted enhancements. You should concentrate on creating proper
static documents first. Worry about scripting later.
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.

A what of a what? This is what I am talking about. You are jumping
in with both feet before you know what you are getting into.
In the body part I use something like this:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
but this doesn't work.

Which is hardly surprising. What made you think it would?
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>

Programming by trial and error is not recommended.
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"

You are officially lost.
target="_blank"...>Linktext</a>
... and some other stupid things.

Why are you wasting time with stupid things? Have you tried reading
about the subject?
Could you please help me out of this?! Will it ever work or do I have
to use other web-technologies to create my dynamic link?

I haven't the slightest idea what you are trying to do here.
I wonder if we will get any reply on this one taking into
consideration that the OP just uttered the magic words; *it
works*. :-)

../sasuke
Oct 30 '08 #7

P: n/a
sasuke meinte:
>I haven't the slightest idea what you are trying to do here.

I wonder if we will get any reply on this one taking into
consideration that the OP just uttered the magic words; *it
works*. :-)
Another webpage atrocity meets the public. And I suppose the "solution"
gets copied thousands of times.

Gregor
Oct 30 '08 #8

P: n/a
On Oct 30, 10:37*am, Gregor Kofler <use...@gregorkofler.atwrote:
sasuke meinte:
I haven't the slightest idea what you are trying to do here.
I wonder if we will get any reply on this one taking into
consideration that the OP just uttered the magic words; *it
works*. :-)

Another webpage atrocity meets the public. And I suppose the "solution"
gets copied thousands of times.
Of course. I wonder what the blind community thinks of the Web. A
useless compendium of random gibberish? Google's excuse is they
"can't please everyone." It should be illegal (and is in some
countries, IIRC.) Perhaps that is the only way to take Website
development out of the hands of incompetents.
Oct 30 '08 #9

P: n/a
rf

"David Mark" <dm***********@gmail.comwrote in message
news:06**********************************@x41g2000 hsb.googlegroups.com...
On Oct 30, 10:37 am, Gregor Kofler <use...@gregorkofler.atwrote:
>Another webpage atrocity meets the public. And I suppose the "solution"
gets copied thousands of times.
>Of course. I wonder what the blind community thinks of the Web. A
useless compendium of random gibberish? Google's excuse is they
"can't please everyone." It should be illegal (and is in some
countries, IIRC.)
http://www.google.com.au/search?q=Maguire+vs+SOCOG

Oct 31 '08 #10

P: n/a
On Oct 30, 8:47*pm, "rf" <r...@invalid.comwrote:
"David Mark" <dmark.cins...@gmail.comwrote in message

news:06**********************************@x41g2000 hsb.googlegroups.com...
On Oct 30, 10:37 am, Gregor Kofler <use...@gregorkofler.atwrote:
Another webpage atrocity meets the public. And I suppose the "solution"
gets copied thousands of times.
Of course. *I wonder what the blind community thinks of the Web. *A
useless compendium of random gibberish? *Google's excuse is they
"can't please everyone." *It should be illegal (and is in some
countries, IIRC.)

http://www.google.com.au/search?q=Maguire+vs+SOCOG
Good link. I can't understand why, with all of the special interest
groups out there, nobody has taken Google to court on their numerous
accessibility barriers. Maybe then their "engineers" (quotes indicate
I once talked to one about this subject and he was no engineer) will
get the point.
Oct 31 '08 #11

This discussion thread is closed

Replies have been disabled for this discussion.