Jump to content

Check out our Community Blogs


Member Since 25 Jul 2010
Offline Last Active Aug 06 2010 08:54 AM

Topics I've Started

How to control a loop?

02 August 2010 - 11:59 AM


I'm trying to make a function that increases the webkit-Opacity when the page loads.
But first problem is that the function don't overwrite the element style before the for loop is finished, and the setTimeout don't work in the loop!!

Are there any Ideas how to make this work?

<script language="JavaScript">
function fadein()
Val = 0.0;

    while(Val < 0.6)
    document.getElementById("fadeDiv").style.webkitOpacity = Val;
    setTimeout(Val += 0.1, 1000);

<body onload="fadein()">

    <div ID="fadeDiv" style="-webkit-opacity: 0.0; width:100%; height: 100%; background-color: red">
Welcome to my Homepage!


Help with simple function!

27 July 2010 - 12:13 PM


Well.. as you will see I'm totally new in JavaScript, and I'm trying to put the following (that works fine) into a function:

<script>var current_row;</script>
    <div class="row_content" onclick="window.open('other_page.php); this.className='row_content_click'; if(current_row) current_row.className='row_content'; current_row=this;">

Now I would like to make a function so I will be able to reuse it.

This Is my own try that don't work:
function control_row(){
    var current_row;
    if(current_row) {
    } else {
<div class="row_content" onclick="control_row()">

How it should work:
  • set a default class in the <div> tag.
  • if the row is clicked change the class.
  • if a other row is clicked change back to default class.

And.. please comment the function so I can understand what's happening!

Any alternative to AJAX?

25 July 2010 - 11:40 PM


Hope this is the right place to post, no general programming under webprogramming!

I'm new to programming but has got a good grip on PHP, CSS, HTML, because I want to make a webapplication. Now I can see that javascript is needed to make AJAX calls, to make the application more "smooth".

The downside to this is different code that is mixed into each other, and same calls typed for different browsers... I hate that, and I find it hard to accept that the code is a mess with the small javascripts all over!

But.. is there any alternative??

As fare as I can see it seems that Java is the only alternative because the code can be run "everywhere" also on the web via the virtual machine most people has installed!

Therefore I'm also looking at Jruby and Jython that can be compiled to bytecode and run on virtual machine.

Is this a alternative to AJAX?
Are there any other solutions where one language can be run on the web server and client?

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download