Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Devaka Cooray
Sheriffs:
Liutauras Vilda
paul wheaton
Rob Spoor
Saloon Keepers:
Tim Moores
Stephan van Hulst
Tim Holloway
Piet Souris
Mikalai Zaikin
Bartenders:
Carey Brown
Roland Mueller
Forum:
HTML Pages with CSS and JavaScript
JavaScript in URL not working
John Eipe
Ranch Hand
Posts: 215
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hi All,
I read that it's possible to run
java
script in URLs using the javascript: pseudoprotocol specifier.
I tried typing into address bar,
javascript:alert("hello");
but when I try
javascript:var now = new Date( ); "<h1>The time is:</h1>" + now;
or
javascript:document.write("hello");
nothing happens!
www.cs-repository.info
John Eipe
Ranch Hand
Posts: 215
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please explain bookmarklets also. :-)
Is it a js code that runs when a user tries to bookmark a page?
www.cs-repository.info
Eric Pascarello
author
Posts: 15385
6
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
This is not a valid JavaScript
javascript:var now = new Date( ); "<h1>The time is:</h1>" + now;
What is it supposed to do with the
string
"<h1>The time is:</h1>" + now;
?
Bookmarklets do not run when a user bookmarks the site. They are run when a user clicks on the bookmark in their bookmarks list of links.
Go through the code at
http://www.bookmarklets.com/tools/categor.html
and see how bookmarklets work.
Eric
Rafael Monteiro Dourado
Greenhorn
Posts: 9
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
John Eipe , javascript works in url, but the code can't have errors .
that code will not run, cuz it's wrong:
var now = new Date( ); "<h1>The time is:</h1>" + now;
Web Programmer
http://rafaelmd.com.br
John Eipe
Ranch Hand
Posts: 215
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I got that piece of code from OReilly.JavaScript.The.Definitive.Guide.
And what about document.write?
www.cs-repository.info
John Eipe
Ranch Hand
Posts: 215
posted 14 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Thanks Eric. That site is interesting.
www.cs-repository.info
See where your hand is? Not there. It's next to this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
Problem in request forwarding
JSF page Declarations
while-loop
Confused with flush() behavior
How Do I Access All of the src Attributes of All of the Images in a Web Page?
More...