aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Removing JavaScript from body Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Removing JavaScript from body" Watch "Removing JavaScript from body" New topic
Author

Removing JavaScript from body

Marc Luzietti
Ranch Hand

Joined: Feb 02, 2006
Posts: 84
I'm trying to clean as much JS crud from <body> as I can. I have a couple methods I wish to eliminate from the body but still have available. How do I do it?

on keydown="function1();"
on submit="function2();"
on contextmenu="return true;"

I have a little script called start.js that calls all my on-loads. I tried simply moving things there, but it didn't work how I wanted it. Any ideas?



It's for an internal app on IE6, there will be no Opera or Firefox or Lynx or Safari or IE7.
[ October 19, 2006: Message edited by: Marc Luzietti ]

Support Kathy Sierra
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
document.onkeydown

document.forms[0].formName.onsubmit <-- needs to be initilized onload

I think context is window.on..

Eric
Marc Luzietti
Ranch Hand

Joined: Feb 02, 2006
Posts: 84
Something like this? (Dashes included to get past code control.)


[ October 19, 2006: Message edited by: Marc Luzietti ]
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
When you assign a function to an event handler, you do not include the (). Including () tells it to fire right than an there. Without the () you are assiging a reference.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Removing JavaScript from body
 
Similar Threads
URL Link
making a slideshow
1.2 Custom Component - Body Content From Backing Bean
URL Encoded Mail Body
Struts tiles help