Q&A: JAVASCRIPT WITHOUT HTML?

Question by :
Javascript WITHOUT HTML?
I’m trying to make a JSS code that you can copy+paste into your browser bar. I already have this code:
javascript:function reverse() { var inp = “.tset a si siht”;
var outp=”";for (i = 0; i <= inp.length; i++)
{ outp =inp.charAt (i) + outp;}alert(outp) ;}; reverse();
Which makes a popup box appear when you paste it into your browser bar (I know it's not necessary to reverse the plaintext, I am just doing it so I can learn as much as possible). I am trying to make TWO clickable buttons, one that states ok, and one that states cancel, both of which lead to different sites. I know how to do it in HTML JSS, but I cannot seem to make it work without being embedded in HTML. The HTML code for what I am looking for is as such:
If anyone could tell me how to integrate the options of the second script into the first, I’d be much appreciative!
Thanks guys!
(P.S. If you could tell me how to get rid of that pesky “Message From Webpage” text in the top of the box, that is extra credit ![]()
@ Robert: But if it’s possible to make the popup box by typing it into the address bar, why would the text of the buttons not be editable? I can change the text of the message… Why would I not be able to change the text of the buttons and the upper salutation?
@ Steve: That works wonderfully!
Thank you! But how would I incorporate the same reversed text in the boxes? I am still scratching my head on how to add that in…
——————————————
Answer by Robert
Don’t think its possible unless its already on a page which has assigned arrays/booleans;
function makeArray(arg1, arg2){
return [ this, arg1, arg2 ];
}
——————————————
Give your own answer to this question below!









about 2 months ago
what you’ve done looks overly complicated?
this works for me using google chrome. displays a confirm box. clicking okay goes to one site, cancel leads to another. paste the following into your browsers address bar.
javascript:
var answer = confirm(“something”);
if (answer) {
alert(“one”);
window.location = “http://www.google.com/”;
}
else{
alert(“two”);
window.location = “http://www.ask.com”;
}
edit:
@jeff
What is it your trying to do exactly? why do you want to reverse text? if you email me some contact information, like messenger or something and what it is your trying to do then maybe i could help you out some more.