?
Solved

how can asp call js function?

Posted on 2007-11-15
7
Medium Priority
?
440 Views
Last Modified: 2012-08-13
i mean with no user help...no links no actions...
<input type="button" value="Click Me!" onclick="getData()" />

just want add inside of some if a code that will call js function
0
Comment
Question by:sasha85
[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
7 Comments
 
LVL 25

Expert Comment

by:imitchie
ID: 20288139
you can still have javascript sections in asp pages, i.e.

<script language="javascript">
 function getData() {
   // js code
 }
</script>

and referenced in your html  <input type="button" value="Click Me!" onclick="getData()" />
0
 
LVL 11

Expert Comment

by:Sven
ID: 20288146
You can only transmit data with reloading page and using querystring or by posting the data to the server (AJAX).
0
 

Author Comment

by:sasha85
ID: 20288167
you mean:
if x=y then
js1...
else
js2
end if
?

do you know where i can find a good ajax\ajaxed example that i can view its code and make some changes?
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

 
LVL 11

Accepted Solution

by:
Sven earned 1050 total points
ID: 20288176
I think I missunderstood your question ;)

As imitchie said you can use a code like the following:
<%
If x = y Then
  %>
  <script language="javascript">
  <!--
  alert('1');
  //-->
  <%
Else
  %>
  <script language="javascript">
  <!--
  alert('2');
  //-->
  <%
End If
%>

Open in new window

0
 

Author Comment

by:sasha85
ID: 20288203
what did you mean with the ajax?
somehow always when i find a nice short code of ajax on the web and i copy it to my computer
i got "ajaxed is undefined' do you know why can it be?
0
 
LVL 11

Expert Comment

by:Sven
ID: 20288222
I thought you would set data of the client javascript to asp.

If you copy Ajax-code you also need the included framework (like prototype.js). Please post another question for this with code examples!
0
 
LVL 5

Expert Comment

by:pavaneeshkumar
ID: 20288376
<input type="button" value="Click Me!" onclick="getData()" /> change this line to

<input type="button" value="Click Me!" onclick="getData();" />

see this code Snippet
<html><title>hello js</title>
<script type="text/javascript">
 
function hello()
{
	alert("Hello from button click");
}
</script>
 
<body>
 
<form>
<input type="button" value="CodingForums" onClick="hello();" />
</form>
</body>

Open in new window

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
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

777 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