TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   Limit action (http://www.talkphp.com/javascript-ajax-e4x/1302-limit-action.html)

Sam Granger 10-13-2007 10:30 PM

Limit action
 
Hey guys! I currently have a js function. It is called with a html link and it displays a snippet of html.

How can I limit the ammount of times this function displays the html? I want it to only show it 3 times, and after that i want it to display an error box. How can this be achieved? :)

Salathe 10-13-2007 11:32 PM

Although you might not think the same, your post is really very vague and lacking details. Post up your code, or a succinct sample, and it'll be ten times easier to provide exactly what you want.

Sam Granger 10-13-2007 11:50 PM

Quote:

Originally Posted by Salathe (Post 3067)
Although you might not think the same, your post is really very vague and lacking details. Post up your code, or a succinct sample, and it'll be ten times easier to provide exactly what you want.

Ok, right now I have a button with the following link: javascript:createFileInput();

The js createFileInput function:

PHP Code:

//** FUNCTION: Create Upload Form
    
function createFileInput(path) {
        var 
tbody document.getElementById('list_body').getElementsByTagName('tbody')[0];        
    
// Create Table Row    
        
var tr document.createElement("tr")
        if (
bg_color) { tr.className="on"bg_colorfalse; } else { bg_color true;}
    
// Create Table Cell
        
var td document.createElement("td")
        
td.id='upload_'+count;
        
td.width='100%';
        var 
output = new Array();
        
output.push("<form id='frmUpload_"+count+"' target='uploadForm' method='post' enctype='multipart/form-data' action='/cgi-bin/upload.cgi?sid="+sid+"'>");
        
output.push("<input type='hidden' name='path' value='"+path+"'>");
        
output.push("<input style='width:100%;' type='file' name='filename' ><\/form>");
        
td.innerHTML output.join('');
        
tr.appendChild(td);
        
tbody.appendChild(tr);    
        
uploads.push(count);
        if (
count != ) {
            var 
tiggerForm document.getElementById('frmUpload_'+count);
            
tiggerForm['filename'].click();
            
tiggerForm null;
        }
        
count++;

        
    } 


Sam Granger 10-15-2007 04:12 PM

Sorry guys, I must of posted this when I was completely sleepy, pretty simple to do, I have completed it myself. Thanks though Salathe! ;)


All times are GMT. The time now is 06:33 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0