Hey guys, i was trying to use alert message for php string,but dunno why the alert can`t be displayed, so please help me where i did wrong, THANKS SO MUCH
here is the code: -
<SCRIPT LANGUAGE=JAVASCRIPT>
-
function disp_alert()
-
{
-
alert = "Serial Number Must Be Start With S";
-
}
-
</SCRIPT>
php code: -
if(substr($sn,0,1) == "S")
-
else
-
{
-
$message="Serial Number Must Be Start With S.";
-
}
JS code: -
<input name="sn" type="text" onKeyDown="disp_alert()" "if(event.keyCode==13) event.keyCode=9 ;"size="26" >
15 7298
just changed code like this: -
<%
-
if(substr($sn,0,1) == "S")
-
-
else
-
{
-
$message="Serial Number Must Be Start With S";
-
echo "alert(".$message.")";
-
}
-
%>
-
still same, the alert window not display.
Heya, cyberlei.
Please use CODE tags when posting source code:
[CODE=php]
PHP code goes here.
[/CODE]
sorry about that.
I already fixed that alert message issue, Thanks anyway
sorry about that.
I already fixed that alert message issue, Thanks anyway
Just post the answer here for someone who have same issue on that. -
-
echo '<script>alert("Serial Number Must Be Start With S");</script>';
-
-
Heya, cyberlei.
Thanks for posting your solution.
Glad to hear you got it working! Good luck with your project, and if you ever need anything, post back anytime :)
I have problem that there is alert msg showing but my php page (web page) is blank white page When alert box removes that page again get appears,I want the should appear and at the same time alert msg also be shown.Plz, help me!
Thanks!
Prashant
I have problem that there is alert msg showing but my php page (web page) is blank white page When alert box removes that page again get appears,I want the should appear and at the same time alert msg also be shown.Plz, help me!
Thanks!
Prashant
Tell properly what you are trying to do, and what's happening?
I have problem that there is alert msg showing but my php page (web page) is blank white page When alert box removes that page again get appears,I want the should appear and at the same time alert msg also be shown.Plz, help me!
Thanks!
Prashant
have a look at setTimeOut() or setInterval()
Just post the answer here for someone who have same issue on that. -
-
echo '<script>alert("Serial Number Must Be Start With S");</script>';
-
-
Hi,
Thanx 4 ur code.
But i'm having some problem with it.
The alert msg works. But when i clicks OK button, it wil goes to next reference page and not stands at the same page.
Why its happened?
What can I do?
Plz...Help me out...
Thanx n Regards
Yas
Hi,
Thanx 4 ur code.
But i'm having some problem with it.
The alert msg works. But when i clicks OK button, it wil goes to next reference page and not stands at the same page.
Why its happened?
What can I do?
Plz...Help me out...
Thanx n Regards
Yas
What are you doing after the alert?...
You must return false after this. in the same loop as alert is.
What are you doing after the alert?...
You must return false after this. in the same loop as alert is.
yah, i wrote it.
Can u give me the proper code for it...???
Thanx n Regards
Yas.
yah, i wrote it.
Can u give me the proper code for it...???
Thanx n Regards
Yas.
[html]<form onsubmit="return onSubmitOfForm();" action="abc.php" method="post | get">[/html] - function onSubmitOfForm() { //use this on onsubmit of form, or onlick of submit button.
-
if (CONDITION==true) { //whichever condition you are verifying
-
return true;
-
else {
-
alert ('MESSAGE'); //your message in case condition not fulfilled
-
return false;
-
}
-
}
If this is not what you needed, send your code. Only then I can help. PS: Ask such questions in Javascript Forum
[html]<form onsubmit="return onSubmitOfForm();" action="abc.php" method="post | get">[/html] - function onSubmitOfForm() { //use this on onsubmit of form, or onlick of submit button.
-
if (CONDITION==true) { //whichever condition you are verifying
-
return true;
-
else {
-
alert ('MESSAGE'); //your message in case condition not fulfilled
-
return false;
-
}
-
}
If this is not what you needed, send your code. Only then I can help. PS: Ask such questions in Javascript Forum
Thanx a lot.....
It's working....
But i'm having a doubt.
Is it possible to embed the same code with in PHP code...???
Thanx n Regards
Yas
Thanx a lot.....
It's working....
But i'm having a doubt.
Is it possible to embed the same code with in PHP code...???
Thanx n Regards
Yas
Embed it in the <SCRIPT> tag in the <HEAD> of HTML
PS: It may help you if you read some basics of JavaScript
Embed it in the <SCRIPT> tag in the <HEAD> of HTML
PS: It may help you if you read some basics of JavaScript
Thanx a lot for ur quick reply......
Sign in to post your reply or Sign up for a free account.
Similar topics
by: js |
last post by:
I am using the following script to test if a variable is undefined or
blank. The alert is not fired, if varA is blank string (ie. "", " ",
" ", etc). I need to fire the alert even when varA...
|
by: Phrederik |
last post by:
Hey all!
New to javascript and still getting my head around strings...
Consider the following line of code...
var path = location.pathname;
....after execution, the variable "path"...
|
by: Michael Hill |
last post by:
If I have:
<a href="javascript:myfunct('cool_links')" id="cool_links">
and I refer to it as:
function myfunct(mylink)
{
document.getElementById
}
|
by: TheKeith |
last post by:
can you convert a number into a string by simply adding a set of quotes like
this: 5 + ""
Thanks
|
by: |
last post by:
Is it possible to construct a CDO.To statement based on the value of an
incoming form drop down list which contains any word such as "ChangeStatus:"
How would I construct the IF statement to...
|
by: Phil Powell |
last post by:
if (document.location.href.indexOf('?') >= 0) document.location.href
= document.location.href.substring(0,
document.location.href.indexOf('?'));
if (document.location.href.indexOf('#') >= 0) {...
|
by: Erik Veldkamp |
last post by:
Hi there,
When I use javascript I can call the alert(string) method, to show an alert
window.
How can I do the same when I use C# script?
Thanks for your help
|
by: noddy |
last post by:
What I thought was a string value does not seem to be recognised as
such.
In the following code I extract the string "foo" from an array and
put it into the variable up0
But on checking I find...
|
by: rahat09 |
last post by:
I am new to JavaScript/XML, I am trying to load xml file as well as xml as string input, and have written following code. This is working in IE but not in FireFox, can anyone help?...
|
by: rahat09 |
last post by:
I am trying to load xml file as well as xml as string input, and have written following code. This is working in IE but not in FireFox, can anyone help?
...
|
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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |