javascript and vbscript in the same page

  • Thread starter William F. Robertson, Jr.
  • Start date
W

William F. Robertson, Jr.

My problem is I routinely use both vbscript and javascript (yes, that is a
problem in itself) on the same webpage. I feel placing the "javscript:" or
"vbscript:" on all my client side events is bloating the size of my page,
especially in my menu.

I am aware the "default" language of the page is the first defined script,
but I can not guarantee javascript will always be defined first. Is there a
way to wrap a block of html to have a default language? I was hoping to
accomplish this through a div wrapper, but that did not work.

I have about 17,000 links like this all in a row. Well, it really isn't
that many, but you can see the code bloat coming.

<a onclick="javascript: GoTo( "/page.aspx" );">page</a>
....

Any ideas or suggestions for this?

Thanks,

bill
 
R

Ray Costanzo [MVP]

I suggest you just stop using client-side VB Script. Also, have you
considered using the href attribute of the <a> tag instead of using
JavaScript to provide navigation?

Ray at work
 
W

William F. Robertson, Jr.

Ray,

I want to stop using it too, but we have lots and lots of vbscript export to
excel functions. And some of my developers are more comfortable with
vbscript. I am slowly converting them over to use javascript, but they came
from VB backgrounds, and I already used a lot of clout to change the site to
C# from VB.NET, so I am out of "bullets".

I am using the href tag (not in my sample), however it calls a function
name. This is a requirement of the system we have to differentiate between
the debug and release version of the build. We can change the vdir path
attribute and "/AP/Apdetails" will always go to the correct location client
side whether the path is http://dasc/ap/apdetails or
http://dascdev/test1/bob/AP/Apdetails without any code changes involving the
menu rendering.

So I am gathering it is not possible to set up a "block" of html to default
a specific language?

bill
 
B

bruce barker

you can try to keep the onclick code language independent, in your sample:

<a onclick="GoTo( "/page.aspx" )">page</a>

will work no matter the current language or what language GoTo is written
in. if you have to pass "this" you are stuck, but funny can be done this
way:

<script language="javascript">
window.Literal1 = "this uses' special chars/n";
</script>
......
<a onclick="CallWithGlobalLiteral(window.Literal1)">page</a>


-- bruce (sqlwork.com)


"William F. Robertson, Jr." <theman_at_fdrsucks.com> wrote in message
| My problem is I routinely use both vbscript and javascript (yes, that is a
| problem in itself) on the same webpage. I feel placing the "javscript:"
or
| "vbscript:" on all my client side events is bloating the size of my page,
| especially in my menu.
|
| I am aware the "default" language of the page is the first defined script,
| but I can not guarantee javascript will always be defined first. Is there
a
| way to wrap a block of html to have a default language? I was hoping to
| accomplish this through a div wrapper, but that did not work.
|
| I have about 17,000 links like this all in a row. Well, it really isn't
| that many, but you can see the code bloat coming.
|
| <a onclick="javascript: GoTo( "/page.aspx" );">page</a>
| ...
|
| Any ideas or suggestions for this?
|
| Thanks,
|
| bill
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top