|
hi Mat here is my code with your advice
<asp:ImageButton ID="btnComment" runat="server"
ImageUrl="~/Imgs/comment2.png"
OnClientClick= '<%# String.Format("return showComment(""{0}"",""{1}"")", "Parameter1", ""Parameter2") %>'
ToolTip="Click here to view a Comment" Visible='<%# CheckPendStatus() %>' />
and it gives an Error
Error 149 Comma, ')', or a valid expression continuation expected.
Error 219 Comma, ')', or a valid expression continuation expected.
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
You have a second quote before Parameter2.
|
|
|
|
|
hi Matt
thanks for pointing that out it now looks like this
'<%# String.Format("return showComment(""{0}"",""{1}"")", "PARAMETER1", "PARAMETER2") %>'
when i run it it does not take the values but it give me the names of the variable, can i use Eval like this
'<%# String.Format("return showComment(""{0}"",""{1}"")", Eval("PARAMETER1"), Eval("PARAMETER2") %>'
THanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
I used string literals in my example. If you want the variables themselves (and they're at least protected), you can do this:
<%# String.Format("return showComment(""{0}"",""{1}"")", Parameter1, Parameter2) %>
where Parameter1 and Parameter2 are variable names in the page object.
|
|
|
|
|
Thank you very much for you help , i have ended up using it this way and it works
'<%# String.Format("return showComment(""{0}"",""{1}"")", Eval("Parameter1"), Eval("Parameter2")) %>'
Thanks you a Star
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@dotnetfunda.com
http://www.Dotnetfunda.com
|
|
|
|
|
Thanks. Your code solved my problem
|
|
|
|
|
hello,
i have a big javascript page that needs to be loaded and i was wondering if there is a way to put in a loading screen,
as you know, with images they take time and sometimes other objects on the page can also create the user to wait a while so my question is how do i go about creating a loading screen which will detect when all images, content and functions have been loaded and then disappear when they have finished?
do i use the windows.load event, if so is there such thing as a window.loaded event?
Thanks for all your help i have been searching for hours and still cant really get anywhere
Steve
|
|
|
|
|
You can use jQuery for this one - there's a document.ready event you can handle.
C# has already designed away most of the tedium of C++.
|
|
|
|
|
|
Please stop posting requests for source code; it is not going to happen.
|
|
|
|
|
And OP totally ignores that this is the javascript forum while asking for a java solution.
"With sufficient thrust, pigs fly just fine."
Ross Callon, The Twelve Networking Truths, RFC1925
|
|
|
|
|
I think it is a case of :
- I need to develop a program
- No time to write it
- Ask CodeProject for source code
- GOTO 1:
|
|
|
|
|
I need help with regular expression.
I have some html code into a variable that is named xmlDoc. The code includes a table and there are some things there that I want to pick out with regex.
<tr class="myGreyRow">
<td>6</td>
<td id="fn1">Prentice, Bob</td>
<td>340584305858</td>
<td>Logged out</td>
<td>
<a class="listlink" href="javascript:doEditAgent("56746")">Edit</a>,
<a class="listlink" href="javascript:doRemoveAgent("56746", "fn1")">Delete</a>,
<a class="listlink" href="javascript:doLoginLogout("4", "56746","fn1")">Log in</a>
</td>
</tr>
In this code I want to pick out:
1. The name, "Prentice, Bob"
2. The status, "Logged out"
3. The content from doLoginLogout(), "4", "56746","fn1"
How do I do this?
There are five rows similar to this in the table that I need to do this on.
|
|
|
|
|
If you're asking about how to use Regexp in JavaScript, Google[^] can help you.
If you're asking about the regexp string, ask here[^].
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
Thanks, I totaly missed that there where a special Regular expression section here.
|
|
|
|
|
Using XPath might be a better idea to parse things out of an XML file. Just a thought. It may not apply to your application.
|
|
|
|
|
When I test it, the only error I get is "Expected '(' Line: 17 Char: 1. Before that I had the return statement outside of function, I moved my return statement from where I validated the comment area outside and it worked, but it seems now I have more errors than I expected. Not too sure what I am leaving out or doing wrong.
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
function ValidateContactForm()
{
if (document.getElementById("author").value === "")
{
window.alert("Please provide a detailed description or comment.");
document.getElementById("author").focus();
}
if
{
((!(/^([a-z0-9])([\w\.\-\+])+([a-z0-9])\@(([\w\-]?)+\.)+([a-z]{2,4})$/i.test(document.form2.
email.value)) {
alert ("Invalid email address! Please retry.");
document.ContactForm.email.value == "";
document.ContactForm.email.focus();
return false;
}
if (document.getElementById("text").value === "")
{
window.alert("Please provide a detailed description or comment.");
document.getElementById("text").focus();
}
return false;
}
}
</script>
</head>
<body>
<div id="templatemo_wrapper">
<div id="templatemo_header">
<ul id="social_box">
<li><a href="http://www.facebook.com/"><img
src="images/facebook.png" alt="facebook" /></a></li>
<li><a href="http://www.twitter.com/"><img src="images/twitter.png"
alt="twitter" /></a></li>
</ul>
<div id="site_title">
<h1><a href="index.htm"><img src="images/logo2.png" alt="logo"
/><span></span></a></h1>
</div> <!--
</div> <!--
<!--
<div id="templatemo_content_wrapper">
<div id="templatemo_content_top"></div>
<div id="templatemo_content">
<h2>Contact</h2>
<p>E-mail: starr05@gmail.com </p>
<p><a href="http://www.twitter.com/">Twitter</a></p>
<div class="cleaner_h50"></div>
<div id="contact_form">
<h4>Quick Contact</h4>
<form method="post" name="ContactForm" id="contact" action="email.php"
onsubmit="return ValidateContactForm();">
<div class="col_w340 float_l">
<label for="author">Name (* Required):</label> <input
name="author" type="text" class="input_field" id="author" maxlength="40" />
<div class="cleaner_h10"></div>
<label for="subject">Subject:</label> <input name="subject" type="text" class="input_field"
id="subject" maxlength="40" />
<div class="cleaner_h10"></div>
<label for="email">Email (* Required):</label> <input
name="email" type="text" class="input_field" id="email" maxlength="40" />
<div class="cleaner_h10"></div>
Type verification image:<br />
<input name="verif_box" type="text" id="verif_box" style="padding:2px; border:1px solid
#CCCCCC; width:180px; height:14px;font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;"/>
<img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification image, type it
in the box" width="50" height="24" align="absbottom" /><br />
<br />
</div>
<div class="col_w340 float_r">
<label for="text">Message (*Required):</label> <textarea
id="text" name="text" rows="0" cols="0" class="required"></textarea>
<div class="cleaner_h10"></div>
<input type="submit" class="submit_btn float_l" name="submit"
id="submit" value="Send" />
<input type="reset" class="submit_btn float_r" name="reset"
id="reset" value="Reset" />
</div>
</form>
</div>
<div class="cleaner"></div>
</div>
<div id="templatemo_content_bottom"></div>
</div>
<div id="templatemo_sp_box">
<div class="col_w340 float_l">
</div>
</div>
<div class="col_w340 float_r">
</div>
</div>
</div>
<div id="templatemo_footer">
Copyright © 2011 <a href="www.twitter.com/">Starr</a><br/>
<a href="http://www.iwebsitetemplate.com" rel="nofollow" target="_parent">Website Templates</a>
by <a href="http://www.templatemo.com" rel="nofollow" target="_parent">Free CSS Templates</a>
</div> <!--
</div> <!--
</body>
</html>
<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact</title>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<?php
$first_name=$_POST['name'];
$email_address=$_POST['email'];
$subject=$_POST['subject'];
$message=$_POST['text'];
mail("starr05@gmail.com","Subject: $subject",
$message, "From: $first_name <$email_address>");
echo "Thank you for using our mail form.<br/>";
echo "Your email has been sent.";
?>
</body>
</html>
<pre lang="PHP">
<?php
header('Content-type: image/jpeg');
$width = 50;
$height = 24;
$my_image = imagecreatetruecolor($width, $height);
imagefill($my_image, 0, 0, 0xFFFFFF);
for ($c = 0; $c < 40; $c++){
$x = rand(0,$width-1);
$y = rand(0,$height-1);
imagesetpixel($my_image, $x, $y, 0x000000);
}
$x = rand(1,10);
$y = rand(1,10);
$rand_string = rand(1000,9999);
imagestring($my_image, 5, $x, $y, $rand_string, 0x000000);
setcookie('tntcon',(md5($rand_string).'a4xn'));
imagejpeg($my_image);
imagedestroy($my_image);
?>
|
|
|
|
|
starr007 wrote: if
{
((!(/^([a-z0-9])([\w\.\-\+])+([a-z0-9])\@(([\w\-]?)+\.)+([a-z]{2,4})$/i.test(document.form2.
email.value)) {
The left curly brace on the line after if is wrong. As the error message says, if should be followed by (
It always pays to read the error messages carefully, and look where they are pointing you.
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
I'm working on a dice-roller that's an ugly mix of PHP, JavaScript, and whatever else I need in order to make it work. The roller itself works fine, but I decided to get a little fancy with it for the sake of the person that I'm doing this for, and I tried to add logging to it, and breaking down the logs based on what "game" the user is playing. The issue is that I want to have the logs update themselves after x seconds. PHP clearly can't handle this, and my understanding is that JavaScript can't do it by itself, so I have attempted to learn enough Ajax to piece everything together. Here is what I've managed to put together:
<script type='text/javascript'>
var timer = 10;
var game_id = '$g';
var updateLogs = function()
{
var url = 'backend/timed-script.php?g=' + game_id + '&randval=' + Math.random();
var xmlhttp = new XMLHttpRequest();
xmlhttp.open('GET',url,'TRUE');
xmlhttp.send();
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
{
document.getElementById('log_box').innerhtml = xmlhttp.responstText;
}
}
}
setInterval(updateLogs, timer*1000);
</script>
I've thrown an alert() inside updateLogs to make sure that setInterval isn't failing, and that works. The issue is that the isn't populating like it should. I know that timed-script.php works (since pasting the URL in my address bar brings the page up with the appropriate data). Can someone tell me what I'm doing wrong here?
Thanks
|
|
|
|
|
Member 4592879 wrote: var url = 'backend/timed-script.php
Are you sure that is the correct url? don't you wanna take out that " backend/ "?
|
|
|
|
|
Thanks for getting back to me.
The PHP script is in a folder called backend that is just off the root, so the structure looks like this:
www.domain.com/broken_page.php
www.domain.com/backend/timed-script.php
If I feed the appropriate value for g to the backend script, it does display the correct data set, but it won't work with the JavaScript. I've tried pulling it out of the backend folder and into the root, but the same thing happens, or rather, doesn't happen.
|
|
|
|
|
Member 4592879 wrote: document.getElementById('log_box').innerhtml = xmlhttp.responstText;
I just double checked your javascript and spotted .innerhtml = xmlhttp.responstText;
try:
document.getElementById('log_box').innerHTML = xmlhttp.responseText;
Also take a look at how you create the ajax object:
http://www.w3schools.com/ajax/tryit.asp?filename=tryajax_first[^]
Let me know if that helps,
Morgs
|
|
|
|
|
w3schools is where I got what I've been trying to use. I've omitted the
|
|
|
|
|
Turns out that after changing a bunch of things (including the two typos that you pointed out), I got it working. Thank you very much for your assistance.
|
|
|
|
|
Anyone else have any other ideas?
|
|
|
|
|