Welcome to Dream.In.Code
Getting Help is Easy!

Join 136,456 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,886 people online right now. Registration is fast and FREE... Join Now!




Running javascript

 
Reply to this topicStart new topic

Running javascript

andiyuniar
6 Aug, 2008 - 06:20 PM
Post #1

New D.I.C Head
*

Joined: 15 Apr, 2007
Posts: 35


My Contributions
Hi there...

I want to ask, how to run a javascript from js file in behind code?

I create a code like this but, it not do anything...
please help me with this..
or any other way to do this?

CODE

Response.Write("<script language=javascript >")
If JenisTheme <> "" Then
    If V_Valid = False Then
         Response.Write("alert(""There is no analyse in this level"");")
    Else
         Response.Write("window.opener.createThemetik();")
         Response.Write("window.close();")
    End If
Else
     Response.Write("alert(""Please, select object"");")
End If
Response.Write("</script>")




thanks

This post has been edited by andiyuniar: 7 Aug, 2008 - 01:09 AM
User is offlineProfile CardPM
+Quote Post

andiyuniar
RE: Running Javascript
11 Aug, 2008 - 08:31 PM
Post #2

New D.I.C Head
*

Joined: 15 Apr, 2007
Posts: 35


My Contributions
hi there..

i try a code to run javascript, i got and modified this from msdn, but nothing happen..

please, give me a clue..

CODE

Partial Class _Default
    Inherits System.Web.UI.Page


    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        DisplayAlert("Hello, World!")
    End Sub

    Sub DisplayAlert(ByVal message As String)
        RegisterClientScriptBlock(Guid.NewGuid().ToString(), _
                         "<script language=""JavaScript"">" & GetAlertScript(message) & "</script>")
    End Sub

    Function GetAlertScript(ByVal message As String) As String
        Return "alert('" & message.Replace("'", "\'") & "');"
    End Function
End Class


this an aspx code
CODE

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server" method="post">
    <div>
        <asp:TextBox ID="TextBox1" runat="server" Width="216px"></asp:TextBox><br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="showMessage" />&nbsp;</div>
    </form>
</body>
</html>


User is offlineProfile CardPM
+Quote Post

andiyuniar
RE: Running Javascript
12 Aug, 2008 - 06:43 PM
Post #3

New D.I.C Head
*

Joined: 15 Apr, 2007
Posts: 35


My Contributions
finnaly i found out why, when i run the program in mozilla, there is no problem.
it's my IE that has a problem...
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 03:38PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month