Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 21st, 2005, 11:21 AM
Authorized User
 
Join Date: Jul 2005
Location: New York, New York, .
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trigger javascript using ASP

Is that possible?

Reply With Quote
  #2 (permalink)  
Old September 22nd, 2005, 05:07 AM
Friend of Wrox
 
Join Date: Jul 2003
Location: , , United Kingdom.
Posts: 683
Thanks: 0
Thanked 1 Time in 1 Post
Default

What exactly are you trying to do?

Is the javascript client or server-side?

Cheers,

Chris

Reply With Quote
  #3 (permalink)  
Old September 22nd, 2005, 06:11 AM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii g2000!!
 offcourse you can do this
<script>
function myfun()
{
//ur code
}
</script>
<%
a=10
'asp code here
if(a=10) then
 %>
   <script>
    myfun();
   </script>
<% end if%>
hope this will help you

Cheers :)

vinod
Reply With Quote
  #4 (permalink)  
Old September 22nd, 2005, 06:44 AM
Friend of Wrox
Points: 8,019, Level: 38
Points: 8,019, Level: 38 Points: 8,019, Level: 38 Points: 8,019, Level: 38
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: Mauchline, East Ayrshire, Scotland
Posts: 1,525
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to crmpicco Send a message via AIM to crmpicco Send a message via MSN to crmpicco Send a message via Yahoo to crmpicco
Default

or even embed the whole function inside a ASP IF statement:

[code]

<% if Picco = true then %>
<script language=javascript>
function picco()
{
....
.your JS code
....

....
}

</script>

<% end if%>

HTH,

Picco

www.crmpicco.co.uk
www.crmpicco.co.uk.tt
www.milklemonadechocolate.uk.tt
www.griswolds.uk.tt
www.piccosmini.co.uk.tt
www.morton.uk.tt
Reply With Quote
  #5 (permalink)  
Old September 23rd, 2005, 08:22 AM
Authorized User
 
Join Date: Jul 2005
Location: New York, New York, .
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks guys! but.... It seems some are executed and some aren't.

here's the extract:

<% If rs("mySelect1") <> "" Then %>
  <script language="javascript">
    alert('test');
    document.getElementById('mySelect1').value =
        <% =rs("mySelect1") %> ;
  </script>
<% End If %>

<select name="mySelect1" id="mySelect1">
  <option value="">---</option>
  <option value="1">1</option>
  <option value="2">2</option>
</select>

Any clue?

Reply With Quote
  #6 (permalink)  
Old September 23rd, 2005, 08:23 AM
Authorized User
 
Join Date: Jul 2005
Location: New York, New York, .
Posts: 59
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I meant the alert box pops up but the select box won't be selected.

Reply With Quote
  #7 (permalink)  
Old September 25th, 2005, 11:30 PM
Friend of Wrox
 
Join Date: Oct 2004
Location: delhi, delhi, India.
Posts: 553
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to vinod_yadav1919 Send a message via Yahoo to vinod_yadav1919
Default

Hii g2000!!

Change your code execution steps :)
i.e


<select name="mySelect1" id="mySelect1">
  <option value="">---</option>
  <option value="1">1</option>
  <option value="2">2</option>
</select>

<% If rs("mySelect1") <> "" Then %>
  <script language="javascript">
    alert('test');
    document.getElementById('mySelect1').value =
        <% =rs("mySelect1") %> ;
  </script>
<% End If %>


Note-The reason is that at the time of script executing there is no element with 'mySelect1' option ,so you need to place ur script just below to Option.
Hope this will help you

Cheers :)

vinod
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
trigger stored procedures from asp Kornel Classic ASP Databases 7 July 15th, 2004 10:47 PM
asp/javascript Toka1 Classic ASP Basics 4 April 26th, 2004 06:13 AM
asp within javascript? vivalet Javascript How-To 2 November 14th, 2003 04:17 PM
asp and javascript. face Classic ASP Databases 1 September 22nd, 2003 11:33 AM



All times are GMT -4. The time now is 08:22 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.