?
Solved

convert VB to javascript

Posted on 2011-09-15
7
Medium Priority
?
566 Views
Last Modified: 2012-05-12
Is it possible to convert this VB script to javascript?  This code works behind a button on a .net application.

Just wanted to see if javascript might make it more browser compliant
<table id="tblReqField" class="Form"> <tr class="SectionHeader"><TH>Actions</TH></TR></TABLE>

<button class="exButton" language="VBS" onclick="DoSomething()">Schedule appointment</button>

<script language="VBS">

Sub DoSomething()

   window.location = "WflRequest.aspx?CopyFields=1;2;30;31;91;&BCAction=0&Type=6011&CopyFrom=" & frmMain.RequestID.Value

End Sub

</script>

Open in new window

0
Comment
Question by:red_75116
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
7 Comments
 
LVL 82

Assisted Solution

by:leakim971
leakim971 earned 1000 total points
ID: 36546450
<table id="tblReqField" class="Form"> <tr class="SectionHeader"><TH>Actions</TH></TR></TABLE>

<button class="exButton" onclick="DoSomething()">Schedule appointment</button>

<script language="javascript" type="text/javascript">

function DoSomething() {
   window.location.href = "WflRequest.aspx?CopyFields=1;2;30;31;91;&BCAction=0&Type=6011&CopyFrom=" + document.getElementsByName("RequestID")[0].value;
}

</script>

Open in new window

0
 

Author Comment

by:red_75116
ID: 36546542
thanks!  that works, but I was hoping to get this to work in chrome and possibly firefox but it doesn'.  Any ideas how to make work in other browsers??
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546568
it should work on all
do you have a link to see your page?
0
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

 

Author Comment

by:red_75116
ID: 36546585
it works fine in IE, but flashes the page, but doesnt open the link in Chrome.  Haven't downloaded FF yet to try.
0
 
LVL 82

Expert Comment

by:leakim971
ID: 36546604
let me see that in live

unactive your popup blocker
0
 

Author Comment

by:red_75116
ID: 36546610
it could be my app not your code

found this error in chrome
Failed to load resource: the server responded with a status of 400 (Bad Request)

0
 
LVL 82

Accepted Solution

by:
hielo earned 1000 total points
ID: 36547235
try:
<script type="text/javascript">

function DoSomething()
{
   window.location.href = "WflRequest.aspx?CopyFields=1;2;30;31;91;&BCAction=0&Type=6011&CopyFrom=" + document.frmMain.RequestID.value;

}

</script>


NOTE: Unlike VBScript, Javascript IS case sensitive. Thus, due to:
document.frmMain.RequestID.value;

your HTML should have:
<form name="frmMain"...>

but NOT <form name="FrmMain"...> (notice the capital "F").  To javascript, frmMain and FrmMain are different.

The same goes for the other input - you should have:
<input name="RequestID" ...>

IF your markup is different, then adjust the javascript line accordingly - in other words, if you have:

<form name="FRMMain"...>
<input name="requestID" ...>

then you should use this instead:
document.FRMMain.requestID.value;

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question