Why?

E

Evertjan.

Why?

==============
Oh please:<br>
<a href='javascript:"I told you so!";'>
Do not click me!</a>
==============
 
L

Lee

Evertjan. said:
Why?

==============
Oh please:<br>
<a href='javascript:"I told you so!";'>
Do not click me!</a>
==============

It does exactly what the javascript: protocol is supposed to do:
Replace the current page with the value of the Javascript expression.
 
E

Evertjan.

Lee wrote on 07 okt 2005 in comp.lang.javascript:
Evertjan. said:

It does exactly what the javascript: protocol is supposed to do:
Replace the current page with the value of the Javascript expression.

So it is the same as:

href='javascript:document.write("I told you so!");'

???
 
R

Randy Webb

Evertjan. said the following on 10/7/2005 12:14 PM:
Lee wrote on 07 okt 2005 in comp.lang.javascript:




So it is the same as:

href='javascript:document.write("I told you so!");'

???

No.
document.write will replace the current content of the page.
javascript:"I told you so!" will replace the current page itself.

Although both will create a new entry in the History trail.

Test both and look at the title bar. View Source and look at the file names.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top