Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 5th, 2010, 10:11 AM
Authorized User
 
Join Date: Apr 2009
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need help with image onclick function

Click event on image doesn't fire the any kind of alert message box.

Can anyone please help what I am doing wrong?

<
formname="edit"action="abc_edit.asp"method="POST"onsubmit="return add_onSubmit()">
<
tableborder="0"cellpadding="10"cellspacing="0">

function chkAmount(txtamount,txtamountb,x,y,z)(
errorcheck = 0;
if (Number(txtamount) + Number(y) >= Number(x)){
alert("Message 1 !");
errorcheck =1;
}
if (errorcheck == 1) {
return false;
}

if (Number(txtamountb) + Number(z) >= Number(x)){
alert("Message 2 !");
errorcheck =1;
}
if (errorcheck == 1) {
return false;
}
}

<td><inputtype="Text"name="name1"value="<%=name1%>"size="40"onchange="Javascript: return checkAmount(document.edit.name1.value,<%=x %>,<%=y%>);"></td>

<td><inputtype="Text"name="name2"value="<%=name2%>"size="40"onchange="Javascript: return checkAmountB(document.edit.name2.value,<%=x %>,<%=z%>);"></td>

<td>
<
inputTYPE="image"src="/images/a.gif"onMouseover="src=&quot;/images/a.gif&quot;"onMouseout="src=&quot;/images/a.gif&quot;"VALUE="Save"id="image1"name="image1"onclick="Javascript: return chkAmount(document.edit.name1.value,document.edit. name2.value,<%=x%>,<%=y%>,<%=z%>);">
</td>
</table>
</form>
 
Old May 5th, 2010, 06:32 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

You need much more help than you think. You need to look at all your code an place some spaces in lots of places EG:

<formname should be <form name
<inputType should be <input type

I dont think this page will display anything except for printiing your Javascript to the browser. where are you <script> and </script> tags
.
Sorry I dont have time to re-write your page. Are you saying it runs and loads?
__________________
Wind is your friend
Matt
 
Old May 6th, 2010, 07:59 AM
Authorized User
 
Join Date: Apr 2009
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for looking into it...but I fixed the issue...
 
Old May 6th, 2010, 07:06 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

No worries. Hey I dont say this to be rude however.....If you solve an issue you post here let people know. You will frustrate people on forums if they spend time helping you when its not neccessary. I mean if I had the time I may have re-written your code, lets face it, the whole thing needed to be re-written. I have not seen a page in an ASP forum before with so many simple HTML issues.
__________________
Wind is your friend
Matt
 
Old May 7th, 2010, 08:01 AM
Authorized User
 
Join Date: Apr 2009
Posts: 52
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Sorry about the frustration but as soon as I solve it I put a comment that I solved it.
 
Old May 8th, 2010, 06:33 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
I have not seen a page in an ASP forum before with so many simple HTML issues.
This is not the original code, but a serious bug in this forum's editor. Whenever you paste colored code from, say, Visual Studio and forget to wrap it in code tags, the editor deletes the spaces....

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to retrieve image name with onclick beetle_jaipur Javascript How-To 5 April 6th, 2009 10:16 AM
Image button onclick msbsam ASP.NET 2.0 Basics 0 December 30th, 2006 04:47 AM
swap image onclick The Beginner Javascript How-To 2 November 8th, 2006 08:42 AM
How to use Onclick function for this jaya2109 BOOK: Beginning ASP 3.0 5 June 22nd, 2004 07:28 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.