|
I need something relatively light weight that enables me to write, run and debug JS code. Any thoughts on the best tools? The idea of using VS/FireFox/Venkmann or equivalent leaves me a bit cold.
Thx++
Jerry
|
|
|
|
|
Never used it, but now i have found it, i think i will take it for a spin.
Aptana Studio[^]
|
|
|
|
|
I've tried Aptana Studio out and found it awesome, but not exactly lightweight
|
|
|
|
|
I have been using firefox with the firebug addon and I have been happy.
Chris J
www.redash.org
|
|
|
|
|
firebug is better i think. you can also try JavaScript Debugger add-on.
|
|
|
|
|
I hope this is the right place for this. I've been looking for quite a while for something remotely similar to what I would like to do and no such luck (probably looking for the wrong thing). I'm just learning PHP and haven't done anything in Javascript in about 10 years so I'm beyond rusty
I'm building a calendar and what I want to do is get the navigation to work to move forward and backwards through the month. I kinda have it working in PHP but it's getting convoluted, and with the searching I've been doing a lot of people are saying to use Javascript. Only problem is I can't seem to find anything as far as examples go. I basically need to send a few variables to the next page based on which of the two buttons I select. Anyone know where I can find a good article? I either need to send the motifiers for the month and year or the new month and year.
Thanks in advance!!
|
|
|
|
|
You can send values from one page to another by either a get or a post. A get is just added to the link and a post can be down by making it use hidden inputs and javascript to fill in the selected values and form submition.
Hope that helps.
Chris J
www.redash.org
|
|
|
|
|
Good points but I haven't done lore than about 50 hours of web programming since 2001 so lets see if I got this right. Are you saying to use the javascript on (lets say) the new form vs the original? The way I have it now is "calendar" is based off the current Date to populate the calendar grid. If you choose Next Month it goes to calendar3 which processes the to procedure to add one month. If you choose the previous button it goes to calendar2 which processes the procedure to subtract one month. This is resulting in a lot of duplicate code. However if I can do the work within in javascript I can keep all the code centralized and just pass over the "new date". Maybe I can do that now but I'm not sure (new guy problem), but I'd still have 3 pages vs maybe 1 or 2. I'm thinking it would be more like "if buttonNext is clicked do this, else do this" (this is how I did it in ASP, but my boss refuses to run IIS so I had to scrap that project and go to PHP and apparently Javascript). I'm not seeing a way of doing that in PHP thus the reason I'm looking to javascript. Does that help describe my problem better?
|
|
|
|
|
It can be done in php. Try making a test project in php that has the basic function of what you are trying to do. For example have a counter with a plus and minus button, and a input field to hold a value.
I will give you a sample form to play with.
<?php
if(isset($_POST))
{
if($_POST['action']=='+')
{
$counter++;
}
else if($_POST['action']=='-')
{
$counter--;
}
else
{
}
}
else
{
$counter = 0;
}
echo "<form action='' method='post'>";
echo "<input type='submit' name='action' value='+'>";
echo "<input type='text' value='".$counter."' name='counter'>";
echo "<input type='submit' name='action' value='-'>";
echo "</form>"
?>
This should increase or decrease the counter with each click of the buttons + or -. This behaviour is like the next or prior month buttons your wrote about. You will of course need to add bound checking for the months.
If you get this going you should be able to expand on it to handle the calander.
Chris J
www.redash.org
|
|
|
|
|
Sorry for the delay, we've been having some bad network issues (bad router). I finally have some time to look at this. Looks pretty straight forward, but I'll let you know if I have any more questions.
|
|
|
|
|
This seems to work good for this example, I did however make the following changes for this page:
echo 'counter = ' .$counter = $_POST['counter'];
if(isset($_POST))
{
if($_POST['action']=='+')
{
$counter++;
echo $counter;
}
else if($_POST['action']=='-')
{
etc.......
after a few tries I realized it wasn't receiving $counter so I added the $counter = $_POST part and that seems to have fixed it, so maybe I can get away with just one page afterall which would be super.
|
|
|
|
|
Yeah, sorry I forgot to add the $_POST value for the counter, my bad.
Anyways, on a side note you will want to validate the info being used by your post before you use it or you open yourself to sql injection attacks. You can use a number of ways to scrub input sent to php and you can google the issue to find all manor of sound advice on the net and the php forum here
Chris J
www.redash.org
|
|
|
|
|
Guys, I am using javascript to animate pictures that are fetch asynchronously using ajax callback.
but every callback the motion get slower and slower.
I use in my callback function
window.addEvent('domready',function(){
var nS2 = new noobSlide({
box: $('slider1'),
items:document.getElementById('slider1').childNodes.length==1?[0]: $$('slider1 div'),
interval: 2000,
autoPlay: true,
size: 600,
fxOptions: {
duration: 1000,
wait: false
},
addButtons: {
previous: $('prev1'),
play: $('play1'),
stop: $('stop1'),
next: $('next1')
}
});
});
any one could help me.
Help people,so poeple can help you.
|
|
|
|
|
My guess is its a timing issue, try setting your interval to 10000 and watch its behaviour. Why not pre-load the images instead?
Chris J
www.redash.org
|
|
|
|
|
Sir, thank you for trying to help me, but 'interval' dosen't cause anny problem (as I want the slide to be shown for 2 seconds).
Lets analyze the problem.
I am adding events to 'window' object in each time, and also create an object of type noobSlide.
so the solution should be to destruct this object an remove the event. but i dont know how.
100
Help people,so poeple can help you.
|
|
|
|
|
I bring up the interval at 2 seconds because you are doing an ajax call to get the image from the server. If you have any issues with loading the image being requested, you may end up with a stutter I think.
when you call the set interval assign it to a var, then you can use the clearInterval with the var as a parameter.
--- edit
Looking at your code, you are referencing a custom object that does seam to repeat, but repeat what?
You may be able to watch the code run in firefox with the firebug addon, maybe that will clear it up.
Chris J
www.redash.org
|
|
|
|
|
how to send the parameta values by submit button
i have two submit buttons.
please help me.
<script type="text/javascript">
function FormSend(){
if(!CheckForm(document.frm_cpacheck)) return;
with(document.frm_cpacheck){
submit();
}
}
</script>
<center>
<table width="970" border="0" cellpadding="0" cellspacing="0"><tr><td bgcolor="#FFFFFF">
<div align="center" style="bgcolor:#FFFFFF"><div id="divGN" class="navi" style="width:970px"><script type="text/javascript" src="http://www.koreadaily.com/_dev/javascript/gn.js"></script></div></div>
</td></tr></table>
</center>
<form action="cpa_proc.asp" name="frm_cpacheck" method="post" onsubmit="return checkForm(this)" >
<input type="hidden" name="part" value="<%=part%>"/>
<div class="wrap">
<div class="pg2">
<h1><img src=/pg2_top.gif" /></h1>
<dl>
<dd class="image"><img src=/pg2_01.gif" /></dd>
</dl>
<dl class="radio">
<h2><img src=/title_check.gif" /></h2>
<dd><strong>1. </strong>
<input type="radio" name="no1" value="Y" id="no_11" /><label for="no_11"> yes</label>
<input type="radio" name="no1" value="N" id="no_12" /><label for="no_12"> No</label>
</dd>
<dd><strong>2. </strong>
<input type="radio" name="no2" value="Y" id="no_21" /><label for="no_21"> yes</label>
<input type="radio" name="no2" value="N" id="no_22" /><label for="no_22"> No</label>
</dd>
<dd><strong>3. </strong>
<input type="radio" name="no3" value="Y" id="no_31" /><label for="no_31"> yes</label>
<input type="radio" name="no3" value="N" id="no_32" /><label for="no_32"> No</label>
</dd>
</dl>
</div>
<p><img src="/2011project/pg1_03.gif" /></p>
<h3><img src="/2011project/title_etc.gif" /></h3>
<div class="etc">
<ul>
<li>K </li>
<li>M </li>
<li> </li>
</dl>
</div>
<div class="service">
<h2><img src=/title_service.gif" /></h2>
<dl>
<dd>1. </dd>
<dd>2. </dd>
<dd>3. </dd>
<dd>4. </dd>
<dd>5. </dd>
<dd>6. </dd>
<dd class="image"><a href=""><img src=/btn_service.gif" /></a></dd>
<dd class="check">
<img src=/title_agree.gif" />
<input type="checkbox" name="agree" >
</dd>
</dl>
</div>
<div class="button">
<dl>
<dd class="btncash">
<!-- Here it is the problem-->
<input type="image" src=/btn_48.gif" name="money" value="48" alt="$48" />
<input type="image" src=/btn_73.gif" name="money" value="73" alt="$73" />
<!-- Here it is the problem-->
</dd>
<p><img src=/pg1_05.gif" /></p>
<dd class="btn">
<a class="btn2" href="/list.asp?bbs_id=258" target="blank"><img src=/btn_board1.gif" /></a>
<a class="btn3" href="/list.asp?bbs_id=259" target="blank"><img src=/btn_board2.gif" /></a>
</dd>
</dl>
</div>
<p><img src=/pg1_bottom.gif" /></p>
</div>
</form>
|
|
|
|
|
|
Hi All,
If a session has timed out, would the following code still get to a readyState of 4?
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
}
Thank you,
Mel
|
|
|
|
|
Don't get me wrong I understand that the readyState can be 0-4, with the following meanings:
0 Uninitialized
1 Server connection established
2 Request recieved
3 Interactive - processing request
4 Request Complete
But what I want to know is, if the session has timed out can the readyState still reach 4?
Thanks,
Mel
|
|
|
|
|
On thinking about it, I would say maybe. Mainly due to a page does not refresh and so the last loaded session is still in effect on the users browser. So an ajax call should still return...unless the ajax is also tied to the session state. If the ajax is free of the session state then there is no issue until the page is refreshed (or post, navigation, etc...) but this should be tested first to be sure as I am just guessing and I am basing my idea on how php sessions work.
Chris J
www.redash.org
|
|
|
|
|
Hi cjoki,
Thank you for your reply. I have tested it and the result is that even though the session has expired the Ajax code still reaches a state of 4, so your theory may be right as the code isn't linked to the session.
I was thinking the Ajax code should fail though because it's carrying out calls to the server and without a session, so shouldn't the calls be impossilble?
Do you know of a way I can connect the Ajax code to the session?
Thank you,
Mel
|
|
|
|
|
What I ended up doing was to test in the aspx file (the file called by Ajax open()) if the sesison still existed. If the session existed then allow the code to run if not then send the user to the login page.
I just feel like the Ajax code should be able to detect itself if the session has expired and therefore the state shouldn't reach 4.
This is new to me though so any feedback would be really appreciated.
Thanks,
Mel
|
|
|
|
|
Would this behaviour be any different than if you clicked a link to a page that also did not reference the session?
I think it was left up to the programmer to do the test or not. Ajax is only meant to load a html fragment (or data processing via text, XML, json, etc...) not an entire page. So if someone logs into a web-based dashboard lets say of live stock quotes, do you really want to force that person to relog after every 30 minutes? On the other hand you may design a online bank account system for personal and business customers to handle checking and bill payment, a session timeout of 30 min may be way to long and so an automatic session expiration check make sense. In the end Ajax is just another tool in the toolbox and it is up to us programmers to determine the pros and cons of any design choice...again just my oppinion.
Chris J
www.redash.org
|
|
|
|
|
Dear Experts!
I have any object with classid embedded in html.
That object exposes a method with take C# reference (ref) parameter integer.
I want to call that method using javascript.
var refInt = 0;
document.getElementById("myObject").GetReferenceInt(ref refInt);
alert(refInt);
Please tell me how I can get that. I have seen ref is a keyword in JavaScript.
Can't find any solution for this. Please guide how to use object if this is not appropriate.
Thank you.
|
|
|
|