473,325 Members | 2,860 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Calling Javascript Function from within VB Procedure?

Dear Group

I'm using VB to write an aspnet application. I would like to call a
javascript function from within a VB Sub or VB Function, is it possible? My
code is something like this:

VB Code:
Public Sub VBProcedure()
..
..
Run some VB Code...
..
..
Now call the javascript function

End Sub
------------------------------------------------------
javascript:
<HEAD>
<script language=javascript>
<!--
// MyFunction
function myfunction() {
window.open()
}
//-->
</script>
</HEAD>

I tried javascript: myfunction() within the VB procedure. Well, it was just
a blind guess since the 'javascript:' syntax did not produce any errors.
What is 'javascript:' all about? I can't find it documented.

Thanks for your help & efforts!

Martin

Nov 20 '05 #1
4 6275
Cor
Hi Martin,

The most simple sample.

\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');}
</script>"
RegisterStartupScript("Startup", str)
///

I hope this helps a little bit?

Cor
Dear Group

I'm using VB to write an aspnet application. I would like to call a
javascript function from within a VB Sub or VB Function, is it possible? My code is something like this:

VB Code:
Public Sub VBProcedure()
.
.
Run some VB Code...
.
.
Now call the javascript function

End Sub
------------------------------------------------------
javascript:
<HEAD>
<script language=javascript>
<!--
// MyFunction
function myfunction() {
window.open()
}
//-->
</script>
</HEAD>

I tried javascript: myfunction() within the VB procedure. Well, it was just a blind guess since the 'javascript:' syntax did not produce any errors.
What is 'javascript:' all about? I can't find it documented.

Thanks for your help & efforts!

Martin

Nov 20 '05 #2

Hi Cor

Thanks for your message.
Well, I'm not exactly sure whether that's the answer to my problem. After
having had a look at the RegisterScript Methods, it seems to me that it is
just a convenient way to inject the Javascript into the page. I can do this
by writing it directly in the HTML view in VS. Or is there a difference.
Once having the Javsscript registered, I still need a HTML button on my page
whick calls the Javascript in the OnClick Event.

However in my case, I'm calling a VB Sub with the OnItemCommand Event of the
Datagrid to look up some data depending on the value choosen nin the
datagrid. So the OnItemCommand for the datagrid is already taken. At the
same time when the OnItemCommand Event fires I also would like to execute a
client-side Javascript function after the data has been looked up.
So I thought I'm calling the Javascript from within the VB Sub in which I
look up the data after completion of look-up.

Any possible way to achive this?

Thanks for your help & efforts!

Kind Regards,

Martin

"Cor" <no*@non.com> wrote in message
news:#M**************@tk2msftngp13.phx.gbl...
Hi Martin,

The most simple sample.

\\\
Dim str As String
str = "<script language=javascript> {window.open('http://www.google.com');} </script>"
RegisterStartupScript("Startup", str)
///

I hope this helps a little bit?

Cor
Dear Group

I'm using VB to write an aspnet application. I would like to call a
javascript function from within a VB Sub or VB Function, is it possible?

My
code is something like this:

VB Code:
Public Sub VBProcedure()
.
.
Run some VB Code...
.
.
Now call the javascript function

End Sub
------------------------------------------------------
javascript:
<HEAD>
<script language=javascript>
<!--
// MyFunction
function myfunction() {
window.open()
}
//-->
</script>
</HEAD>

I tried javascript: myfunction() within the VB procedure. Well, it was

just
a blind guess since the 'javascript:' syntax did not produce any errors.
What is 'javascript:' all about? I can't find it documented.

Thanks for your help & efforts!

Martin


Nov 20 '05 #3
Hi Cor

Thanks for your message.
Well, I'm not exactly sure whether that's the answer to my problem. After
having had a look at the RegisterScript Methods, it seems to me that it is
just a convenient way to inject the Javascript into the page. I can do this
by writing it directly in the HTML view in VS. Or is there a difference.
Once having the Javsscript registered, I still need a HTML button on my page
whick calls the Javascript in the OnClick Event.

However in my case, I'm calling a VB Sub with the OnItemCommand Event of the
Datagrid to look up some data depending on the value choosen nin the
datagrid. So the OnItemCommand for the datagrid is already taken. At the
same time when the OnItemCommand Event fires I also would like to execute a
client-side Javascript function after the data has been looked up.
So I thought I'm calling the Javascript from within the VB Sub in which I
look up the data after completion of look-up.

Any possible way to achive this?

Thanks for your help & efforts!

Kind Regards,

Martin

"Martin Feuersteiner" <th************@hotmail.com> wrote in message
news:c1**********@sparta.btinternet.com...
Dear Group

I'm using VB to write an aspnet application. I would like to call a
javascript function from within a VB Sub or VB Function, is it possible? My code is something like this:

VB Code:
Public Sub VBProcedure()
.
.
Run some VB Code...
.
.
Now call the javascript function

End Sub
------------------------------------------------------
javascript:
<HEAD>
<script language=javascript>
<!--
// MyFunction
function myfunction() {
window.open()
}
//-->
</script>
</HEAD>

I tried javascript: myfunction() within the VB procedure. Well, it was just a blind guess since the 'javascript:' syntax did not produce any errors.
What is 'javascript:' all about? I can't find it documented.

Thanks for your help & efforts!

Martin

Nov 20 '05 #4
Cor
Hi Martin,

I said that was the simplest one. And I have not direct the answer to your
datagrid, but look also look at this sample (you have to find the postback
event from the datagrid, than I think this will work than also).

\\\A webform with an imagebutton and two bitmaps in the solution map
Private Sub Page_Load(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Me.ImageButton1.ImageUrl = "bitmap2.bmp"
Me.ImageButton1.Attributes("onmouseover") = "this.src='bitmap1.bmp';"
Me.ImageButton1.Attributes("onmouseout") = "this.src='bitmap2.bmp';"
Me.ImageButton1.Attributes("onClick") = _
"window.location='mailto:no*@non.com?subject=C or demo&body=I hope this
helps?';"
End Sub
///

I hope this helps a little bit?

Cor
Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
by: Simula | last post by:
I am developing an HTML javascript application and I want to preserve state in a way that can be book-marked. I chose HTML anchors as a means of preserving state. When the application changes...
30
by: Tim Marshall | last post by:
Here's the scenario, A2003, Jet back end, illustrated with some cut down code at the end of the post: A proc dims a snapshot recordset (dim rst as Dao.recordset) and opens it. There are several...
4
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is...
1
by: Martin | last post by:
Dear Group I'm using VB to write an aspnet application. I would like to call a javascript function from within a VB Sub or VB Function, is it possible? My code is something like this: VB...
3
by: Shiraz | last post by:
Updated to the latest version of DBD-mysql using perl -MCPAN -e "install DBD-mysql" and now the calling mysql function r2() within perl work > $SQL_Text = "select r2() from dual " ; >...
5
by: Stephen Plotnick | last post by:
I'm very new to VB.NET, or any VB. I need to have form1 call form2 which calls form3, etc. I am able to use oledb in form1 to get the data. I build all the data for form2 and form3 from...
13
by: paragpdoke | last post by:
Hello Everyone. Merry Christmas to all ! I'm a JavaScript newbie (and new to thescripts.com too). And I have problems in working with objects in JavaScript. The problem: <a...
4
by: raghuvendra | last post by:
Hi I have a jsp page with 4 columns: namely Category name , Category order, Input field and a submit button. All these are aligned in a row. And Each Category Name has its corresponding Category...
9
by: mrcheeky | last post by:
Hi, I'm stuck, but it's almost working! From a html page, my javascript calls a server-side php script. The php reads a value from a server-side .txt file and passes it back as a javascript...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.