Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is there a way to run a javascript command on a page in IE.

Status
Not open for further replies.

Brawn

Programmer
Jul 5, 2001
73
0
0
CA
I want to access elements on a page to confirm there values without writing code into the actual Source itself.

I know an "alert" box in the source would do this but there must be another way.

script debugger would be an option also but I can't get it
working, it doesn't seem to want to attach itself

Any thought's,

[neutral]
Brawn

- The difference between genius and stupidity is that genius has its limits -
 
Let me see if I understand this correctly. You want to run some code without writing it on the page. Other than in an external Javascript file, where would this code exist?
 
Netscape has a JavaScript Console. So what does Internet Explorer have?
I Don't Know.

VB Code runs as interpreted code until it is compiled and it has an immediate window.

I want to know if Internet Explorer has the same functionality for JavaScript.
Brawn

- The difference between genius and stupidity is that genius has its limits -
 
If all you want to do is "see" the values on your page, open the page and look at the source code. If you're looking for a debugging tool where you can interactively step through your code to see the variables change then you're probably out of luck.

It'd be a lot quicker to write a few lines of code to get the info you want. There's always a better way...
 
IE doesn't have the same kind of debugger/console that Netscape does. If you want to do anything in IE for debugging, you'll have to use alert boxes. I use Netscape specifically for the debugging because IE doesn't have that feature.
 
Microsoft has a script debugger here:
Documentation here:
Got this info from the PageResources forum.

IE does provide some debugging information. If you click on the icon on bottom, left of the IE window when you get an error that usually provides sufficient information to track down the error. I then open up the page in notepad (hit CTRL+G) and goto the line with the problem. (autowrap must be turned off.)


Here's a script that might be of some help (though I've never used it).
It provides information on variables on the page.


P.S. if you decide to remove MS script debugger, here's how:
 
ok, I think I realized what was the question. (It is very hard sometimes to realise it!)
There's no JS console in IE, but you can do the following:
type javascript: in the address bar and then an expression you want to evaluate, just like you do it <script> section. For example:

javascript: 5*3 + Math.log(4)

or
javascript: var a=alert(5*3)

or
javascript: var a=alert(screen.width + ';\n' + navigator.appVersion)

This works in all browsers as well.
 
Thanks Everyone,
That's the information I'm Looking for.

Sorry If the post wasn't descriptive enough,
it looked good to me.
[smile] Brawn

- The difference between genius and stupidity is that genius has its limits -
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top