IPB

ISO Image Creator | Cheap EQ2 gold - Buy EQ2 gold, EVE ISK, EQ Plat and more!

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Some cool little Javascript commands
bfarber
post Dec 3 2004, 12:01 PM
Post #1


Administrator
Group Icon

Group: Admin
Posts: 10,302
Joined: 9-February 03
From: Jacksonville, FL
Member No.: 1
 United States


Well, recently I was at Lightstar's site and noticed a section I hadn't seen there before. I became curious as to when it was added.

Then I remembered, javascript can do this for you. biggrin.gif So naturally, I searched google and found out how. In addition to this little trick, I've included some other nifty things javascript can do for you as well in this tutorial.




To find the last modified date of a webpage:
Type into the address bar:
java script:alert(document.lastModified)

Note: Keep in mind sites such as this one that generate pages dynamically will show a last modified time of the time you loaded the page. Also, different time zones and server times will affect the date displayed. Don't take this at face value, but rather just as a way to get an idea of how new the page is. wink.gif



To make a popup say whatever you want:
Type into the address bar: java script:alert("Eat my shorts")

Note: Notice the quotes. These are important within the parenthesis of this function. Also, be aware you can type whatever you like in between these quotes.



To do arithmetic:
Type into the address bar: java script:alert(1+5)

Note: You can perform more than just addition through this method. Calculator is much quicker however. wink.gif



To find the background color of a webpage:
Type into the address bar: java script:alert(document.bgColor)

Note: Will be returned as the hex number of the color specified in the source code as the background color.



To find out what cookies the page has stuck on your computer:
Type into the address bar: java script:alert(document.cookie)

Note: This will give you a popup listing your cookies. This popup may be impossible to read, may provide info such as your username and/or password, or may be blank. Don't put much faith into this, as the results won't be very useful.



To find out where a webpage is submitting it's forms:
Type into the address bar: java script:alert(document.forms[0].action)

Note: This will return the action url for the first form in a document. To find the same info for a second form, use java script:alert(document.forms[1].action) and so on. Just start with 0 as the first form and increment accordingly.



To find specific details:
For browser type: java script:alert(navigator.appName)
For version/OS version: java script:alert(navigator.userAgent)
For platform: java script:alert(navigator.platform)
For pages viewed: java script:alert(history.length)
For color depth: java script:alert(window.screen.colorDepth)
For screen resolution: java script:alert('Your screen is:\n\n' + screen.width + ' pixels by ' + screen.height + ' pixels')




Now, there are probably hundreds of other tricky neat little tips I could add, and if you would like to add some of your own, feel free to use the comments feature of the this tutorial to add your comments....however, these seem to be the easiest, quickest and most requested.

Enjoy! biggrin.gif

Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 

Lo-Fi Version Time is now: 8th August 2008 - 02:15 PM

  Page top

Webber Enhanced skin created by Im4eversmart of RuneHQ.

  Webmasters     Cool Sites     Money Network     Privacy Policy