Connecting Tech Pros Worldwide Forums | Help | Site Map

a href with static and dynamic content using JavaScript

schuessi
Guest
 
Posts: n/a
#1: Oct 29 '08
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

Suhas Dhoke
Guest
 
Posts: n/a
#2: Oct 29 '08

re: a href with static and dynamic content using JavaScript


On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
Quote:
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>
schuessi
Guest
 
Posts: n/a
#3: Oct 29 '08

re: a href with static and dynamic content using JavaScript


On 29 Okt., 11:48, Suhas Dhoke <suhasdh...@gmail.comwrote:
Quote:
On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
>
>
>
Quote:
Hello all
>
Quote:
I'm quite new to web development, so please be kind ;)
>
Quote:
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.
>
Quote:
In the body part I use something like this:
>
Quote:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
>
Quote:
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.
>
Quote:
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?
>
Quote:
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!
David Mark
Guest
 
Posts: n/a
#4: Oct 30 '08

re: a href with static and dynamic content using JavaScript


On Oct 29, 6:48*am, Suhas Dhoke <suhasdh...@gmail.comwrote:
Quote:
On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
>
>
>
Quote:
Hello all
>
Quote:
I'm quite new to web development, so please be kind ;)
>
Quote:
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.
>
Quote:
In the body part I use something like this:
>
Quote:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
>
Quote:
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.
>
Quote:
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?
>
Quote:
Best regards,
Schuessi
>
Hello Schuessi.
try this..
>
<script language="JavaScript" type="text/javascript">
Don't use the language attribute.
Quote:
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.)
David Mark
Guest
 
Posts: n/a
#5: Oct 30 '08

re: a href with static and dynamic content using JavaScript


On Oct 29, 7:32*am, schuessi <schuessmas...@googlemail.comwrote:
Quote:
On 29 Okt., 11:48, Suhas Dhoke <suhasdh...@gmail.comwrote:
>
>
>
Quote:
On Oct 29, 3:31*pm, schuessi <schuessmas...@googlemail.comwrote:
>
Quote:
Quote:
Hello all
>
Quote:
Quote:
I'm quite new to web development, so please be kind ;)
>
Quote:
Quote:
I have a JS-function called getObjURL() which should return an URL-
String of an JS-object.
>
Quote:
Quote:
In the body part I use something like this:
>
Quote:
Quote:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
>
Quote:
Quote:
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.
>
Quote:
Quote:
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?
>
Quote:
Quote:
Best regards,
Schuessi
>
Quote:
Hello Schuessi.
try this..
>
Quote:
<script language="JavaScript" type="text/javascript">
function getParam() {
* * return 'first';}
>
Quote:
function getLink() {
* * document.getElementById('link').href= 'mystaticlink.htm?
parameter=' + getParam();}
>
Quote:
</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.
David Mark
Guest
 
Posts: n/a
#6: Oct 30 '08

re: a href with static and dynamic content using JavaScript


On Oct 29, 6:31*am, schuessi <schuessmas...@googlemail.comwrote:
Quote:
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.
Quote:
>
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.
Quote:
>
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?
Quote:
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
Programming by trial and error is not recommended.
Quote:
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
You are officially lost.
Quote:
target="_blank"...>Linktext</a>
... and some other stupid things.
Why are you wasting time with stupid things? Have you tried reading
about the subject?
Quote:
>
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.
sasuke
Guest
 
Posts: n/a
#7: Oct 30 '08

re: a href with static and dynamic content using JavaScript


On Oct 30, 5:55 am, David Mark <dmark.cins...@gmail.comwrote:
Quote:
On Oct 29, 6:31 am, schuessi <schuessmas...@googlemail.comwrote:
>
Quote:
Hello all
>
Quote:
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.
>
>
>
Quote:
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.
>
>
>
Quote:
In the body part I use something like this:
>
Quote:
<a href="../mystaticlink.htm?parameter=javascript:getObjURL()"
target="_blank"...>Linktext</a>
>
Quote:
but this doesn't work.
>
Which is hardly surprising. What made you think it would?
>
Quote:
I also tried:
<a href="../mystaticlink.htm?parameter="+javascript:getObjURL( )
target="_blank"...>Linktext</a>
>
Programming by trial and error is not recommended.
>
Quote:
<a href="../mystaticlink.htm?parameter=<%javascript:getObjURL( )%>"
>
You are officially lost.
>
Quote:
target="_blank"...>Linktext</a>
... and some other stupid things.
>
Why are you wasting time with stupid things? Have you tried reading
about the subject?
>
>
>
Quote:
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
Gregor Kofler
Guest
 
Posts: n/a
#8: Oct 30 '08

re: a href with static and dynamic content using JavaScript


sasuke meinte:
Quote:
Quote:
>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
David Mark
Guest
 
Posts: n/a
#9: Oct 30 '08

re: a href with static and dynamic content using JavaScript


On Oct 30, 10:37*am, Gregor Kofler <use...@gregorkofler.atwrote:
Quote:
sasuke meinte:
>
Quote:
Quote:
I haven't the slightest idea what you are trying to do here.
>
Quote:
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.
rf
Guest
 
Posts: n/a
#10: Oct 31 '08

re: a href with static and dynamic content using JavaScript



"David Mark" <dmark.cinsoft@gmail.comwrote in message
news:0622f913-40d5-4921-bb1a-220c81dd9858@x41g2000hsb.googlegroups.com...
On Oct 30, 10:37 am, Gregor Kofler <use...@gregorkofler.atwrote:
Quote:
Quote:
>Another webpage atrocity meets the public. And I suppose the "solution"
>gets copied thousands of times.
Quote:
>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



David Mark
Guest
 
Posts: n/a
#11: Oct 31 '08

re: a href with static and dynamic content using JavaScript


On Oct 30, 8:47*pm, "rf" <r...@invalid.comwrote:
Quote:
"David Mark" <dmark.cins...@gmail.comwrote in message
>
news:0622f913-40d5-4921-bb1a-220c81dd9858@x41g2000hsb.googlegroups.com...
On Oct 30, 10:37 am, Gregor Kofler <use...@gregorkofler.atwrote:
>
Quote:
Quote:
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.
Closed Thread


Similar JavaScript / Ajax / DHTML bytes